Debian Codegraph @

ecs/ssh_key_pair.go

raw symbols SCIP
1 package ecs
2
3 import (
4 "github.com/denverdino/aliyungo/common"
5 )
6
7 type CreateKeyPairArgs struct {
8 RegionId common.Region
9 KeyPairName string
10 }
11
12 type CreateKeyPairResponse struct {
13 common.Response
14 KeyPairName string
15 KeyPairFingerPrint string
16 PrivateKeyBody string
17 }
18
19 // CreateKeyPair creates keypair
20 //
21 // You can read doc at https://help.aliyun.com/document_detail/51771.html?spm=5176.doc51775.6.910.cedjfr
22 func (client *Client) CreateKeyPair(args *CreateKeyPairArgs) (resp *CreateKeyPairResponse, err error) {
23 response := CreateKeyPairResponse{}
24 err = client.Invoke("CreateKeyPair", args, &response)
25 if err != nil {
26 return nil, err
27 }
28 return &response, err
29 }
30
31 type ImportKeyPairArgs struct {
32 RegionId common.Region
33 PublicKeyBody string
34 KeyPairName string
35 }
36
37 type ImportKeyPairResponse struct {
38 common.Response
39 KeyPairName string
40 KeyPairFingerPrint string
41 }
42
43 // ImportKeyPair import keypair
44 //
45 // You can read doc at https://help.aliyun.com/document_detail/51774.html?spm=5176.doc51771.6.911.BicQq2
46 func (client *Client) ImportKeyPair(args *ImportKeyPairArgs) (resp *ImportKeyPairResponse, err error) {
47 response := ImportKeyPairResponse{}
48 err = client.Invoke("ImportKeyPair", args, &response)
49 if err != nil {
50 return nil, err
51 }
52 return &response, err
53 }
54
55 type DescribeKeyPairsArgs struct {
56 RegionId common.Region
57 KeyPairFingerPrint string
58 KeyPairName string
59 common.Pagination
60 }
61
62 type KeyPairItemType struct {
63 KeyPairName string
64 KeyPairFingerPrint string
65 }
66
67 type DescribeKeyPairsResponse struct {
68 common.Response
69 common.PaginationResult
70 RegionId common.Region
71 KeyPairs struct {
72 KeyPair []KeyPairItemType
73 }
74 }
75
76 // DescribeKeyPairs describe keypairs
77 //
78 // You can read doc at https://help.aliyun.com/document_detail/51773.html?spm=5176.doc51774.6.912.lyE0iX
79 func (client *Client) DescribeKeyPairs(args *DescribeKeyPairsArgs) (KeyPairs []KeyPairItemType, pagination *common.PaginationResult, err error) {
80 response, err := client.DescribeKeyPairsWithRaw(args)
81 if err != nil {
82 return nil, nil, err
83 }
84
85 return response.KeyPairs.KeyPair, &response.PaginationResult, err
86 }
87
88 func (client *Client) DescribeKeyPairsWithRaw(args *DescribeKeyPairsArgs) (response *DescribeKeyPairsResponse, err error) {
89 response = &DescribeKeyPairsResponse{}
90
91 err = client.Invoke("DescribeKeyPairs", args, response)
92
93 if err != nil {
94 return nil, err
95 }
96
97 return response, err
98 }
99
100 type AttachKeyPairArgs struct {
101 RegionId common.Region
102 KeyPairName string
103 InstanceIds string
104 }
105
106 // AttachKeyPair keypars to instances
107 //
108 // You can read doc at https://help.aliyun.com/document_detail/51775.html?spm=5176.doc51773.6.913.igEem4
109 func (client *Client) AttachKeyPair(args *AttachKeyPairArgs) (err error) {
110 response := common.Response{}
111 err = client.Invoke("AttachKeyPair", args, &response)
112 if err != nil {
113 return err
114 }
115 return nil
116 }
117
118 type DetachKeyPairArgs struct {
119 RegionId common.Region
120 KeyPairName string
121 InstanceIds string
122 }
123
124 // DetachKeyPair keyparis from instances
125 //
126 // You can read doc at https://help.aliyun.com/document_detail/51776.html?spm=5176.doc51775.6.914.DJ7Gmq
127 func (client *Client) DetachKeyPair(args *DetachKeyPairArgs) (err error) {
128 response := common.Response{}
129 err = client.Invoke("DetachKeyPair", args, &response)
130 if err != nil {
131 return err
132 }
133 return nil
134 }
135
136 type DeleteKeyPairsArgs struct {
137 RegionId common.Region
138 KeyPairNames string
139 }
140
141 // DeleteKeyPairs delete keypairs
142 //
143 // You can read doc at https://help.aliyun.com/document_detail/51772.html?spm=5176.doc51776.6.915.Qqcv2Q
144 func (client *Client) DeleteKeyPairs(args *DeleteKeyPairsArgs) (err error) {
145 response := common.Response{}
146 err = client.Invoke("DeleteKeyPairs", args, &response)
147 if err != nil {
148 return err
149 }
150 return nil
151 }