update deps
This commit is contained in:
18
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes/requests.go
generated
vendored
18
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes/requests.go
generated
vendored
@@ -15,15 +15,15 @@ type CreateOptsBuilder interface {
|
||||
// the volumes.Create function. For more information about these parameters,
|
||||
// see the Volume object.
|
||||
type CreateOpts struct {
|
||||
Size int `json:"size" required:"true"`
|
||||
Availability string `json:"availability,omitempty"`
|
||||
Description string `json:"display_description,omitempty"`
|
||||
Metadata map[string]string `json:"metadata,omitempty"`
|
||||
Name string `json:"display_name,omitempty"`
|
||||
SnapshotID string `json:"snapshot_id,omitempty"`
|
||||
SourceVolID string `json:"source_volid,omitempty"`
|
||||
ImageID string `json:"imageRef,omitempty"`
|
||||
VolumeType string `json:"volume_type,omitempty"`
|
||||
Size int `json:"size" required:"true"`
|
||||
AvailabilityZone string `json:"availability_zone,omitempty"`
|
||||
Description string `json:"display_description,omitempty"`
|
||||
Metadata map[string]string `json:"metadata,omitempty"`
|
||||
Name string `json:"display_name,omitempty"`
|
||||
SnapshotID string `json:"snapshot_id,omitempty"`
|
||||
SourceVolID string `json:"source_volid,omitempty"`
|
||||
ImageID string `json:"imageRef,omitempty"`
|
||||
VolumeType string `json:"volume_type,omitempty"`
|
||||
}
|
||||
|
||||
// ToVolumeCreateMap assembles a request body based on the contents of a
|
||||
|
87
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v2/volumes/results.go
generated
vendored
87
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v2/volumes/results.go
generated
vendored
@@ -1,18 +1,38 @@
|
||||
package volumes
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/gophercloud/gophercloud"
|
||||
"github.com/gophercloud/gophercloud/pagination"
|
||||
)
|
||||
|
||||
type Attachment struct {
|
||||
AttachedAt gophercloud.JSONRFC3339MilliNoZ `json:"attached_at"`
|
||||
AttachmentID string `json:"attachment_id"`
|
||||
Device string `json:"device"`
|
||||
HostName string `json:"host_name"`
|
||||
ID string `json:"id"`
|
||||
ServerID string `json:"server_id"`
|
||||
VolumeID string `json:"volume_id"`
|
||||
AttachedAt time.Time `json:"-"`
|
||||
AttachmentID string `json:"attachment_id"`
|
||||
Device string `json:"device"`
|
||||
HostName string `json:"host_name"`
|
||||
ID string `json:"id"`
|
||||
ServerID string `json:"server_id"`
|
||||
VolumeID string `json:"volume_id"`
|
||||
}
|
||||
|
||||
func (r *Attachment) UnmarshalJSON(b []byte) error {
|
||||
type tmp Attachment
|
||||
var s struct {
|
||||
tmp
|
||||
AttachedAt gophercloud.JSONRFC3339MilliNoZ `json:"attached_at"`
|
||||
}
|
||||
err := json.Unmarshal(b, &s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*r = Attachment(s.tmp)
|
||||
|
||||
r.AttachedAt = time.Time(s.AttachedAt)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Volume contains all the information associated with an OpenStack Volume.
|
||||
@@ -26,9 +46,9 @@ type Volume struct {
|
||||
// AvailabilityZone is which availability zone the volume is in.
|
||||
AvailabilityZone string `json:"availability_zone"`
|
||||
// The date when this volume was created.
|
||||
CreatedAt gophercloud.JSONRFC3339MilliNoZ `json:"created_at"`
|
||||
CreatedAt time.Time `json:"-"`
|
||||
// The date when this volume was last updated
|
||||
UpdatedAt gophercloud.JSONRFC3339MilliNoZ `json:"updated_at"`
|
||||
UpdatedAt time.Time `json:"-"`
|
||||
// Instances onto which the volume is attached.
|
||||
Attachments []Attachment `json:"attachments"`
|
||||
// Human-readable display name for the volume.
|
||||
@@ -57,15 +77,24 @@ type Volume struct {
|
||||
Multiattach bool `json:"multiattach"`
|
||||
}
|
||||
|
||||
/*
|
||||
THESE BELONG IN EXTENSIONS:
|
||||
// ReplicationDriverData contains data about the replication driver.
|
||||
ReplicationDriverData string `json:"os-volume-replication:driver_data"`
|
||||
// ReplicationExtendedStatus contains extended status about replication.
|
||||
ReplicationExtendedStatus string `json:"os-volume-replication:extended_status"`
|
||||
// TenantID is the id of the project that owns the volume.
|
||||
TenantID string `json:"os-vol-tenant-attr:tenant_id"`
|
||||
*/
|
||||
func (r *Volume) UnmarshalJSON(b []byte) error {
|
||||
type tmp Volume
|
||||
var s struct {
|
||||
tmp
|
||||
CreatedAt gophercloud.JSONRFC3339MilliNoZ `json:"created_at"`
|
||||
UpdatedAt gophercloud.JSONRFC3339MilliNoZ `json:"updated_at"`
|
||||
}
|
||||
err := json.Unmarshal(b, &s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*r = Volume(s.tmp)
|
||||
|
||||
r.CreatedAt = time.Time(s.CreatedAt)
|
||||
r.UpdatedAt = time.Time(s.UpdatedAt)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// VolumePage is a pagination.pager that is returned from a call to the List function.
|
||||
type VolumePage struct {
|
||||
@@ -80,11 +109,9 @@ func (r VolumePage) IsEmpty() (bool, error) {
|
||||
|
||||
// ExtractVolumes extracts and returns Volumes. It is used while iterating over a volumes.List call.
|
||||
func ExtractVolumes(r pagination.Page) ([]Volume, error) {
|
||||
var s struct {
|
||||
Volumes []Volume `json:"volumes"`
|
||||
}
|
||||
err := (r.(VolumePage)).ExtractInto(&s)
|
||||
return s.Volumes, err
|
||||
var s []Volume
|
||||
err := ExtractVolumesInto(r, &s)
|
||||
return s, err
|
||||
}
|
||||
|
||||
type commonResult struct {
|
||||
@@ -93,11 +120,17 @@ type commonResult struct {
|
||||
|
||||
// Extract will get the Volume object out of the commonResult object.
|
||||
func (r commonResult) Extract() (*Volume, error) {
|
||||
var s struct {
|
||||
Volume *Volume `json:"volume"`
|
||||
}
|
||||
var s Volume
|
||||
err := r.ExtractInto(&s)
|
||||
return s.Volume, err
|
||||
return &s, err
|
||||
}
|
||||
|
||||
func (r commonResult) ExtractInto(v interface{}) error {
|
||||
return r.Result.ExtractIntoStructPtr(v, "volume")
|
||||
}
|
||||
|
||||
func ExtractVolumesInto(r pagination.Page, v interface{}) error {
|
||||
return r.(VolumePage).Result.ExtractIntoSlicePtr(v, "volumes")
|
||||
}
|
||||
|
||||
// CreateResult contains the response body and error from a Create request.
|
||||
|
13
vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go
generated
vendored
13
vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go
generated
vendored
@@ -145,7 +145,7 @@ type CreateOpts struct {
|
||||
SecurityGroups []string `json:"-"`
|
||||
|
||||
// UserData contains configuration information or scripts to use upon launch.
|
||||
// Create will base64-encode it for you.
|
||||
// Create will base64-encode it for you, if it isn't already.
|
||||
UserData []byte `json:"-"`
|
||||
|
||||
// AvailabilityZone in which to launch the server.
|
||||
@@ -160,7 +160,7 @@ type CreateOpts struct {
|
||||
|
||||
// Personality includes files to inject into the server at launch.
|
||||
// Create will base64-encode file contents for you.
|
||||
Personality Personality `json:"-"`
|
||||
Personality Personality `json:"personality,omitempty"`
|
||||
|
||||
// ConfigDrive enables metadata injection through a configuration drive.
|
||||
ConfigDrive *bool `json:"config_drive,omitempty"`
|
||||
@@ -190,8 +190,13 @@ func (opts CreateOpts) ToServerCreateMap() (map[string]interface{}, error) {
|
||||
}
|
||||
|
||||
if opts.UserData != nil {
|
||||
encoded := base64.StdEncoding.EncodeToString(opts.UserData)
|
||||
b["user_data"] = &encoded
|
||||
var userData string
|
||||
if _, err := base64.StdEncoding.DecodeString(string(opts.UserData)); err != nil {
|
||||
userData = base64.StdEncoding.EncodeToString(opts.UserData)
|
||||
} else {
|
||||
userData = string(opts.UserData)
|
||||
}
|
||||
b["user_data"] = &userData
|
||||
}
|
||||
|
||||
if len(opts.SecurityGroups) > 0 {
|
||||
|
60
vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/results.go
generated
vendored
60
vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/results.go
generated
vendored
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/gophercloud/gophercloud"
|
||||
"github.com/gophercloud/gophercloud/pagination"
|
||||
@@ -101,12 +102,12 @@ func decryptPassword(encryptedPassword string, privateKey *rsa.PrivateKey) (stri
|
||||
}
|
||||
|
||||
// ExtractImageID gets the ID of the newly created server image from the header
|
||||
func (res CreateImageResult) ExtractImageID() (string, error) {
|
||||
if res.Err != nil {
|
||||
return "", res.Err
|
||||
func (r CreateImageResult) ExtractImageID() (string, error) {
|
||||
if r.Err != nil {
|
||||
return "", r.Err
|
||||
}
|
||||
// Get the image id from the header
|
||||
u, err := url.ParseRequestURI(res.Header.Get("Location"))
|
||||
u, err := url.ParseRequestURI(r.Header.Get("Location"))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -137,26 +138,27 @@ type Server struct {
|
||||
// Name contains the human-readable name for the server.
|
||||
Name string `json:"name"`
|
||||
// Updated and Created contain ISO-8601 timestamps of when the state of the server last changed, and when it was created.
|
||||
Updated string
|
||||
Created string
|
||||
HostID string
|
||||
Updated time.Time `json:"updated"`
|
||||
Created time.Time `json:"created"`
|
||||
HostID string `json:"hostid"`
|
||||
// Status contains the current operational status of the server, such as IN_PROGRESS or ACTIVE.
|
||||
Status string
|
||||
Status string `json:"status"`
|
||||
// Progress ranges from 0..100.
|
||||
// A request made against the server completes only once Progress reaches 100.
|
||||
Progress int
|
||||
Progress int `json:"progress"`
|
||||
// AccessIPv4 and AccessIPv6 contain the IP addresses of the server, suitable for remote access for administration.
|
||||
AccessIPv4, AccessIPv6 string
|
||||
AccessIPv4 string `json:"accessIPv4"`
|
||||
AccessIPv6 string `json:"accessIPv6"`
|
||||
// Image refers to a JSON object, which itself indicates the OS image used to deploy the server.
|
||||
Image map[string]interface{}
|
||||
Image map[string]interface{} `json:"-"`
|
||||
// Flavor refers to a JSON object, which itself indicates the hardware configuration of the deployed server.
|
||||
Flavor map[string]interface{}
|
||||
Flavor map[string]interface{} `json:"flavor"`
|
||||
// Addresses includes a list of all IP addresses assigned to the server, keyed by pool.
|
||||
Addresses map[string]interface{}
|
||||
Addresses map[string]interface{} `json:"addresses"`
|
||||
// Metadata includes a list of all user-specified key-value pairs attached to the server.
|
||||
Metadata map[string]string
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
// Links includes HTTP references to the itself, useful for passing along to other APIs that might want a server reference.
|
||||
Links []interface{}
|
||||
Links []interface{} `json:"links"`
|
||||
// KeyName indicates which public key was injected into the server on launch.
|
||||
KeyName string `json:"key_name"`
|
||||
// AdminPass will generally be empty (""). However, it will contain the administrative password chosen when provisioning a new server without a set AdminPass setting in the first place.
|
||||
@@ -166,30 +168,30 @@ type Server struct {
|
||||
SecurityGroups []map[string]interface{} `json:"security_groups"`
|
||||
}
|
||||
|
||||
func (s *Server) UnmarshalJSON(b []byte) error {
|
||||
func (r *Server) UnmarshalJSON(b []byte) error {
|
||||
type tmp Server
|
||||
var server *struct {
|
||||
var s struct {
|
||||
tmp
|
||||
Image interface{}
|
||||
Image interface{} `json:"image"`
|
||||
}
|
||||
err := json.Unmarshal(b, &server)
|
||||
err := json.Unmarshal(b, &s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*s = Server(server.tmp)
|
||||
*r = Server(s.tmp)
|
||||
|
||||
switch t := server.Image.(type) {
|
||||
switch t := s.Image.(type) {
|
||||
case map[string]interface{}:
|
||||
s.Image = t
|
||||
r.Image = t
|
||||
case string:
|
||||
switch t {
|
||||
case "":
|
||||
s.Image = nil
|
||||
r.Image = nil
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
// ServerPage abstracts the raw results of making a List() request against the API.
|
||||
@@ -200,17 +202,17 @@ type ServerPage struct {
|
||||
}
|
||||
|
||||
// IsEmpty returns true if a page contains no Server results.
|
||||
func (page ServerPage) IsEmpty() (bool, error) {
|
||||
servers, err := ExtractServers(page)
|
||||
return len(servers) == 0, err
|
||||
func (r ServerPage) IsEmpty() (bool, error) {
|
||||
s, err := ExtractServers(r)
|
||||
return len(s) == 0, err
|
||||
}
|
||||
|
||||
// NextPageURL uses the response's embedded link reference to navigate to the next page of results.
|
||||
func (page ServerPage) NextPageURL() (string, error) {
|
||||
func (r ServerPage) NextPageURL() (string, error) {
|
||||
var s struct {
|
||||
Links []gophercloud.Link `json:"servers_links"`
|
||||
}
|
||||
err := page.ExtractInto(&s)
|
||||
err := r.ExtractInto(&s)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
5
vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/results.go
generated
vendored
5
vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/results.go
generated
vendored
@@ -132,11 +132,6 @@ func (r CreateResult) ExtractServiceCatalog() (*ServiceCatalog, error) {
|
||||
return &ServiceCatalog{Entries: s.Access.Entries}, err
|
||||
}
|
||||
|
||||
// createErr quickly packs an error in a CreateResult.
|
||||
func createErr(err error) CreateResult {
|
||||
return CreateResult{gophercloud.Result{Err: err}}
|
||||
}
|
||||
|
||||
// ExtractUser returns the User from a GetResult.
|
||||
func (r GetResult) ExtractUser() (*User, error) {
|
||||
var s struct {
|
||||
|
@@ -1,7 +1,5 @@
|
||||
package trusts
|
||||
|
||||
import "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens"
|
||||
|
||||
type TrusteeUser struct {
|
||||
ID string `json:"id"`
|
||||
}
|
||||
@@ -19,11 +17,6 @@ type Trust struct {
|
||||
RedelegationCount int `json:"redelegation_count"`
|
||||
}
|
||||
|
||||
type Token struct {
|
||||
tokens.Token
|
||||
type TokenExt struct {
|
||||
Trust Trust `json:"OS-TRUST:trust"`
|
||||
}
|
||||
|
||||
type TokenExt struct {
|
||||
Token Token `json:"token"`
|
||||
}
|
||||
|
43
vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go
generated
vendored
43
vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go
generated
vendored
@@ -1,7 +1,10 @@
|
||||
package tokens
|
||||
|
||||
import "errors"
|
||||
import "github.com/gophercloud/gophercloud"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/gophercloud/gophercloud"
|
||||
)
|
||||
|
||||
// Endpoint represents a single API endpoint offered by a service.
|
||||
// It matches either a public, internal or admin URL.
|
||||
@@ -35,7 +38,7 @@ type CatalogEntry struct {
|
||||
|
||||
// ServiceCatalog provides a view into the service catalog from a previous, successful authentication.
|
||||
type ServiceCatalog struct {
|
||||
Entries []CatalogEntry
|
||||
Entries []CatalogEntry `json:"catalog"`
|
||||
}
|
||||
|
||||
// commonResult is the deferred result of a Create or a Get call.
|
||||
@@ -51,34 +54,23 @@ func (r commonResult) Extract() (*Token, error) {
|
||||
|
||||
// ExtractToken interprets a commonResult as a Token.
|
||||
func (r commonResult) ExtractToken() (*Token, error) {
|
||||
var s struct {
|
||||
Token *Token `json:"token"`
|
||||
}
|
||||
|
||||
var s Token
|
||||
err := r.ExtractInto(&s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if s.Token == nil {
|
||||
return nil, errors.New("'token' missing in JSON response")
|
||||
}
|
||||
|
||||
// Parse the token itself from the stored headers.
|
||||
s.Token.ID = r.Header.Get("X-Subject-Token")
|
||||
s.ID = r.Header.Get("X-Subject-Token")
|
||||
|
||||
return s.Token, err
|
||||
return &s, err
|
||||
}
|
||||
|
||||
// ExtractServiceCatalog returns the ServiceCatalog that was generated along with the user's Token.
|
||||
func (r CreateResult) ExtractServiceCatalog() (*ServiceCatalog, error) {
|
||||
var s struct {
|
||||
Token struct {
|
||||
Entries []CatalogEntry `json:"catalog"`
|
||||
} `json:"token"`
|
||||
}
|
||||
var s ServiceCatalog
|
||||
err := r.ExtractInto(&s)
|
||||
return &ServiceCatalog{Entries: s.Token.Entries}, err
|
||||
return &s, err
|
||||
}
|
||||
|
||||
// CreateResult defers the interpretation of a created token.
|
||||
@@ -87,13 +79,6 @@ type CreateResult struct {
|
||||
commonResult
|
||||
}
|
||||
|
||||
// createErr quickly creates a CreateResult that reports an error.
|
||||
func createErr(err error) CreateResult {
|
||||
return CreateResult{
|
||||
commonResult: commonResult{Result: gophercloud.Result{Err: err}},
|
||||
}
|
||||
}
|
||||
|
||||
// GetResult is the deferred response from a Get call.
|
||||
type GetResult struct {
|
||||
commonResult
|
||||
@@ -110,5 +95,9 @@ type Token struct {
|
||||
// ID is the issued token.
|
||||
ID string `json:"id"`
|
||||
// ExpiresAt is the timestamp at which this token will no longer be accepted.
|
||||
ExpiresAt gophercloud.JSONRFC3339Milli `json:"expires_at"`
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
}
|
||||
|
||||
func (r commonResult) ExtractInto(v interface{}) error {
|
||||
return r.ExtractIntoStructPtr(v, "token")
|
||||
}
|
||||
|
4
vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/ports/requests.go
generated
vendored
4
vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/ports/requests.go
generated
vendored
@@ -119,8 +119,8 @@ type UpdateOpts struct {
|
||||
FixedIPs interface{} `json:"fixed_ips,omitempty"`
|
||||
DeviceID string `json:"device_id,omitempty"`
|
||||
DeviceOwner string `json:"device_owner,omitempty"`
|
||||
SecurityGroups []string `json:"security_groups,omitempty"`
|
||||
AllowedAddressPairs []AddressPair `json:"allowed_address_pairs,omitempty"`
|
||||
SecurityGroups []string `json:"security_groups"`
|
||||
AllowedAddressPairs []AddressPair `json:"allowed_address_pairs"`
|
||||
}
|
||||
|
||||
// ToPortUpdateMap casts an UpdateOpts struct to a map.
|
||||
|
Reference in New Issue
Block a user