Documentation
¶
Overview ¶
The openstack package provides you an incomplete interface to access openstack resource via gophercloud's openstack functions. All CRUD calls on the interface will invoke gophercloud functions.
To use this package, create OSServerClient an initialize it with the Client.Configure method.
osClient := openstack.OSClient{} err := osClient.Configure(iniData)
If you want to mock the interface, you can use testing.MockClient and the implementations of callback clients (e.g. testing.CallbackRuleClient)
mockClient := testing.MockClient{} mockClient.StoredValues = map[string]interface{}{} mockClient.GroupClientObj = &testing.CallbackGroupClient{ ListFunc: func(opts groups.ListOpts) ([]groups.SecGroup, error) { return []groups.SecGroup{ { Name: "sec-group-name", ID: "sec-group-id", Rules: desiredRules, }, }, nil }, }
Index ¶
- type Client
- type FipClient
- type GroupClient
- type KeyPairClient
- type MetricAPI
- type MetricObject
- type MetricOperation
- type OSClient
- func (r *OSClient) Configure(iniBytes []byte, timeout time.Duration, promCounter *prometheus.CounterVec) error
- func (r *OSClient) FipClient(ctx context.Context) (FipClient, error)
- func (r *OSClient) GroupClient(ctx context.Context) (GroupClient, error)
- func (r *OSClient) KeyPairClient(ctx context.Context) (KeyPairClient, error)
- func (r *OSClient) PortClient(ctx context.Context) (PortClient, error)
- func (r *OSClient) RuleClient(ctx context.Context) (RuleClient, error)
- func (r *OSClient) ServerClient(ctx context.Context) (ServerClient, error)
- type OSFloatingIPClient
- func (r *OSFloatingIPClient) Configure(networkV2 *gophercloud.ServiceClient, timeout time.Duration, ...) *OSFloatingIPClient
- func (r *OSFloatingIPClient) Create(ctx context.Context, opts floatingips.CreateOptsBuilder) (*floatingips.FloatingIP, error)
- func (r *OSFloatingIPClient) Delete(ctx context.Context, id string) error
- func (r *OSFloatingIPClient) Get(ctx context.Context, id string) (*floatingips.FloatingIP, error)
- func (r *OSFloatingIPClient) List(ctx context.Context, opts floatingips.ListOptsBuilder) ([]floatingips.FloatingIP, error)
- func (r *OSFloatingIPClient) Update(ctx context.Context, id string, opts floatingips.UpdateOptsBuilder) (*floatingips.FloatingIP, error)
- type OSGroupClient
- func (r *OSGroupClient) Configure(networkClient *gophercloud.ServiceClient, timeout time.Duration, ...) *OSGroupClient
- func (r *OSGroupClient) Create(ctx context.Context, opts groups.CreateOptsBuilder) (*groups.SecGroup, error)
- func (r *OSGroupClient) Delete(ctx context.Context, id string) error
- func (r *OSGroupClient) Get(ctx context.Context, id string) (*groups.SecGroup, error)
- func (r *OSGroupClient) List(ctx context.Context, opts groups.ListOpts) ([]groups.SecGroup, error)
- func (r *OSGroupClient) Update(ctx context.Context, id string, opts groups.UpdateOptsBuilder) (*groups.SecGroup, error)
- type OSKeypairClient
- func (r *OSKeypairClient) Configure(computeV2 *gophercloud.ServiceClient, timeout time.Duration, ...) *OSKeypairClient
- func (r *OSKeypairClient) Create(ctx context.Context, opts keypairs.CreateOptsBuilder) (*keypairs.KeyPair, error)
- func (r *OSKeypairClient) Delete(ctx context.Context, name string) error
- func (r *OSKeypairClient) Get(ctx context.Context, name string) (*keypairs.KeyPair, error)
- func (r *OSKeypairClient) List(ctx context.Context) ([]keypairs.KeyPair, error)
- type OSPortClient
- func (r *OSPortClient) Configure(networkClient *gophercloud.ServiceClient, timeout time.Duration, ...) *OSPortClient
- func (r *OSPortClient) Create(ctx context.Context, opts ports.CreateOptsBuilder) (*ports.Port, error)
- func (r *OSPortClient) Delete(ctx context.Context, id string) error
- func (r *OSPortClient) Get(ctx context.Context, id string) (*ports.Port, error)
- func (r *OSPortClient) List(ctx context.Context, opts ports.ListOptsBuilder) ([]ports.Port, error)
- func (r *OSPortClient) Update(ctx context.Context, id string, opts ports.UpdateOptsBuilder) (*ports.Port, error)
- type OSRuleClient
- func (r *OSRuleClient) Configure(networkClient *gophercloud.ServiceClient, timeout time.Duration, ...) *OSRuleClient
- func (r *OSRuleClient) Create(ctx context.Context, opts rules.CreateOptsBuilder) (*rules.SecGroupRule, error)
- func (r *OSRuleClient) Delete(ctx context.Context, id string) error
- func (r *OSRuleClient) Get(ctx context.Context, id string) (*rules.SecGroupRule, error)
- func (r *OSRuleClient) List(ctx context.Context, opts rules.ListOpts) ([]rules.SecGroupRule, error)
- type OSServerClient
- func (r *OSServerClient) Configure(networkClient *gophercloud.ServiceClient, timeout time.Duration, ...) *OSServerClient
- func (r *OSServerClient) Create(ctx context.Context, opts servers.CreateOptsBuilder) (*servers.Server, error)
- func (r *OSServerClient) Delete(ctx context.Context, id string) error
- func (r *OSServerClient) Get(ctx context.Context, id string) (*servers.Server, error)
- func (r *OSServerClient) List(ctx context.Context, opts servers.ListOptsBuilder) ([]servers.Server, error)
- func (r *OSServerClient) Update(ctx context.Context, id string, opts servers.UpdateOptsBuilder) (*servers.Server, error)
- type PortClient
- type RuleClient
- type ServerClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Takes the content of an ini-file, to configure the openstack client Configure(ini []byte, timeout time.Duration, promCounter *prometheus.CounterVec) error // Returns the FipClient created from the configured ini FipClient(ctx context.Context) (FipClient, error) // Returns the PortClient created from the configured ini PortClient(ctx context.Context) (PortClient, error) // Returns the GroupClient created from the configured ini GroupClient(ctx context.Context) (GroupClient, error) // Returns the RuleClient created from the configured ini RuleClient(ctx context.Context) (RuleClient, error) // Returns the ServerClient created from the configured ini ServerClient(ctx context.Context) (ServerClient, error) // Returns the KeyPairClient created from the configured ini KeyPairClient(ctx context.Context) (KeyPairClient, error) }
Client provides a interface to configure and use different OpenStack clients.
type FipClient ¶
type FipClient interface { List(ctx context.Context, opts floatingips.ListOptsBuilder) ([]floatingips.FloatingIP, error) Create(ctx context.Context, opts floatingips.CreateOptsBuilder) (*floatingips.FloatingIP, error) Update(ctx context.Context, id string, opts floatingips.UpdateOptsBuilder) (*floatingips.FloatingIP, error) Get(ctx context.Context, id string) (*floatingips.FloatingIP, error) Delete(ctx context.Context, id string) error }
FipClient is used to modify FloatingIPs in an OpenStack environment. It provides methods with CRUD functionalities
type GroupClient ¶
type GroupClient interface { List(ctx context.Context, opts groups.ListOpts) ([]groups.SecGroup, error) Create(ctx context.Context, opts groups.CreateOptsBuilder) (*groups.SecGroup, error) Update(ctx context.Context, id string, opts groups.UpdateOptsBuilder) (*groups.SecGroup, error) Get(ctx context.Context, id string) (*groups.SecGroup, error) Delete(ctx context.Context, id string) error }
GroupClient is used to modify Network Security Groups in an OpenStack environment. It provides methods with CRUD functionalities.
type KeyPairClient ¶
type KeyPairClient interface { List(ctx context.Context) ([]keypairs.KeyPair, error) Create(ctx context.Context, opts keypairs.CreateOptsBuilder) (*keypairs.KeyPair, error) Get(ctx context.Context, name string) (*keypairs.KeyPair, error) Delete(ctx context.Context, name string) error }
KeyPairClient is used to create and delete ssh keys in an OpenStack environment. It provides methods with CRD functionalities.
type MetricObject ¶
type MetricObject string
const ( MetricObjectFloatingIP MetricObject = "floatingip" MetricObjectGroup MetricObject = "group" MetricObjectKeyPair MetricObject = "keypair" MetricObjectPort MetricObject = "port" MetricObjectRule MetricObject = "rule" MetricObjectServer MetricObject = "server" )
type MetricOperation ¶
type MetricOperation string
const ( MetricOperationCreate MetricOperation = "create" MetricOperationDelete MetricOperation = "delete" MetricOperationGet MetricOperation = "get" MetricOperationList MetricOperation = "list" MetricOperationUpdate MetricOperation = "update" )
type OSClient ¶
type OSClient struct {
// contains filtered or unexported fields
}
OSClient is an implementation of Client. It must be configured by calling Configure(). When requesting any specific client the required resources will be created on first call. Mind, that you should not call Configure() again, because the created resources will not be invalidated.
func (*OSClient) Configure ¶
func (r *OSClient) Configure(iniBytes []byte, timeout time.Duration, promCounter *prometheus.CounterVec) error
Configures the OSClient with the data of an os auth ini file. Used and required flags are auth-url, username, password, domain-name, tenant-name, region in the [global] directive.
Example ini file:
[Global] auth-url="https://this-is-my-keystone-ep:5000/v3" domain-name="default" tenant-name="mycooltenant" username="itmyuser" password="suupersecret" region="eu01"
func (*OSClient) FipClient ¶
Returns a configured OSFloatingIPClient as FipClient. Make sure that you invoked Configure() before this.
func (*OSClient) GroupClient ¶
func (r *OSClient) GroupClient(ctx context.Context) (GroupClient, error)
Returns a configured OSGroupClient as GroupClient. Make sure that you invoked Configure() before this.
func (*OSClient) KeyPairClient ¶
func (r *OSClient) KeyPairClient(ctx context.Context) (KeyPairClient, error)
Returns a configured OSKeypairClient as KeyPairClient. Make sure that you invoked Configure() before this.
func (*OSClient) PortClient ¶
func (r *OSClient) PortClient(ctx context.Context) (PortClient, error)
Returns a configured OSPortClient as PortClient. Make sure that you invoked Configure() before this.
func (*OSClient) RuleClient ¶
func (r *OSClient) RuleClient(ctx context.Context) (RuleClient, error)
Returns a configured OSRuleClient as RuleClient. Make sure that you invoked Configure() before this.
func (*OSClient) ServerClient ¶
func (r *OSClient) ServerClient(ctx context.Context) (ServerClient, error)
Returns a configured OSServerClient as ServerClient. Make sure that you invoked Configure() before this.
type OSFloatingIPClient ¶
type OSFloatingIPClient struct {
// contains filtered or unexported fields
}
The OSFloatingIPClient is a implementation for FipClient. When you want to use this struct be sure to call Configure() before calling any other method. Otherwise it will result in errors.
As an easier abstraction you can use OSClient in this package, where you can insert data from an ini file to automatically initialize all modules you want to use.
func (*OSFloatingIPClient) Configure ¶
func (r *OSFloatingIPClient) Configure( networkV2 *gophercloud.ServiceClient, timeout time.Duration, promCounter *prometheus.CounterVec, ) *OSFloatingIPClient
Configure takes NetworkV2 ServiceClient to receive endpoints and auth info for further calls against openstack.
func (*OSFloatingIPClient) Create ¶
func (r *OSFloatingIPClient) Create(ctx context.Context, opts floatingips.CreateOptsBuilder) (*floatingips.FloatingIP, error)
Invokes floatingips.Create() in gophercloud's floatingip package. Uses the networkV2 client provided in Configure().
func (*OSFloatingIPClient) Delete ¶
func (r *OSFloatingIPClient) Delete(ctx context.Context, id string) error
Invokes floatingips.Delete() in gophercloud's floatingip package. Uses the networkV2 client provided in Configure().
func (*OSFloatingIPClient) Get ¶
func (r *OSFloatingIPClient) Get(ctx context.Context, id string) (*floatingips.FloatingIP, error)
Invokes floatingips.Get() in gophercloud's floatingip package. Uses the networkV2 client provided in Configure().
func (*OSFloatingIPClient) List ¶
func (r *OSFloatingIPClient) List(ctx context.Context, opts floatingips.ListOptsBuilder) ([]floatingips.FloatingIP, error)
Invokes floatingips.List() in gophercloud's floating ip package and extracts all floating ips. Uses the networkV2 client provided in Configure().
func (*OSFloatingIPClient) Update ¶
func (r *OSFloatingIPClient) Update(ctx context.Context, id string, opts floatingips.UpdateOptsBuilder) (*floatingips.FloatingIP, error)
Invokes floatingips.Update() in gophercloud's floatingip package. Uses the networkV2 client provided in Configure().
type OSGroupClient ¶
type OSGroupClient struct {
// contains filtered or unexported fields
}
The OSGroupClient is a implementation for GroupClient. When you want to use this struct be sure to call Configure() before calling any other method. Otherwise it will result in errors.
As an easier abstraction you can use OSClient in this package, where you can insert data from an ini file to automatically initialize all modules you want to use.
func (*OSGroupClient) Configure ¶
func (r *OSGroupClient) Configure( networkClient *gophercloud.ServiceClient, timeout time.Duration, promCounter *prometheus.CounterVec, ) *OSGroupClient
Configure takes NetworkV2 ServiceClient to receive endpoints and auth info for further calls against openstack.
func (*OSGroupClient) Create ¶
func (r *OSGroupClient) Create(ctx context.Context, opts groups.CreateOptsBuilder) (*groups.SecGroup, error)
Invokes groups.Create() in gophercloud's groups package. Uses the networkV2 client provided in Configure().
func (*OSGroupClient) Delete ¶
func (r *OSGroupClient) Delete(ctx context.Context, id string) error
Invokes groups.Delete() in gophercloud's groups package. Uses the networkV2 client provided in Configure().
func (*OSGroupClient) Get ¶
Invokes groups.Get() in gophercloud's groups package. Uses the networkV2 client provided in Configure().
type OSKeypairClient ¶
type OSKeypairClient struct {
// contains filtered or unexported fields
}
The OSKeypairClient is a implementation for KeyPairClient. When you want to use this struct be sure to call Configure() before calling any other method. Otherwise it will result in errors.
As an easier abstraction you can use OSClient in this package, where you can insert data from an ini file to automatically initialize all modules you want to use.
func (*OSKeypairClient) Configure ¶
func (r *OSKeypairClient) Configure( computeV2 *gophercloud.ServiceClient, timeout time.Duration, promCounter *prometheus.CounterVec, ) *OSKeypairClient
Configure takes ComputeV2 ServiceClient to receive endpoints and auth info for further calls against openstack.
func (*OSKeypairClient) Create ¶
func (r *OSKeypairClient) Create(ctx context.Context, opts keypairs.CreateOptsBuilder) (*keypairs.KeyPair, error)
Invokes keypairs.Create() in gophercloud's keypairs package. Uses the computeV2 client provided in Configure().
func (*OSKeypairClient) Delete ¶
func (r *OSKeypairClient) Delete(ctx context.Context, name string) error
Invokes keypairs.Delete() in gophercloud's keypairs package. Uses the computeV2 client provided in Configure().
type OSPortClient ¶
type OSPortClient struct {
// contains filtered or unexported fields
}
The OSPortClient is a implementation for PortClient. When you want to use this struct be sure to call Configure() before calling any other method. Otherwise it will result in errors.
As an easier abstraction you can use OSClient in this package, where you can insert data from an ini file to automatically initialize all modules you want to use.
func (*OSPortClient) Configure ¶
func (r *OSPortClient) Configure( networkClient *gophercloud.ServiceClient, timeout time.Duration, promCounter *prometheus.CounterVec, ) *OSPortClient
Configure takes NetworkV2 ServiceClient to receive endpoints and auth info for further calls against openstack.
func (*OSPortClient) Create ¶
func (r *OSPortClient) Create(ctx context.Context, opts ports.CreateOptsBuilder) (*ports.Port, error)
Invokes groups.Create() in gophercloud's ports package. Uses the networkV2 client provided in Configure().
func (*OSPortClient) Delete ¶
func (r *OSPortClient) Delete(ctx context.Context, id string) error
Invokes groups.Delete() in gophercloud's ports package. Uses the networkV2 client provided in Configure().
func (*OSPortClient) Get ¶
Invokes groups.Get() in gophercloud's ports package. Uses the networkV2 client provided in Configure().
func (*OSPortClient) List ¶
func (r *OSPortClient) List(ctx context.Context, opts ports.ListOptsBuilder) ([]ports.Port, error)
Invokes ports.List() in gophercloud's ports package and extracts all ports. Uses the networkV2 client provided in Configure().
type OSRuleClient ¶
type OSRuleClient struct {
// contains filtered or unexported fields
}
The OSRuleClient is a implementation for RuleClient. When you want to use this struct be sure to call Configure() before calling any other method. Otherwise it will result in errors.
As an easier abstraction you can use OSClient in this package, where you can insert data from an ini file to automatically initialize all modules you want to use.
func (*OSRuleClient) Configure ¶
func (r *OSRuleClient) Configure( networkClient *gophercloud.ServiceClient, timeout time.Duration, promCounter *prometheus.CounterVec, ) *OSRuleClient
Configure takes NetworkV2 ServiceClient to receive endpoints and auth info for further calls against openstack.
func (*OSRuleClient) Create ¶
func (r *OSRuleClient) Create(ctx context.Context, opts rules.CreateOptsBuilder) (*rules.SecGroupRule, error)
Invokes rules.Create() in gophercloud's rules package and extracts all security groups. Uses the networkV2 client provided in Configure().
func (*OSRuleClient) Delete ¶
func (r *OSRuleClient) Delete(ctx context.Context, id string) error
Invokes rules.Delete() in gophercloud's rules package Uses the networkV2 client provided in Configure().
func (*OSRuleClient) Get ¶
func (r *OSRuleClient) Get(ctx context.Context, id string) (*rules.SecGroupRule, error)
Invokes rules.Get() in gophercloud's rules package and extracts all security groups. Uses the networkV2 client provided in Configure().
func (*OSRuleClient) List ¶
func (r *OSRuleClient) List(ctx context.Context, opts rules.ListOpts) ([]rules.SecGroupRule, error)
Invokes rules.List() in gophercloud's rules package and extracts all security groups. Uses the networkV2 client provided in Configure().
type OSServerClient ¶
type OSServerClient struct {
// contains filtered or unexported fields
}
The OSServerClient is a implementation for ServerClient. When you want to use this struct be sure to call Configure() before calling any other method. Otherwise it will result in errors.
As an easier abstraction you can use OSClient in this package, where you can insert data from an ini file to automatically initialize all modules you want to use.
func (*OSServerClient) Configure ¶
func (r *OSServerClient) Configure( networkClient *gophercloud.ServiceClient, timeout time.Duration, promCounter *prometheus.CounterVec, ) *OSServerClient
Configure takes ComputeV2 ServiceClient to receive endpoints and auth info for further calls against openstack.
func (*OSServerClient) Create ¶
func (r *OSServerClient) Create(ctx context.Context, opts servers.CreateOptsBuilder) (*servers.Server, error)
Invokes servers.Create() in gophercloud's servers package. Uses the computeV2 client provided in Configure().
func (*OSServerClient) Delete ¶
func (r *OSServerClient) Delete(ctx context.Context, id string) error
Invokes servers.Delete() in gophercloud's servers package. Uses the computeV2 client provided in Configure().
func (*OSServerClient) Get ¶
Invokes servers.Get() in gophercloud's servers package. Uses the computeV2 client provided in Configure().
func (*OSServerClient) List ¶
func (r *OSServerClient) List(ctx context.Context, opts servers.ListOptsBuilder) ([]servers.Server, error)
Invokes servers.List() in gophercloud's servers package. Uses the computeV2 client provided in Configure().
type PortClient ¶
type PortClient interface { List(ctx context.Context, opts ports.ListOptsBuilder) ([]ports.Port, error) Get(ctx context.Context, id string) (*ports.Port, error) Create(ctx context.Context, opts ports.CreateOptsBuilder) (*ports.Port, error) Update(ctx context.Context, id string, opts ports.UpdateOptsBuilder) (*ports.Port, error) Delete(ctx context.Context, id string) error }
PortClient is used to modify Network Ports in an OpenStack environment. It provides methods with CRUD functionalities.
type RuleClient ¶
type RuleClient interface { List(ctx context.Context, opts rules.ListOpts) ([]rules.SecGroupRule, error) Create(ctx context.Context, opts rules.CreateOptsBuilder) (*rules.SecGroupRule, error) Get(ctx context.Context, id string) (*rules.SecGroupRule, error) Delete(ctx context.Context, id string) error }
RuleClient is used to modify Network Security Rules in an OpenStack environment. Rules must be created in the context of a Security Group, which can be created with the GroupClient. It provides methods with CRUD functionalities.
type ServerClient ¶
type ServerClient interface { List(ctx context.Context, opts servers.ListOptsBuilder) ([]servers.Server, error) Create(ctx context.Context, opts servers.CreateOptsBuilder) (*servers.Server, error) Get(ctx context.Context, id string) (*servers.Server, error) Update(ctx context.Context, id string, opts servers.UpdateOptsBuilder) (*servers.Server, error) Delete(ctx context.Context, id string) error }
ServerClient is used to modify Virtual Machines in an OpenStack environment. It provides methods with CRUD functionalities.