{"modulePath":"github.com/stackitcloud/yawol","version":"v0.34.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package openstack\n\nnolint: dupl // we can't extract this code because of generics\n\nnolint: dupl // we can't extract this code because of generics\n\nThe 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.\n\nTo use this package, create OSServerClient an initialize it with the Client.Configure method.\n\n\tosClient := openstack.OSClient{}\n\terr := osClient.Configure(iniData)\n\nIf you want to mock the interface, you can use testing.MockClient and the implementations of callback clients (e.g. testing.CallbackRuleClient)\n\n\tmockClient := testing.MockClient{}\n\tmockClient.StoredValues = map[string]interface{}{}\n\tmockClient.GroupClientObj = \u0026testing.CallbackGroupClient{\n\t\tListFunc: func(opts groups.ListOpts) ([]groups.SecGroup, error) {\n\t\t\treturn []groups.SecGroup{\n\t\t\t\t{\n\t\t\t\t\tName:  \"sec-group-name\",\n\t\t\t\t\tID:    \"sec-group-id\",\n\t\t\t\t\tRules: desiredRules,\n\t\t\t\t},\n\t\t\t}, nil\n\t\t},\n\t}\n\n## Types\n\n```go\ntype Client interface {\n\t// Takes the content of an ini-file, to configure the openstack client\n\tConfigure(ini []byte, overwrite OSClientOverwrite, timeout time.Duration, promCounter *prometheus.CounterVec) error\n\t// Returns the FipClient created from the configured ini\n\tFipClient(ctx context.Context) (FipClient, error)\n\t// Returns the PortClient created from the configured ini\n\tPortClient(ctx context.Context) (PortClient, error)\n\t// Returns the GroupClient created from the configured ini\n\tGroupClient(ctx context.Context) (GroupClient, error)\n\t// Returns the RuleClient created from the configured ini\n\tRuleClient(ctx context.Context) (RuleClient, error)\n\t// Returns the ServerClient created from the configured ini\n\tServerClient(ctx context.Context) (ServerClient, error)\n\t// Returns the ServerClient created from the configured ini\n\tServerGroupClient(ctx context.Context) (ServerGroupClient, error)\n\t// Returns the KeyPairClient created from the configured ini\n\tKeyPairClient(ctx context.Context) (KeyPairClient, error)\n}\n```\nClient provides a interface to configure and use different OpenStack clients.\n\n```go\ntype FipClient interface {\n\tList(ctx context.Context, opts floatingips.ListOptsBuilder) ([]floatingips.FloatingIP, error)\n\tCreate(ctx context.Context, opts floatingips.CreateOptsBuilder) (*floatingips.FloatingIP, error)\n\tUpdate(ctx context.Context, id string, opts floatingips.UpdateOptsBuilder) (*floatingips.FloatingIP, error)\n\tGet(ctx context.Context, id string) (*floatingips.FloatingIP, error)\n\tDelete(ctx context.Context, id string) error\n}\n```\nFipClient is used to modify FloatingIPs in an OpenStack environment. It provides methods with CRUD functionalities\n\n```go\ntype GetOSClientFunc func(iniData []byte, overwrite OSClientOverwrite) (Client, error)\n```\n\n```go\ntype GroupClient interface {\n\tList(ctx context.Context, opts groups.ListOpts) ([]groups.SecGroup, error)\n\tCreate(ctx context.Context, opts groups.CreateOptsBuilder) (*groups.SecGroup, error)\n\tUpdate(ctx context.Context, id string, opts groups.UpdateOptsBuilder) (*groups.SecGroup, error)\n\tGet(ctx context.Context, id string) (*groups.SecGroup, error)\n\tDelete(ctx context.Context, id string) error\n}\n```\nGroupClient is used to modify Network Security Groups in an OpenStack environment. It provides methods with CRUD functionalities.\n\n```go\ntype KeyPairClient interface {\n\tList(ctx context.Context) ([]keypairs.KeyPair, error)\n\tCreate(ctx context.Context, opts keypairs.CreateOptsBuilder) (*keypairs.KeyPair, error)\n\tGet(ctx context.Context, name string) (*keypairs.KeyPair, error)\n\tDelete(ctx context.Context, name string) error\n}\n```\nKeyPairClient is used to create and delete ssh keys in an OpenStack environment. It provides methods with CRD functionalities.\n\n```go\ntype MetricAPI string\n```\n\n```go\nconst (\n\tMetricAPINova    MetricAPI = \"nova\"\n\tMetricAPINeutron MetricAPI = \"neutron\"\n)\n```\n\n```go\ntype MetricObject string\n```\n\n```go\nconst (\n\tMetricObjectFloatingIP  MetricObject = \"floatingip\"\n\tMetricObjectGroup       MetricObject = \"group\"\n\tMetricObjectKeyPair     MetricObject = \"keypair\"\n\tMetricObjectPort        MetricObject = \"port\"\n\tMetricObjectRule        MetricObject = \"rule\"\n\tMetricObjectServer      MetricObject = \"server\"\n\tMetricObjectServerGroup MetricObject = \"servergroup\"\n)\n```\n\n```go\ntype MetricOperation string\n```\n\n```go\nconst (\n\tMetricOperationCreate MetricOperation = \"create\"\n\tMetricOperationDelete MetricOperation = \"delete\"\n\tMetricOperationGet    MetricOperation = \"get\"\n\tMetricOperationList   MetricOperation = \"list\"\n\tMetricOperationUpdate MetricOperation = \"update\"\n)\n```\n\n```go\ntype OSClient struct {\n\t// contains filtered or unexported fields\n}\n```\nOSClient 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.\n\n```go\nfunc (r *OSClient) Configure(\n\tiniBytes []byte,\n\toverwrite OSClientOverwrite,\n\ttimeout time.Duration,\n\tpromCounter *prometheus.CounterVec,\n) error\n```\nConfigures 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.\n\nExample ini file:\n\n\t[Global]\n\tauth-url=\"https://this-is-my-keystone-ep:5000/v3\"\n\tdomain-name=\"default\"\n\ttenant-name=\"mycooltenant\"\n\tusername=\"itmyuser\"\n\tpassword=\"suupersecret\"\n\tregion=\"eu01\"\n\n```go\nfunc (r *OSClient) FipClient(ctx context.Context) (FipClient, error)\n```\nReturns a configured OSFloatingIPClient as FipClient. Make sure that you invoked Configure() before this.\n\n```go\nfunc (r *OSClient) GroupClient(ctx context.Context) (GroupClient, error)\n```\nReturns a configured OSGroupClient as GroupClient. Make sure that you invoked Configure() before this.\n\n```go\nfunc (r *OSClient) KeyPairClient(ctx context.Context) (KeyPairClient, error)\n```\nReturns a configured OSKeypairClient as KeyPairClient. Make sure that you invoked Configure() before this.\n\n```go\nfunc (r *OSClient) PortClient(ctx context.Context) (PortClient, error)\n```\nReturns a configured OSPortClient as PortClient. Make sure that you invoked Configure() before this.\n\n```go\nfunc (r *OSClient) RuleClient(ctx context.Context) (RuleClient, error)\n```\nReturns a configured OSRuleClient as RuleClient. Make sure that you invoked Configure() before this.\n\n```go\nfunc (r *OSClient) ServerClient(ctx context.Context) (ServerClient, error)\n```\nReturns a configured OSServerClient as ServerClient. Make sure that you invoked Configure() before this.\n\n```go\nfunc (r *OSClient) ServerGroupClient(ctx context.Context) (ServerGroupClient, error)\n```\nReturns a configured OSServerGroupClient as ServerGroupClient. Make sure that you invoked Configure() before this.\n\n```go\ntype OSClientOverwrite struct {\n\tProjectID *string\n}\n```\n\n```go\ntype OSFloatingIPClient struct {\n\t// contains filtered or unexported fields\n}\n```\nThe 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.\n\nAs 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.\n\n```go\nfunc (r *OSFloatingIPClient) Configure(\n\tnetworkV2 *gophercloud.ServiceClient,\n\ttimeout time.Duration,\n\tpromCounter *prometheus.CounterVec,\n) *OSFloatingIPClient\n```\nConfigure takes NetworkV2 ServiceClient to receive endpoints and auth info for further calls against openstack.\n\n```go\nfunc (r *OSFloatingIPClient) Create(ctx context.Context, opts floatingips.CreateOptsBuilder) (*floatingips.FloatingIP, error)\n```\nInvokes floatingips.Create() in gophercloud's floatingip package. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSFloatingIPClient) Delete(ctx context.Context, id string) error\n```\nInvokes floatingips.Delete() in gophercloud's floatingip package. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSFloatingIPClient) Get(ctx context.Context, id string) (*floatingips.FloatingIP, error)\n```\nInvokes floatingips.Get() in gophercloud's floatingip package. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSFloatingIPClient) List(ctx context.Context, opts floatingips.ListOptsBuilder) ([]floatingips.FloatingIP, error)\n```\nInvokes floatingips.List() in gophercloud's floating ip package and extracts all floating ips. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSFloatingIPClient) Update(ctx context.Context, id string, opts floatingips.UpdateOptsBuilder) (*floatingips.FloatingIP, error)\n```\nInvokes floatingips.Update() in gophercloud's floatingip package. Uses the networkV2 client provided in Configure().\n\n```go\ntype OSGroupClient struct {\n\t// contains filtered or unexported fields\n}\n```\nThe 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.\n\nAs 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.\n\n```go\nfunc (r *OSGroupClient) Configure(\n\tnetworkClient *gophercloud.ServiceClient,\n\ttimeout time.Duration,\n\tpromCounter *prometheus.CounterVec,\n) *OSGroupClient\n```\nConfigure takes NetworkV2 ServiceClient to receive endpoints and auth info for further calls against openstack.\n\n```go\nfunc (r *OSGroupClient) Create(ctx context.Context, opts groups.CreateOptsBuilder) (*groups.SecGroup, error)\n```\nCreate Invokes groups.Create() in gophercloud's groups package. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSGroupClient) Delete(ctx context.Context, id string) error\n```\nDelete Invokes groups.Delete() in gophercloud's groups package. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSGroupClient) Get(ctx context.Context, id string) (*groups.SecGroup, error)\n```\nGet Invokes groups.Get() in gophercloud's groups package. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSGroupClient) List(ctx context.Context, opts groups.ListOpts) ([]groups.SecGroup, error)\n```\nList Invokes groups.List() in gophercloud's groups package and extracts all security groups. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSGroupClient) Update(ctx context.Context, id string, opts groups.UpdateOptsBuilder) (*groups.SecGroup, error)\n```\nUpdate Invokes groups.Update() in gophercloud's groups package. Uses the networkV2 client provided in Configure().\n\n```go\ntype OSKeypairClient struct {\n\t// contains filtered or unexported fields\n}\n```\nThe 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.\n\nAs 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.\n\n```go\nfunc (r *OSKeypairClient) Configure(\n\tcomputeV2 *gophercloud.ServiceClient,\n\ttimeout time.Duration,\n\tpromCounter *prometheus.CounterVec,\n) *OSKeypairClient\n```\nConfigure takes ComputeV2 ServiceClient to receive endpoints and auth info for further calls against openstack.\n\n```go\nfunc (r *OSKeypairClient) Create(ctx context.Context, opts keypairs.CreateOptsBuilder) (*keypairs.KeyPair, error)\n```\nCreate Invokes keypairs.Create() in gophercloud's keypairs package. Uses the computeV2 client provided in Configure().\n\n```go\nfunc (r *OSKeypairClient) Delete(ctx context.Context, name string) error\n```\nDelete Invokes keypairs.Delete() in gophercloud's keypairs package. Uses the computeV2 client provided in Configure().\n\n```go\nfunc (r *OSKeypairClient) Get(ctx context.Context, name string) (*keypairs.KeyPair, error)\n```\nGet Invokes keypairs.Get() in gophercloud's keypairs package. Uses the computeV2 client provided in Configure().\n\n```go\nfunc (r *OSKeypairClient) List(ctx context.Context) ([]keypairs.KeyPair, error)\n```\nList Invokes keypairs.List() in gophercloud's keypairs package. Uses the computeV2 client provided in Configure().\n\n```go\ntype OSPortClient struct {\n\t// contains filtered or unexported fields\n}\n```\nThe 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.\n\nAs 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.\n\n```go\nfunc (r *OSPortClient) Configure(\n\tnetworkClient *gophercloud.ServiceClient,\n\ttimeout time.Duration,\n\tpromCounter *prometheus.CounterVec,\n) *OSPortClient\n```\nConfigure takes NetworkV2 ServiceClient to receive endpoints and auth info for further calls against openstack.\n\n```go\nfunc (r *OSPortClient) Create(ctx context.Context, opts ports.CreateOptsBuilder) (*ports.Port, error)\n```\nInvokes groups.Create() in gophercloud's ports package. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSPortClient) Delete(ctx context.Context, id string) error\n```\nInvokes groups.Delete() in gophercloud's ports package. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSPortClient) Get(ctx context.Context, id string) (*ports.Port, error)\n```\nInvokes groups.Get() in gophercloud's ports package. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSPortClient) List(ctx context.Context, opts ports.ListOptsBuilder) ([]ports.Port, error)\n```\nInvokes ports.List() in gophercloud's ports package and extracts all ports. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSPortClient) Update(ctx context.Context, id string, opts ports.UpdateOptsBuilder) (*ports.Port, error)\n```\nInvokes groups.Update() in gophercloud's ports package. Uses the networkV2 client provided in Configure().\n\n```go\ntype OSRuleClient struct {\n\t// contains filtered or unexported fields\n}\n```\nThe 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.\n\nAs 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.\n\n```go\nfunc (r *OSRuleClient) Configure(\n\tnetworkClient *gophercloud.ServiceClient,\n\ttimeout time.Duration,\n\tpromCounter *prometheus.CounterVec,\n) *OSRuleClient\n```\nConfigure takes NetworkV2 ServiceClient to receive endpoints and auth info for further calls against openstack.\n\n```go\nfunc (r *OSRuleClient) Create(ctx context.Context, opts rules.CreateOptsBuilder) (*rules.SecGroupRule, error)\n```\nInvokes rules.Create() in gophercloud's rules package and extracts all security groups. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSRuleClient) Delete(ctx context.Context, id string) error\n```\nInvokes rules.Delete() in gophercloud's rules package Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSRuleClient) Get(ctx context.Context, id string) (*rules.SecGroupRule, error)\n```\nInvokes rules.Get() in gophercloud's rules package and extracts all security groups. Uses the networkV2 client provided in Configure().\n\n```go\nfunc (r *OSRuleClient) List(ctx context.Context, opts rules.ListOpts) ([]rules.SecGroupRule, error)\n```\nInvokes rules.List() in gophercloud's rules package and extracts all security groups. Uses the networkV2 client provided in Configure().\n\n```go\ntype OSServerClient struct {\n\t// contains filtered or unexported fields\n}\n```\nThe 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.\n\nAs 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.\n\n```go\nfunc (r *OSServerClient) Configure(\n\tnetworkClient *gophercloud.ServiceClient,\n\ttimeout time.Duration,\n\tpromCounter *prometheus.CounterVec,\n) *OSServerClient\n```\nConfigure takes ComputeV2 ServiceClient to receive endpoints and auth info for further calls against openstack.\n\n```go\nfunc (r *OSServerClient) Create(ctx context.Context, opts servers.CreateOptsBuilder, hintOpts servers.SchedulerHintOptsBuilder,\n) (*servers.Server, error)\n```\nInvokes servers.Create() in gophercloud's servers package. Uses the computeV2 client provided in Configure().\n\n```go\nfunc (r *OSServerClient) Delete(ctx context.Context, id string) error\n```\nInvokes servers.Delete() in gophercloud's servers package. Uses the computeV2 client provided in Configure().\n\n```go\nfunc (r *OSServerClient) Get(ctx context.Context, id string) (*servers.Server, error)\n```\nInvokes servers.Get() in gophercloud's servers package. Uses the computeV2 client provided in Configure().\n\n```go\nfunc (r *OSServerClient) List(ctx context.Context, opts servers.ListOptsBuilder) ([]servers.Server, error)\n```\nInvokes servers.List() in gophercloud's servers package. Uses the computeV2 client provided in Configure().\n\n```go\nfunc (r *OSServerClient) Update(ctx context.Context, id string, opts servers.UpdateOptsBuilder) (*servers.Server, error)\n```\nInvokes servers.Update() in gophercloud's servers package. Uses the computeV2 client provided in Configure().\n\n```go\ntype OSServerGroupClient struct {\n\t// contains filtered or unexported fields\n}\n```\nThe OSServerGroupClient is a implementation for ServerGroupClient. When you want to use this struct be sure to call Configure() before calling any other method. Otherwise it will result in errors.\n\nAs 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.\n\n```go\nfunc (r *OSServerGroupClient) Configure(\n\tcomputeClient *gophercloud.ServiceClient,\n\ttimeout time.Duration,\n\tpromCounter *prometheus.CounterVec,\n) *OSServerGroupClient\n```\nConfigure takes ComputeV2 ServiceClient to receive endpoints and auth info for further calls against openstack.\n\n```go\nfunc (r *OSServerGroupClient) Create(ctx context.Context, opts servergroups.CreateOptsBuilder) (*servergroups.ServerGroup, error)\n```\nInvokes servergroups.Create() in gophercloud's servergroups package. Uses the computeV2 client provided in Configure().\n\n```go\nfunc (r *OSServerGroupClient) Delete(ctx context.Context, id string) error\n```\nInvokes servergroups.Delete() in gophercloud's servergroups package. Uses the computeV2 client provided in Configure().\n\n```go\nfunc (r *OSServerGroupClient) Get(ctx context.Context, id string) (*servergroups.ServerGroup, error)\n```\nInvokes servergroups.Get() in gophercloud's servergroups package. Uses the computeV2 client provided in Configure().\n\n```go\nfunc (r *OSServerGroupClient) List(ctx context.Context, opts servergroups.ListOptsBuilder) ([]servergroups.ServerGroup, error)\n```\nInvokes servergroups.List() in gophercloud's servers package. Uses the computeV2 client provided in Configure().\n\n```go\ntype PortClient interface {\n\tList(ctx context.Context, opts ports.ListOptsBuilder) ([]ports.Port, error)\n\tGet(ctx context.Context, id string) (*ports.Port, error)\n\tCreate(ctx context.Context, opts ports.CreateOptsBuilder) (*ports.Port, error)\n\tUpdate(ctx context.Context, id string, opts ports.UpdateOptsBuilder) (*ports.Port, error)\n\tDelete(ctx context.Context, id string) error\n}\n```\nPortClient is used to modify Network Ports in an OpenStack environment. It provides methods with CRUD functionalities.\n\n```go\ntype RuleClient interface {\n\tList(ctx context.Context, opts rules.ListOpts) ([]rules.SecGroupRule, error)\n\tCreate(ctx context.Context, opts rules.CreateOptsBuilder) (*rules.SecGroupRule, error)\n\tGet(ctx context.Context, id string) (*rules.SecGroupRule, error)\n\tDelete(ctx context.Context, id string) error\n}\n```\nRuleClient 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.\n\n```go\ntype ServerClient interface {\n\tList(ctx context.Context, opts servers.ListOptsBuilder) ([]servers.Server, error)\n\tCreate(ctx context.Context, opts servers.CreateOptsBuilder, hintOpts servers.SchedulerHintOptsBuilder) (*servers.Server, error)\n\tGet(ctx context.Context, id string) (*servers.Server, error)\n\tUpdate(ctx context.Context, id string, opts servers.UpdateOptsBuilder) (*servers.Server, error)\n\tDelete(ctx context.Context, id string) error\n}\n```\nServerClient is used to modify Virtual Machines in an OpenStack environment. It provides methods with CRUD functionalities.\n\n```go\ntype ServerGroupClient interface {\n\tList(ctx context.Context, opts servergroups.ListOptsBuilder) ([]servergroups.ServerGroup, error)\n\tCreate(ctx context.Context, opts servergroups.CreateOptsBuilder) (*servergroups.ServerGroup, error)\n\tGet(ctx context.Context, id string) (*servergroups.ServerGroup, error)\n\tDelete(ctx context.Context, id string) error\n}\n```\nServerGroupClient is used to modify ServerGroups in an OpenStack environment. It provides methods with CRUD functionalities.\n\n","path":"github.com/stackitcloud/yawol/internal/openstack","name":"openstack","synopsis":"nolint: dupl // we can't extract this code because of generics","isRedistributable":true}
