Documentation ¶
Overview ¶
Package keypairs provides the ability to retrieve and manage keypairs through the Resell v2 API.
Example of getting keypairs in the current domain
allKeypairs, _, err = keypairs.List(context, client) if err != nil { log.Fatal(err) } for _, myKeypair := range allKeypairs { fmt.Println(myKeypair) }
Example of creating keypairs in all regions with the same options
newKeypairOptions := keypairs.KeypairOpts{ Name: "my_keypair", PublicKey: "ssh-rsa public_key_part user0@example.org", UserID: "82a026cae2104e92b999dbe00cdb9435", } newKeypairs, _, err := keypairs.Create(client, newKeypairOptions) if err != nil { log.Fatal(err) } for _, newKeypair := range newKeypairs { fmt.Printf("%v\n", newKeypair) }
Example of deleting a single keypair of a user
keypairName := "my_keypair" userID := 82a026cae2104e92b999dbe00cdb9435"" _, err = keypairs.Delete(client, keypairName, userID) if err != nil { log.Fatal(err) }
Index ¶
- func Delete(client *selvpcclient.Client, name, userID string) (*clientservices.ResponseResult, error)
- type Keypair
- func Create(client *selvpcclient.Client, createOpts KeypairOpts) ([]*Keypair, *clientservices.ResponseResult, error)
- func List(client *selvpcclient.Client) ([]*Keypair, *clientservices.ResponseResult, error)
- func ListWithOpts(client *selvpcclient.Client, opts ListOpts) ([]*Keypair, *clientservices.ResponseResult, error)
- type KeypairOpts
- type ListOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
func Delete(client *selvpcclient.Client, name, userID string) (*clientservices.ResponseResult, error)
Delete deletes a single keypair by its name and user ID.
Types ¶
type Keypair ¶
type Keypair struct { // Name contains a human-readable name for the keypair. Name string `json:"name"` // PublicKey contains a public part of the keypair. PublicKey string `json:"public_key"` // Regions contains a list of OpenStack Identity service regions where users // can use this keypair. Regions []string `json:"regions"` // UserID contains an ID of an OpenStack Identity service user that owns // this keypair. UserID string `json:"user_id"` }
Keypair represents a single Resell API Keypair.
func Create ¶
func Create(client *selvpcclient.Client, createOpts KeypairOpts) ([]*Keypair, *clientservices.ResponseResult, error)
Create requests a creation of the keypar with the specified options.
func List ¶
func List(client *selvpcclient.Client) ([]*Keypair, *clientservices.ResponseResult, error)
List gets a list of keypairs in the current domain.
func ListWithOpts ¶
func ListWithOpts(client *selvpcclient.Client, opts ListOpts) ([]*Keypair, *clientservices.ResponseResult, error)
ListWithOpts gets a list of keypairs with filter options.
type KeypairOpts ¶
type KeypairOpts struct { // Name contains a human-readable name for the keypair. Name string `json:"name"` // PublicKey contains a public part of the keypair. PublicKey string `json:"public_key"` // Regions contains a list of OpenStack Identity service regions where users // can use this keypair. Regions []string `json:"regions,omitempty"` // UserID contains an ID of an OpenStack Identity service user that owns // this keypair. UserID string `json:"user_id"` }
KeypairOpts represents options for the keypair Create request.
Click to show internal directories.
Click to hide internal directories.