keypairs

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Associate

func Associate(c *golangsdk.ServiceClient, opts AssociateOpts) (string, error)

Associate is used to bind an SSH key pair to a specified VM

func Disassociate

func Disassociate(c *golangsdk.ServiceClient, opts DisassociateOpts) (string, error)

Disassociate is used to unbind an SSH key pair to a specified VM

Types

type AssociateOpts

type AssociateOpts struct {
	// the SSH keypair name
	Name string `json:"keypair_name" required:"true"`
	// Information about the VM to which the key pair is to be bound
	Server EcsServerOpts `json:"server" required:"true"`
}

AssociateOpts is the request body of binding an SSH keypair

type AuthOpts

type AuthOpts struct {
	// the Authentication type, the value can be password or keypair
	Type string `json:"type,omitempty"`
	// If type is set to password, this parameter indicates the password.
	// If type is set to keypair, this parameter indicates the private key.
	Key string `json:"key,omitempty"`
}

AuthOpts is the object about server authentication

type DisassociateOpts

type DisassociateOpts struct {
	// the ID of the VM to which the SSH key pair is to be unbound
	ServerID string `json:"id" required:"true"`
	// server authentication object, this parameter is required when the server is poweron
	Auth *AuthOpts `json:"auth,omitempty"`
}

DisassociateOpts is the request body of unbinding an SSH keypair

type EcsServerOpts

type EcsServerOpts struct {
	// the ID of the VM to which the SSH key pair is to be bound
	ID string `json:"id" required:"true"`
	// server authentication object, this parameter is required when the server is poweron
	Auth *AuthOpts `json:"auth,omitempty"`
	// whether to disable SSH login on the VM
	DisablePassword *bool `json:"disable_password,omitempty"`
}

EcsServerOpts is object about the VM to which the key pair is to be bound

type GetResult

type GetResult struct {
	golangsdk.Result
}

GetResult contains the response body and error from a GetTask request.

func GetTask

func GetTask(client *golangsdk.ServiceClient, taskID string) (r GetResult)

GetTask retrieves the keypair task with the provided ID. To extract the task object from the response, call the Extract method on the GetResult.

func (GetResult) Extract

func (r GetResult) Extract() (Task, error)

Extract the Task from result

type Task

type Task struct {
	// the task ID
	ID string `json:"task_id"`
	// the ECS instance ID
	ServerID string `json:"server_id"`
	// the keypair processing state
	Status string `json:"task_status"`
}

Task contains all the information about a keypair task

type TaskResp

type TaskResp struct {
	// the task ID
	ID string `json:"task_id"`
}

TaskResp is the response body of Associate or Disassociate

Jump to

Keyboard shortcuts

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