mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
vendor: updating gophercloud for block storage attachment support
This commit is contained in:
parent
672d4d20d7
commit
22dd265132
5
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/doc.go
generated
vendored
Normal file
5
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/doc.go
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
// Package volumeactions provides information and interaction with volumes in the
|
||||
// OpenStack Block Storage service. A volume is a detachable block storage
|
||||
// device, akin to a USB hard drive. It can only be attached to one instance at
|
||||
// a time.
|
||||
package volumeactions
|
216
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/requests.go
generated
vendored
Normal file
216
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/requests.go
generated
vendored
Normal file
@ -0,0 +1,216 @@
|
||||
package volumeactions
|
||||
|
||||
import (
|
||||
"github.com/gophercloud/gophercloud"
|
||||
)
|
||||
|
||||
// AttachOptsBuilder allows extensions to add additional parameters to the
|
||||
// Attach request.
|
||||
type AttachOptsBuilder interface {
|
||||
ToVolumeAttachMap() (map[string]interface{}, error)
|
||||
}
|
||||
|
||||
// AttachMode describes the attachment mode for volumes.
|
||||
type AttachMode string
|
||||
|
||||
// These constants determine how a volume is attached
|
||||
const (
|
||||
ReadOnly AttachMode = "ro"
|
||||
ReadWrite AttachMode = "rw"
|
||||
)
|
||||
|
||||
// AttachOpts contains options for attaching a Volume.
|
||||
type AttachOpts struct {
|
||||
// The mountpoint of this volume
|
||||
MountPoint string `json:"mountpoint,omitempty"`
|
||||
// The nova instance ID, can't set simultaneously with HostName
|
||||
InstanceUUID string `json:"instance_uuid,omitempty"`
|
||||
// The hostname of baremetal host, can't set simultaneously with InstanceUUID
|
||||
HostName string `json:"host_name,omitempty"`
|
||||
// Mount mode of this volume
|
||||
Mode AttachMode `json:"mode,omitempty"`
|
||||
}
|
||||
|
||||
// ToVolumeAttachMap assembles a request body based on the contents of a
|
||||
// AttachOpts.
|
||||
func (opts AttachOpts) ToVolumeAttachMap() (map[string]interface{}, error) {
|
||||
return gophercloud.BuildRequestBody(opts, "os-attach")
|
||||
}
|
||||
|
||||
// Attach will attach a volume based on the values in AttachOpts.
|
||||
func Attach(client *gophercloud.ServiceClient, id string, opts AttachOptsBuilder) (r AttachResult) {
|
||||
b, err := opts.ToVolumeAttachMap()
|
||||
if err != nil {
|
||||
r.Err = err
|
||||
return
|
||||
}
|
||||
_, r.Err = client.Post(attachURL(client, id), b, nil, &gophercloud.RequestOpts{
|
||||
OkCodes: []int{202},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// BeginDetach will mark the volume as detaching
|
||||
func BeginDetaching(client *gophercloud.ServiceClient, id string) (r BeginDetachingResult) {
|
||||
b := map[string]interface{}{"os-begin_detaching": make(map[string]interface{})}
|
||||
_, r.Err = client.Post(beginDetachingURL(client, id), b, nil, &gophercloud.RequestOpts{
|
||||
OkCodes: []int{202},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// DetachOptsBuilder allows extensions to add additional parameters to the
|
||||
// Detach request.
|
||||
type DetachOptsBuilder interface {
|
||||
ToVolumeDetachMap() (map[string]interface{}, error)
|
||||
}
|
||||
|
||||
type DetachOpts struct {
|
||||
AttachmentID string `json:"attachment_id,omitempty"`
|
||||
}
|
||||
|
||||
// ToVolumeDetachMap assembles a request body based on the contents of a
|
||||
// DetachOpts.
|
||||
func (opts DetachOpts) ToVolumeDetachMap() (map[string]interface{}, error) {
|
||||
return gophercloud.BuildRequestBody(opts, "os-detach")
|
||||
}
|
||||
|
||||
// Detach will detach a volume based on volume id.
|
||||
func Detach(client *gophercloud.ServiceClient, id string, opts DetachOptsBuilder) (r DetachResult) {
|
||||
b, err := opts.ToVolumeDetachMap()
|
||||
if err != nil {
|
||||
r.Err = err
|
||||
return
|
||||
}
|
||||
_, r.Err = client.Post(detachURL(client, id), b, nil, &gophercloud.RequestOpts{
|
||||
OkCodes: []int{202},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Reserve will reserve a volume based on volume id.
|
||||
func Reserve(client *gophercloud.ServiceClient, id string) (r ReserveResult) {
|
||||
b := map[string]interface{}{"os-reserve": make(map[string]interface{})}
|
||||
_, r.Err = client.Post(reserveURL(client, id), b, nil, &gophercloud.RequestOpts{
|
||||
OkCodes: []int{200, 201, 202},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Unreserve will unreserve a volume based on volume id.
|
||||
func Unreserve(client *gophercloud.ServiceClient, id string) (r UnreserveResult) {
|
||||
b := map[string]interface{}{"os-unreserve": make(map[string]interface{})}
|
||||
_, r.Err = client.Post(unreserveURL(client, id), b, nil, &gophercloud.RequestOpts{
|
||||
OkCodes: []int{200, 201, 202},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// InitializeConnectionOptsBuilder allows extensions to add additional parameters to the
|
||||
// InitializeConnection request.
|
||||
type InitializeConnectionOptsBuilder interface {
|
||||
ToVolumeInitializeConnectionMap() (map[string]interface{}, error)
|
||||
}
|
||||
|
||||
// InitializeConnectionOpts hosts options for InitializeConnection.
|
||||
type InitializeConnectionOpts struct {
|
||||
IP string `json:"ip,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Initiator string `json:"initiator,omitempty"`
|
||||
Wwpns []string `json:"wwpns,omitempty"`
|
||||
Wwnns string `json:"wwnns,omitempty"`
|
||||
Multipath *bool `json:"multipath,omitempty"`
|
||||
Platform string `json:"platform,omitempty"`
|
||||
OSType string `json:"os_type,omitempty"`
|
||||
}
|
||||
|
||||
// ToVolumeInitializeConnectionMap assembles a request body based on the contents of a
|
||||
// InitializeConnectionOpts.
|
||||
func (opts InitializeConnectionOpts) ToVolumeInitializeConnectionMap() (map[string]interface{}, error) {
|
||||
b, err := gophercloud.BuildRequestBody(opts, "connector")
|
||||
return map[string]interface{}{"os-initialize_connection": b}, err
|
||||
}
|
||||
|
||||
// InitializeConnection initializes iscsi connection.
|
||||
func InitializeConnection(client *gophercloud.ServiceClient, id string, opts InitializeConnectionOptsBuilder) (r InitializeConnectionResult) {
|
||||
b, err := opts.ToVolumeInitializeConnectionMap()
|
||||
if err != nil {
|
||||
r.Err = err
|
||||
return
|
||||
}
|
||||
_, r.Err = client.Post(initializeConnectionURL(client, id), b, &r.Body, &gophercloud.RequestOpts{
|
||||
OkCodes: []int{200, 201, 202},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// TerminateConnectionOptsBuilder allows extensions to add additional parameters to the
|
||||
// TerminateConnection request.
|
||||
type TerminateConnectionOptsBuilder interface {
|
||||
ToVolumeTerminateConnectionMap() (map[string]interface{}, error)
|
||||
}
|
||||
|
||||
// TerminateConnectionOpts hosts options for TerminateConnection.
|
||||
type TerminateConnectionOpts struct {
|
||||
IP string `json:"ip,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Initiator string `json:"initiator,omitempty"`
|
||||
Wwpns []string `json:"wwpns,omitempty"`
|
||||
Wwnns string `json:"wwnns,omitempty"`
|
||||
Multipath *bool `json:"multipath,omitempty"`
|
||||
Platform string `json:"platform,omitempty"`
|
||||
OSType string `json:"os_type,omitempty"`
|
||||
}
|
||||
|
||||
// ToVolumeTerminateConnectionMap assembles a request body based on the contents of a
|
||||
// TerminateConnectionOpts.
|
||||
func (opts TerminateConnectionOpts) ToVolumeTerminateConnectionMap() (map[string]interface{}, error) {
|
||||
b, err := gophercloud.BuildRequestBody(opts, "connector")
|
||||
return map[string]interface{}{"os-terminate_connection": b}, err
|
||||
}
|
||||
|
||||
// TerminateConnection terminates iscsi connection.
|
||||
func TerminateConnection(client *gophercloud.ServiceClient, id string, opts TerminateConnectionOptsBuilder) (r TerminateConnectionResult) {
|
||||
b, err := opts.ToVolumeTerminateConnectionMap()
|
||||
if err != nil {
|
||||
r.Err = err
|
||||
return
|
||||
}
|
||||
_, r.Err = client.Post(teminateConnectionURL(client, id), b, nil, &gophercloud.RequestOpts{
|
||||
OkCodes: []int{202},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// ExtendSizeOptsBuilder allows extensions to add additional parameters to the
|
||||
// ExtendSize request.
|
||||
type ExtendSizeOptsBuilder interface {
|
||||
ToVolumeExtendSizeMap() (map[string]interface{}, error)
|
||||
}
|
||||
|
||||
// ExtendSizeOpts contain options for extending the size of an existing Volume. This object is passed
|
||||
// to the volumes.ExtendSize function.
|
||||
type ExtendSizeOpts struct {
|
||||
// NewSize is the new size of the volume, in GB
|
||||
NewSize int `json:"new_size" required:"true"`
|
||||
}
|
||||
|
||||
// ToVolumeExtendSizeMap assembles a request body based on the contents of an
|
||||
// ExtendSizeOpts.
|
||||
func (opts ExtendSizeOpts) ToVolumeExtendSizeMap() (map[string]interface{}, error) {
|
||||
return gophercloud.BuildRequestBody(opts, "os-extend")
|
||||
}
|
||||
|
||||
// ExtendSize will extend the size of the volume based on the provided information.
|
||||
// This operation does not return a response body.
|
||||
func ExtendSize(client *gophercloud.ServiceClient, id string, opts ExtendSizeOptsBuilder) (r ExtendSizeResult) {
|
||||
b, err := opts.ToVolumeExtendSizeMap()
|
||||
if err != nil {
|
||||
r.Err = err
|
||||
return
|
||||
}
|
||||
_, r.Err = client.Post(extendSizeURL(client, id), b, &r.Body, &gophercloud.RequestOpts{
|
||||
OkCodes: []int{202},
|
||||
})
|
||||
return
|
||||
}
|
56
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/results.go
generated
vendored
Normal file
56
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/results.go
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
package volumeactions
|
||||
|
||||
import "github.com/gophercloud/gophercloud"
|
||||
|
||||
// AttachResult contains the response body and error from a Get request.
|
||||
type AttachResult struct {
|
||||
gophercloud.ErrResult
|
||||
}
|
||||
|
||||
// BeginDetachingResult contains the response body and error from a Get request.
|
||||
type BeginDetachingResult struct {
|
||||
gophercloud.ErrResult
|
||||
}
|
||||
|
||||
// DetachResult contains the response body and error from a Get request.
|
||||
type DetachResult struct {
|
||||
gophercloud.ErrResult
|
||||
}
|
||||
|
||||
// ReserveResult contains the response body and error from a Get request.
|
||||
type ReserveResult struct {
|
||||
gophercloud.ErrResult
|
||||
}
|
||||
|
||||
// UnreserveResult contains the response body and error from a Get request.
|
||||
type UnreserveResult struct {
|
||||
gophercloud.ErrResult
|
||||
}
|
||||
|
||||
// TerminateConnectionResult contains the response body and error from a Get request.
|
||||
type TerminateConnectionResult struct {
|
||||
gophercloud.ErrResult
|
||||
}
|
||||
|
||||
type commonResult struct {
|
||||
gophercloud.Result
|
||||
}
|
||||
|
||||
// Extract will get the Volume object out of the commonResult object.
|
||||
func (r commonResult) Extract() (map[string]interface{}, error) {
|
||||
var s struct {
|
||||
ConnectionInfo map[string]interface{} `json:"connection_info"`
|
||||
}
|
||||
err := r.ExtractInto(&s)
|
||||
return s.ConnectionInfo, err
|
||||
}
|
||||
|
||||
// InitializeConnectionResult contains the response body and error from a Get request.
|
||||
type InitializeConnectionResult struct {
|
||||
commonResult
|
||||
}
|
||||
|
||||
// ExtendSizeResult contains the response body and error from an ExtendSize request.
|
||||
type ExtendSizeResult struct {
|
||||
gophercloud.ErrResult
|
||||
}
|
35
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/urls.go
generated
vendored
Normal file
35
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/urls.go
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
package volumeactions
|
||||
|
||||
import "github.com/gophercloud/gophercloud"
|
||||
|
||||
func attachURL(c *gophercloud.ServiceClient, id string) string {
|
||||
return c.ServiceURL("volumes", id, "action")
|
||||
}
|
||||
|
||||
func beginDetachingURL(c *gophercloud.ServiceClient, id string) string {
|
||||
return attachURL(c, id)
|
||||
}
|
||||
|
||||
func detachURL(c *gophercloud.ServiceClient, id string) string {
|
||||
return attachURL(c, id)
|
||||
}
|
||||
|
||||
func reserveURL(c *gophercloud.ServiceClient, id string) string {
|
||||
return attachURL(c, id)
|
||||
}
|
||||
|
||||
func unreserveURL(c *gophercloud.ServiceClient, id string) string {
|
||||
return attachURL(c, id)
|
||||
}
|
||||
|
||||
func initializeConnectionURL(c *gophercloud.ServiceClient, id string) string {
|
||||
return attachURL(c, id)
|
||||
}
|
||||
|
||||
func teminateConnectionURL(c *gophercloud.ServiceClient, id string) string {
|
||||
return attachURL(c, id)
|
||||
}
|
||||
|
||||
func extendSizeURL(c *gophercloud.ServiceClient, id string) string {
|
||||
return attachURL(c, id)
|
||||
}
|
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
@ -1007,6 +1007,12 @@
|
||||
"revision": "e3d6384a3714b335d075862e6eb0a681180643df",
|
||||
"revisionTime": "2016-10-25T18:03:21Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "XAKLUSwXSMGtbp+U874qU4MzT/A=",
|
||||
"path": "github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions",
|
||||
"revision": "d5eda9707e146108e4d424062b602fd97a71c2e6",
|
||||
"revisionTime": "2016-11-14T18:28:31Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "PFD8SEqhArAy/6jRbIlYb5lp64k=",
|
||||
"path": "github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes",
|
||||
|
Loading…
Reference in New Issue
Block a user