Documentation ¶
Overview ¶
OpenStack Client with Golang
Index ¶
- Constants
- Variables
- func FoundResource[T any](api ResourceApi, idOrName string) (*T, error)
- func InvalidMIgrationPoicy(policy string) error
- type CinderV2
- type EndpointApi
- type Glance
- type ImageApi
- func (c ImageApi) Create(options glance.Image) (*glance.Image, error)
- func (c ImageApi) Delete(id string) error
- func (c ImageApi) Download(id string, fileName string, process bool) error
- func (c ImageApi) Found(idOrName string) (*glance.Image, error)
- func (c ImageApi) FoundByName(name string) (*glance.Image, error)
- func (c ImageApi) List(query url.Values, total int) ([]glance.Image, error)
- func (c ImageApi) ListByName(name string) ([]glance.Image, error)
- func (c ImageApi) Set(id string, params map[string]interface{}) (*glance.Image, error)
- func (c ImageApi) Show(id string) (*glance.Image, error)
- func (c ImageApi) Upload(id string, file string) error
- type ItemNotFound
- type KeystoneV3
- func (c KeystoneV3) Endpoint() *endpointApi
- func (c KeystoneV3) Endpoints() EndpointApi
- func (c KeystoneV3) GetCurrentVersion() (*model.ApiVersion, error)
- func (c KeystoneV3) GetStableVersion() (*model.ApiVersion, error)
- func (c KeystoneV3) Project() projectApi
- func (c KeystoneV3) Projects() ProjectApi
- func (c KeystoneV3) Region() regionApi
- func (c KeystoneV3) Regions() RegionApi
- func (c KeystoneV3) RoleAssignment() roleAssignmentApi
- func (c KeystoneV3) RoleAssignments() RoleAssignmentApi
- func (c KeystoneV3) Service() serviceApi
- func (c KeystoneV3) Services() ServiceApi
- func (c KeystoneV3) User() userApi
- func (c KeystoneV3) Users() UserApi
- type MultiItems
- type NeutronV2
- func (c NeutronV2) Agent() agentApi
- func (c *NeutronV2) GetCurrentVersion() (*model.ApiVersion, error)
- func (c NeutronV2) ListRouterPorts(routerId string) (neutron.Ports, error)
- func (c NeutronV2) Network() networkApi
- func (c NeutronV2) Port() portApi
- func (c NeutronV2) QosPolicy() qosPolicyApi
- func (c NeutronV2) QosRule() qosRuleApi
- func (c NeutronV2) Router() routerApi
- func (c NeutronV2) SecurityGroup() sgApi
- func (c NeutronV2) SecurityGroupRule() sgRuleApi
- func (c NeutronV2) Subnet() subnetApi
- type NovaV2
- func (c NovaV2) AZ() azApi
- func (c NovaV2) Aggregate() aggregateApi
- func (c NovaV2) Flavor() flavorApi
- func (c *NovaV2) GetCurrentVersion() (*model.ApiVersion, error)
- func (c NovaV2) Hypervisor() hypervisorApi
- func (c NovaV2) Keypair() keypairApi
- func (c *NovaV2) MicroVersionLargeEqual(version string) bool
- func (c NovaV2) Migration() migrationApi
- func (c NovaV2) Quota() computeQuotaApi
- func (c NovaV2) Server() serverApi
- func (c NovaV2) ServerGroup() serverGroupApi
- func (c NovaV2) Service() computeServiceApi
- func (c *NovaV2) String() string
- type Openstack
- func (o *Openstack) CinderV2() *CinderV2
- func (o *Openstack) GlanceV2() *Glance
- func (o *Openstack) KeystoneV3() *KeystoneV3
- func (o *Openstack) NeutronV2() *NeutronV2
- func (o *Openstack) NovaV2() *NovaV2
- func (o Openstack) ProjectId() (string, error)
- func (o Openstack) PrunePorts(ports []neutron.Port)
- func (o Openstack) PruneServers(query url.Values, yes bool, waitDeleted bool)
- func (o Openstack) PruneVolumes(query url.Values, matchName string, volumeType string, yes bool)
- func (o Openstack) Region() string
- type OpenstackError
- type ProjectApi
- type RegionApi
- type ResourceApi
- func (api *ResourceApi) AddQuery(k, v string) *ResourceApi
- func (api *ResourceApi) AppendUrl(url string) *ResourceApi
- func (api *ResourceApi) AppendUrlf(u string, args ...any) *ResourceApi
- func (api ResourceApi) Delete(res interface{}) (*resty.Response, error)
- func (api ResourceApi) Get(res interface{}) (*resty.Response, error)
- func (api *ResourceApi) GetMicroVersion() microVersion
- func (api *ResourceApi) Index() (*resty.Response, error)
- func (api ResourceApi) IsAdmin() bool
- func (api *ResourceApi) MicroVersionLargeEqual(version string) bool
- func (api ResourceApi) Patch(res interface{}) (*resty.Response, error)
- func (api *ResourceApi) PopUrl() *ResourceApi
- func (api ResourceApi) Post(res interface{}) (*resty.Response, error)
- func (api ResourceApi) Put(res interface{}) (*resty.Response, error)
- func (api *ResourceApi) SetBody(body interface{}) *ResourceApi
- func (api *ResourceApi) SetHeader(h, v string) *ResourceApi
- func (api *ResourceApi) SetHeaders(headers map[string]string) *ResourceApi
- func (api *ResourceApi) SetQuery(query url.Values) *ResourceApi
- func (api *ResourceApi) SetResult(result interface{}) *ResourceApi
- func (api *ResourceApi) SetUrl(url string) *ResourceApi
- type ResourceInterface
- type RestClient2
- func (rest *RestClient2) AddBaseHeader(key, value string)
- func (rest *RestClient2) Delete(url string, headers map[string]string) (*resty.Response, error)
- func (rest *RestClient2) Get(url string, query url.Values) (*resty.Response, error)
- func (rest *RestClient2) GetAndUnmarshal(url string, query url.Values, body interface{}) error
- func (rest *RestClient2) GetResponseRequstId(resp *resty.Response) string
- func (rest *RestClient2) Index() (*resty.Response, error)
- func (rest *RestClient2) Patch(url string, query url.Values, body interface{}, headers map[string]string) (*resty.Response, error)
- func (rest *RestClient2) Post(url string, body interface{}, headers map[string]string) (*resty.Response, error)
- func (rest *RestClient2) Put(url string, body interface{}, headers map[string]string) (*resty.Response, error)
- type RoleAssignmentApi
- type ServiceApi
- type UserApi
Constants ¶
View Source
const ( POLICY_NEVER = "never" POLICY_ON_DEMAND = "on-demand" )
View Source
const ( URL_LIST_SECURITY_GROUPS = "security-groups" URL_SHOW_SECURITY_GROUP = "security-groups/%s" URL_LIST_SECURITY_GROUP_RULES = "security-group-rules" URL_SHOW_SECURITY_GROUP_RULE = "security-group-rules/%s" )
View Source
const ( V2_1 = "v2.1" URL_DETAIL = "detail" URL_SERVER_VOLUMES_BOOT = "os-volumes_boot" URL_VOLUME_ATTACH = "%s/os-volume_attachments" URL_VOLUME_DETACH = "%s/os-volume_attachments/%s" URL_INTERFACE_ATTACH = "%s/os-interface" URL_INTERFACE_DETACH = "%s/os-interface/%s" )
View Source
const V2 = "v2"
View Source
const V3 = "v3"
View Source
const X_OPENSTACK_REQUEST_ID = "X-Openstack-Request-Id"
Variables ¶
View Source
var COMPUTE_API_VERSION string
View Source
var MIGRATION_POLICYS = []string{POLICY_NEVER, POLICY_ON_DEMAND}
Functions ¶
func FoundResource ¶
func FoundResource[T any](api ResourceApi, idOrName string) (*T, error)
func InvalidMIgrationPoicy ¶
Types ¶
type CinderV2 ¶
type CinderV2 struct {
RestClient2
}
func (CinderV2) GetCurrentVersion ¶
func (c CinderV2) GetCurrentVersion() (*model.ApiVersion, error)
func (CinderV2) VolumeType ¶
func (c CinderV2) VolumeType() volumeTypeApi
type Glance ¶
type Glance struct {
RestClient2
}
func (Glance) GetCurrentVersion ¶
func (c Glance) GetCurrentVersion() (*model.ApiVersion, error)
type ItemNotFound ¶
type ItemNotFound struct {
OpenstackError
}
func ItemNotFoundError ¶
func ItemNotFoundError(format string, args ...interface{}) ItemNotFound
type KeystoneV3 ¶
type KeystoneV3 struct {
RestClient2
}
func (KeystoneV3) Endpoint ¶
func (c KeystoneV3) Endpoint() *endpointApi
func (KeystoneV3) Endpoints ¶
func (c KeystoneV3) Endpoints() EndpointApi
func (KeystoneV3) GetCurrentVersion ¶
func (c KeystoneV3) GetCurrentVersion() (*model.ApiVersion, error)
func (KeystoneV3) GetStableVersion ¶
func (c KeystoneV3) GetStableVersion() (*model.ApiVersion, error)
func (KeystoneV3) Project ¶
func (c KeystoneV3) Project() projectApi
func (KeystoneV3) Projects ¶
func (c KeystoneV3) Projects() ProjectApi
func (KeystoneV3) Region ¶
func (c KeystoneV3) Region() regionApi
func (KeystoneV3) Regions ¶
func (c KeystoneV3) Regions() RegionApi
func (KeystoneV3) RoleAssignment ¶
func (c KeystoneV3) RoleAssignment() roleAssignmentApi
func (KeystoneV3) RoleAssignments ¶
func (c KeystoneV3) RoleAssignments() RoleAssignmentApi
func (KeystoneV3) Service ¶
func (c KeystoneV3) Service() serviceApi
func (KeystoneV3) Services ¶
func (c KeystoneV3) Services() ServiceApi
func (KeystoneV3) User ¶
func (c KeystoneV3) User() userApi
func (KeystoneV3) Users ¶
func (c KeystoneV3) Users() UserApi
type MultiItems ¶
type MultiItems struct {
OpenstackError
}
func MultiItemsError ¶
func MultiItemsError(format string, args ...interface{}) MultiItems
type NeutronV2 ¶
type NeutronV2 struct { RestClient2 // contains filtered or unexported fields }
func (*NeutronV2) GetCurrentVersion ¶
func (c *NeutronV2) GetCurrentVersion() (*model.ApiVersion, error)
func (NeutronV2) ListRouterPorts ¶
func (NeutronV2) SecurityGroup ¶
func (c NeutronV2) SecurityGroup() sgApi
func (NeutronV2) SecurityGroupRule ¶
func (c NeutronV2) SecurityGroupRule() sgRuleApi
type NovaV2 ¶
type NovaV2 struct { RestClient2 MicroVersion model.ApiVersion // contains filtered or unexported fields }
func (*NovaV2) GetCurrentVersion ¶
func (c *NovaV2) GetCurrentVersion() (*model.ApiVersion, error)
func (NovaV2) Hypervisor ¶
func (c NovaV2) Hypervisor() hypervisorApi
func (*NovaV2) MicroVersionLargeEqual ¶
func (NovaV2) ServerGroup ¶
func (c NovaV2) ServerGroup() serverGroupApi
type Openstack ¶
type Openstack struct { AuthPlugin auth.AuthPlugin ComputeApiVersion string // contains filtered or unexported fields }
func ClientWithRegion ¶
func DefaultClient ¶
func DefaultClient() *Openstack
func (*Openstack) KeystoneV3 ¶
func (o *Openstack) KeystoneV3() *KeystoneV3
func (Openstack) PrunePorts ¶
func (Openstack) PruneServers ¶
func (Openstack) PruneVolumes ¶
type OpenstackError ¶
type OpenstackError struct {
Message string
}
func (OpenstackError) Error ¶
func (err OpenstackError) Error() string
type ProjectApi ¶
type ProjectApi struct {
KeystoneV3
}
type RegionApi ¶
type RegionApi struct {
KeystoneV3
}
type ResourceApi ¶
type ResourceApi struct { Endpoint string BaseUrl string Client *httpclient.RESTClient MicroVersion model.ApiVersion EnableAllTenant bool SingularKey string PluralKey string // contains filtered or unexported fields }
func (*ResourceApi) AddQuery ¶
func (api *ResourceApi) AddQuery(k, v string) *ResourceApi
func (*ResourceApi) AppendUrl ¶
func (api *ResourceApi) AppendUrl(url string) *ResourceApi
func (*ResourceApi) AppendUrlf ¶
func (api *ResourceApi) AppendUrlf(u string, args ...any) *ResourceApi
func (ResourceApi) Delete ¶
func (api ResourceApi) Delete(res interface{}) (*resty.Response, error)
func (ResourceApi) Get ¶
func (api ResourceApi) Get(res interface{}) (*resty.Response, error)
func (*ResourceApi) GetMicroVersion ¶
func (api *ResourceApi) GetMicroVersion() microVersion
func (*ResourceApi) Index ¶
func (api *ResourceApi) Index() (*resty.Response, error)
func (ResourceApi) IsAdmin ¶
func (api ResourceApi) IsAdmin() bool
func (*ResourceApi) MicroVersionLargeEqual ¶
func (api *ResourceApi) MicroVersionLargeEqual(version string) bool
func (ResourceApi) Patch ¶
func (api ResourceApi) Patch(res interface{}) (*resty.Response, error)
func (*ResourceApi) PopUrl ¶
func (api *ResourceApi) PopUrl() *ResourceApi
func (ResourceApi) Post ¶
func (api ResourceApi) Post(res interface{}) (*resty.Response, error)
func (ResourceApi) Put ¶
func (api ResourceApi) Put(res interface{}) (*resty.Response, error)
func (*ResourceApi) SetBody ¶
func (api *ResourceApi) SetBody(body interface{}) *ResourceApi
func (*ResourceApi) SetHeader ¶
func (api *ResourceApi) SetHeader(h, v string) *ResourceApi
func (*ResourceApi) SetHeaders ¶
func (api *ResourceApi) SetHeaders(headers map[string]string) *ResourceApi
func (*ResourceApi) SetQuery ¶
func (api *ResourceApi) SetQuery(query url.Values) *ResourceApi
func (*ResourceApi) SetResult ¶
func (api *ResourceApi) SetResult(result interface{}) *ResourceApi
func (*ResourceApi) SetUrl ¶
func (api *ResourceApi) SetUrl(url string) *ResourceApi
type ResourceInterface ¶
type ResourceInterface interface {
GetName() string
}
type RestClient2 ¶
type RestClient2 struct { BaseUrl string // contains filtered or unexported fields }
func NewRestClient2 ¶
func NewRestClient2(baseUrl string, authPlugin httpclient.AuthPluginInterface) RestClient2
func (*RestClient2) AddBaseHeader ¶
func (rest *RestClient2) AddBaseHeader(key, value string)
func (*RestClient2) Delete ¶
func (rest *RestClient2) Delete(url string, headers map[string]string) (*resty.Response, error)
func (*RestClient2) Get ¶
func (rest *RestClient2) Get(url string, query url.Values) (*resty.Response, error)
func (*RestClient2) GetAndUnmarshal ¶
func (rest *RestClient2) GetAndUnmarshal(url string, query url.Values, body interface{}) error
func (*RestClient2) GetResponseRequstId ¶
func (rest *RestClient2) GetResponseRequstId(resp *resty.Response) string
func (*RestClient2) Index ¶
func (rest *RestClient2) Index() (*resty.Response, error)
type RoleAssignmentApi ¶
type RoleAssignmentApi struct {
KeystoneV3
}
func (RoleAssignmentApi) List ¶
func (c RoleAssignmentApi) List(query url.Values) ([]keystone.RoleAssigment, error)
type ServiceApi ¶
type ServiceApi struct {
KeystoneV3
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.