gcore

package
v0.3.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2020 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package gcore contains resources for the individual projects. It also includes functions to authenticate to an Gcore cloud and for provisioning various service-level clients.

Example of Creating a Gcore Magnum Cluster Client

ao, err := gcore.AuthOptionsFromEnv()
provider, err := gcore.AuthenticatedClient(ao)
client, err := gcore.MagnumClusterV1(client, gcorecloud.EndpointOpts{
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthClientServiceWithDebug

func AuthClientServiceWithDebug(options gcorecloud.AuthOptions, eo gcorecloud.EndpointOpts, debug bool) (*gcorecloud.ServiceClient, error)

func AuthOptionsFromEnv

func AuthOptionsFromEnv() (gcorecloud.AuthOptions, error)

AuthOptionsFromEnv fills out an identity.AuthOptions structure with the settings found on environment variables.

The following variables provide sources of truth: GCLOUD_USERNAME, GCLOUD_PASSWORD, GCLOUD_AUTH_URL

opts, err := gcore.AuthOptionsFromEnv()
provider, err := gcore.AuthenticatedClient(opts)

func Authenticate

func Authenticate(client *gcorecloud.ProviderClient, options gcorecloud.AuthOptions) error

Authenticate or re-authenticate against the most recent identity service supported at the provided endpoint.

func AuthenticatedClient

func AuthenticatedClient(options gcorecloud.AuthOptions) (*gcorecloud.ProviderClient, error)

AuthenticatedClient logs in to an GCore cloud found at the identity endpoint specified by the options, acquires a token, and returns a Provider Client instance that's ready to operate.

Example:

ao, err := gcore.AuthOptionsFromEnv()
provider, err := gcore.AuthenticatedClient(ao)
client, err := gcore.NewMagnumV1(provider, gcorecloud.EndpointOpts{})

func AuthenticatedClientWithDebug

func AuthenticatedClientWithDebug(options gcorecloud.AuthOptions, debug bool) (*gcorecloud.ProviderClient, error)

func EndpointOptionsFromEnv

func EndpointOptionsFromEnv() (gcorecloud.EndpointOpts, error)

func NewGCloudPlatformAPISettingsFromEnv

func NewGCloudPlatformAPISettingsFromEnv() (*gcorecloud.PasswordAPISettings, error)

func NewGCloudTokenAPISettingsFromEnv

func NewGCloudTokenAPISettingsFromEnv() (*gcorecloud.TokenAPISettings, error)

func NewGCoreClient

func NewGCoreClient(endpoint string) (*gcorecloud.ProviderClient, error)

NewGCoreClient prepares an unauthenticated ProviderClient instance. Most users will probably prefer using the AuthenticatedClient function instead.

This is useful if you wish to explicitly control the version of the identity service that's used for authentication explicitly, for example.

func NewIdentity

NewIdentity creates a ServiceClient that may be used to interact with the gcore identity auth service.

func NewK8sV1

func NewK8sV1(provider *gcorecloud.ProviderClient, region int, project int) (*gcorecloud.ServiceClient, error)

func TokenClient

func TokenClient(options gcorecloud.TokenOptions) (*gcorecloud.ProviderClient, error)

func TokenClientServiceWithDebug

func TokenClientServiceWithDebug(options gcorecloud.TokenOptions, eo gcorecloud.EndpointOpts, debug bool) (*gcorecloud.ServiceClient, error)

func TokenClientWithDebug

func TokenClientWithDebug(options gcorecloud.TokenOptions, debug bool) (*gcorecloud.ProviderClient, error)

func TokenOptionsFromEnv

func TokenOptionsFromEnv() (gcorecloud.TokenOptions, error)

Types

type ErrEndpointNotFound

type ErrEndpointNotFound struct{ gcorecloud.BaseError }

ErrEndpointNotFound is the error when no suitable endpoint can be found in the user's catalog

func (ErrEndpointNotFound) Error

func (e ErrEndpointNotFound) Error() string

type ErrInvalidAvailabilityProvided

type ErrInvalidAvailabilityProvided struct{ gcorecloud.ErrInvalidInput }

ErrInvalidAvailabilityProvided is the error when an invalid endpoint availability is provided

func (ErrInvalidAvailabilityProvided) Error

type ErrNoAuthURL

type ErrNoAuthURL struct{ gcorecloud.ErrInvalidInput }

ErrNoAuthURL is the error when the OS_AUTH_URL environment variable is not found

func (ErrNoAuthURL) Error

func (e ErrNoAuthURL) Error() string

type ErrNoPassword

type ErrNoPassword struct{ gcorecloud.ErrInvalidInput }

ErrNoPassword is the error when the OS_PASSWORD environment variable is not found

func (ErrNoPassword) Error

func (e ErrNoPassword) Error() string

type ErrNoUsername

type ErrNoUsername struct{ gcorecloud.ErrInvalidInput }

ErrNoUsername is the error when the OS_USERNAME environment variable is not found

func (ErrNoUsername) Error

func (e ErrNoUsername) Error() string

Directories

Path Synopsis
flavor
v1/flavors
Package flavors contains functionality for working GCLoud flavors API resources Example to List Flavors listOpts := flavors.ListOpts{ } allPages, err := flavors.List(flavorClient).AllPages() if err != nil { panic(err) } allFlavors, err := flavors.ExtractFlavors(allPages) if err != nil { panic(err) } for _, flavor := range allFlavors { fmt.Printf("%+v", flavor) } Example to Create a Flavor createOpts := flavors.CreateOpts{ } flavors, err := flavors.Create(flavorClient, createOpts).Extract() if err != nil { panic(err) } Example to Delete a Flavor flavorID := "484cda0e-106f-4f4b-bb3f-d413710bbe78" err := flavors.Delete(flavorClient, flavorID).ExtractErr() if err != nil { panic(err) }
Package flavors contains functionality for working GCLoud flavors API resources Example to List Flavors listOpts := flavors.ListOpts{ } allPages, err := flavors.List(flavorClient).AllPages() if err != nil { panic(err) } allFlavors, err := flavors.ExtractFlavors(allPages) if err != nil { panic(err) } for _, flavor := range allFlavors { fmt.Printf("%+v", flavor) } Example to Create a Flavor createOpts := flavors.CreateOpts{ } flavors, err := flavors.Create(flavorClient, createOpts).Extract() if err != nil { panic(err) } Example to Delete a Flavor flavorID := "484cda0e-106f-4f4b-bb3f-d413710bbe78" err := flavors.Delete(flavorClient, flavorID).ExtractErr() if err != nil { panic(err) }
v1/flavors/testing
flavors unit tests
flavors unit tests
floatingip
heat
v1/stack/resources/testing
resources unit tests
resources unit tests
identity
tokens/testing
tokens unit tests
tokens unit tests
image
instance
v1/instances/testing
instances unit tests
instances unit tests
k8s
keypair
v1/keypairs
Package keypair contains functionality for working GCLoud keypairs API resources Example to List KeyPair listOpts := keypairs.ListOpts{ } allPages, err := keypairs.List(client).AllPages() if err != nil { panic(err) } allKeyPairs, err := keypairs.ExtractKeyPairs(allPages) if err != nil { panic(err) } for _, keypair := range allKeyPairs { fmt.Printf("%+v", keypair) } Example to Create a KeyPair createOpts := keypairs.CreateOpts{ Name": "alice", PublicKey: "", } keypairs, err := keypairs.Create(client, createOpts).Extract() if err != nil { panic(err) } Example to Delete a KeyPair keypairID := "alica" err := keypairs.Delete(client, keypairID).ExtractErr() if err != nil { panic(err) }
Package keypair contains functionality for working GCLoud keypairs API resources Example to List KeyPair listOpts := keypairs.ListOpts{ } allPages, err := keypairs.List(client).AllPages() if err != nil { panic(err) } allKeyPairs, err := keypairs.ExtractKeyPairs(allPages) if err != nil { panic(err) } for _, keypair := range allKeyPairs { fmt.Printf("%+v", keypair) } Example to Create a KeyPair createOpts := keypairs.CreateOpts{ Name": "alice", PublicKey: "", } keypairs, err := keypairs.Create(client, createOpts).Extract() if err != nil { panic(err) } Example to Delete a KeyPair keypairID := "alica" err := keypairs.Delete(client, keypairID).ExtractErr() if err != nil { panic(err) }
v1/keypairs/testing
keypairs unit tests
keypairs unit tests
keystone
limit
loadbalancer
v1/lbpools/testing
loadbalancers unit tests
loadbalancers unit tests
v1/listeners/testing
listeners unit tests
listeners unit tests
v1/loadbalancers
Package loadbalancer contains functionality for working GCLoud loadbalancers API resources Example to List LoadBalancer listOpts := loadbalancers.ListOpts{ } allPages, err := loadbalancers.List(loadbalancerClient).AllPages() if err != nil { panic(err) } allLoadBalancers, err := loadbalancers.ExtractLoadBalancers(allPages) if err != nil { panic(err) } for _, loadbalancer := range allLoadBalancers { fmt.Printf("%+v", loadbalancer) } Example to Create a LoadBalancer createOpts := loadbalancers.CreateOpts{ } loadbalancers, err := loadbalancers.Create(loadbalancerClient, createOpts).Extract() if err != nil { panic(err) } Example to Delete a LoadBalancer loadbalancerID := "484cda0e-106f-4f4b-bb3f-d413710bbe78" err := loadbalancers.Delete(loadbalancerClient, loadbalancerID).ExtractErr() if err != nil { panic(err) }
Package loadbalancer contains functionality for working GCLoud loadbalancers API resources Example to List LoadBalancer listOpts := loadbalancers.ListOpts{ } allPages, err := loadbalancers.List(loadbalancerClient).AllPages() if err != nil { panic(err) } allLoadBalancers, err := loadbalancers.ExtractLoadBalancers(allPages) if err != nil { panic(err) } for _, loadbalancer := range allLoadBalancers { fmt.Printf("%+v", loadbalancer) } Example to Create a LoadBalancer createOpts := loadbalancers.CreateOpts{ } loadbalancers, err := loadbalancers.Create(loadbalancerClient, createOpts).Extract() if err != nil { panic(err) } Example to Delete a LoadBalancer loadbalancerID := "484cda0e-106f-4f4b-bb3f-d413710bbe78" err := loadbalancers.Delete(loadbalancerClient, loadbalancerID).ExtractErr() if err != nil { panic(err) }
v1/loadbalancers/testing
loadbalancers unit tests
loadbalancers unit tests
network
v1/extensions/testing
extensions unit tests
extensions unit tests
v1/networks
Package network contains functionality for working GCLoud networks API resources Example to List Network listOpts := networks.ListOpts{ } allPages, err := networks.List(networkClient).AllPages() if err != nil { panic(err) } allNetworks, err := networks.ExtractNetworks(allPages) if err != nil { panic(err) } for _, network := range allNetworks { fmt.Printf("%+v", network) } Example to Create a Network createOpts := networks.CreateOpts{ Name: "network_1", MTU: 1500, } networks, err := networks.Create(networkClient, createOpts).Extract() if err != nil { panic(err) } Example to Delete a Network networkID := "484cda0e-106f-4f4b-bb3f-d413710bbe78" err := networks.Delete(networkClient, networkID).ExtractErr() if err != nil { panic(err) }
Package network contains functionality for working GCLoud networks API resources Example to List Network listOpts := networks.ListOpts{ } allPages, err := networks.List(networkClient).AllPages() if err != nil { panic(err) } allNetworks, err := networks.ExtractNetworks(allPages) if err != nil { panic(err) } for _, network := range allNetworks { fmt.Printf("%+v", network) } Example to Create a Network createOpts := networks.CreateOpts{ Name: "network_1", MTU: 1500, } networks, err := networks.Create(networkClient, createOpts).Extract() if err != nil { panic(err) } Example to Delete a Network networkID := "484cda0e-106f-4f4b-bb3f-d413710bbe78" err := networks.Delete(networkClient, networkID).ExtractErr() if err != nil { panic(err) }
v1/networks/testing
networks unit tests
networks unit tests
project
quota
region
securitygroup
snapshot
subnet
v1/subnets/testing
subnets unit tests
subnets unit tests
task
v1/tasks/testing
tasks unit tests
tasks unit tests
testing
utils
utils
volume
v1/volumes
Package volume contains functionality for working GCLoud volumes API resources Example to List Volume listOpts := volumes.ListOpts{ } allPages, err := volumes.List(volumeClient).AllPages() if err != nil { panic(err) } allVolumes, err := volumes.ExtractVolumes(allPages) if err != nil { panic(err) } for _, volume := range allVolumes { fmt.Printf("%+v", volume) } Example to Create a Volume createOpts := volumes.CreateOpts{ } volumes, err := volumes.Create(volumeClient, createOpts).Extract() if err != nil { panic(err) } Example to Delete a Volume volumeID := "484cda0e-106f-4f4b-bb3f-d413710bbe78" err := volumes.Delete(volumeClient, volumeID).ExtractErr() if err != nil { panic(err) }
Package volume contains functionality for working GCLoud volumes API resources Example to List Volume listOpts := volumes.ListOpts{ } allPages, err := volumes.List(volumeClient).AllPages() if err != nil { panic(err) } allVolumes, err := volumes.ExtractVolumes(allPages) if err != nil { panic(err) } for _, volume := range allVolumes { fmt.Printf("%+v", volume) } Example to Create a Volume createOpts := volumes.CreateOpts{ } volumes, err := volumes.Create(volumeClient, createOpts).Extract() if err != nil { panic(err) } Example to Delete a Volume volumeID := "484cda0e-106f-4f4b-bb3f-d413710bbe78" err := volumes.Delete(volumeClient, volumeID).ExtractErr() if err != nil { panic(err) }
v1/volumes/testing
volumes unit tests
volumes unit tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL