Skip to content

Commit 639aed1

Browse files
authored
Fix docs (#3)
1 parent 49a928d commit 639aed1

File tree

9 files changed

+31
-31
lines changed

9 files changed

+31
-31
lines changed

doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// Package iam is an entyry point of IAM SDK and implements functionality for interacting with the Selectel IAM API.
1+
// Package iam is an entry point of IAM SDK and implements functionality for interacting with the Selectel IAM API.
22
package iam

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This directory contains examples that cover various use cases and functionality for iam-go.
44

55
### Concepts
6-
- [**Create & Delete EC2**](./ec2-create-delete): Create a new EC2(S3) credential for an existing Service User (ID is needed).
6+
- [**Create & Delete EC2 Credentials**](./ec2-create-delete): Create a new EC2 credential for an existing Service User (ID is needed).
77
- [**Create, Update & Delete Service User**](./serviceuser-create-update-delete): Create a new Service User, then update it's data and delete it.
88
- [**Transfer role from one User to another**](./transfer-role): Find a billing User from all and transfer it's role to another User (ID is needed).
99
- [**Create & Delete User**](./user-create-delete): Create a new User and delete it.

examples/ec2-create-delete/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Create & Delete EC2(S3) credential
1+
# Create & Delete EC2 credential
22

3-
This example program demonstrates how to manage creating and deleting EC2(S3) credential for a Service User.
3+
This example program demonstrates how to manage creating and deleting EC2 credential for a Service User.
44

55
The part of deleting a just-created credential is commented.
66

77
## Running this example
88

99
Running this file will execute the following operations:
1010

11-
1. **Create:** Create is used to create a new EC2(S3) credential. It is implied, that the Service User ID is known.
11+
1. **Create:** Create is used to create a new EC2 credential. It is implied, that the Service User ID is known.
1212
2. **(Delete):** _(commented by default)_ Delete deletes a just-created credential on a previous step.
1313

1414
You should see an output like the following (with both operations enabled):

examples/ec2-create-delete/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ func main() {
3434
return
3535
}
3636

37-
// Get the EC2 instance.
38-
ec2API := iamClient.EC2
37+
// Get the EC2 Credentials APIinstance.
38+
ec2CredAPI := iamClient.EC2
3939

4040
// Prepare an empty context.
4141
ctx := context.Background()
4242

43-
// Create a new EC2 credential for the Service User ID.
44-
credential, err := ec2API.Create(
43+
// Create a new EC2 credential for the Service User.
44+
credential, err := ec2CredAPI.Create(
4545
ctx,
4646
userID,
4747
name,
@@ -56,7 +56,7 @@ func main() {
5656
fmt.Printf("Step 1: Created credential Secret Key: %s Access Key: %s\n", credential.SecretKey, credential.AccessKey)
5757

5858
// // Delete an existing EC2 credential.
59-
// err = ec2API.Delete(ctx, &ec2.DeleteInput{
59+
// err = ec2CredAPI.Delete(ctx, &ec2.DeleteInput{
6060
// UserID: userID,
6161
// AccessKey: credential.AccessKey,
6262
// })

iam.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ type Client struct {
4545
// baseClient contains the configuration of the Client.
4646
baseClient *baseclient.BaseClient
4747

48-
// Users instance is used to make requests against Selectel IAM API.
48+
// Users instance is used to make requests against Selectel IAM API and manage panel users.
4949
Users *users.Users
5050

51-
// ServiceUsers instance is used to make requests against Selectel IAM API.
51+
// ServiceUsers instance is used to make requests against Selectel IAM API and manage service users.
5252
ServiceUsers *serviceusers.ServiceUsers
5353

54-
// EC2 instance is used to make requests against Selectel IAM API.
54+
// EC2 instance is used to make requests against Selectel IAM API and manage EC2 credentials.
5555
EC2 *ec2.EC2
5656
}
5757

service/ec2/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// Package ec2 provides a set of functions for interacting with the Selectel EC2 API.
1+
// Package ec2 provides a set of functions for interacting with the Selectel EC2 Credentials API.
22
package ec2

service/ec2/requests.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ import (
1111
"github.com/selectel/iam-go/internal/client"
1212
)
1313

14-
// EC2 is used to communicate with the EC2(S3) API.
14+
// EC2 is used to communicate with the EC2 Credentials API.
1515
type EC2 struct {
1616
baseClient *client.BaseClient
1717
}
1818

19-
// Initialises EC2 with the given client.
19+
// Initialises EC2 instance with the given client.
2020
func New(baseClient *client.BaseClient) *EC2 {
2121
return &EC2{
2222
baseClient: baseClient,
2323
}
2424
}
2525

26-
// List returns a list of EC2-credentials for the given user.
26+
// List returns a list of EC2 credentials for the given user.
2727
func (ec2 *EC2) List(ctx context.Context, userID string) ([]Credential, error) {
2828
if userID == "" {
2929
return nil, iamerrors.Error{Err: iamerrors.ErrUserIDRequired, Desc: "No userID was provided."}
@@ -52,7 +52,7 @@ func (ec2 *EC2) List(ctx context.Context, userID string) ([]Credential, error) {
5252
return credentials.Credentials, nil
5353
}
5454

55-
// Create creates a new EC2-credential for the given user.
55+
// Create creates a new EC2 credential for the given user.
5656
func (ec2 *EC2) Create(ctx context.Context, userID, name, projectID string) (*CreatedCredential, error) {
5757
if userID == "" {
5858
return nil, iamerrors.Error{Err: iamerrors.ErrUserIDRequired, Desc: "No userID was provided."}
@@ -92,7 +92,7 @@ func (ec2 *EC2) Create(ctx context.Context, userID, name, projectID string) (*Cr
9292
return &createdCredential, nil
9393
}
9494

95-
// Delete deletes an EC2-credential for the given user.
95+
// Delete deletes an EC2 credential for the given user.
9696
func (ec2 *EC2) Delete(ctx context.Context, userID, accessKey string) error {
9797
if userID == "" {
9898
return iamerrors.Error{Err: iamerrors.ErrUserIDRequired, Desc: "No userID was provided."}

service/ec2/requests_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,19 @@ func TestList(t *testing.T) {
7272
assert := assert.New(t)
7373
require := require.New(t)
7474

75-
ec2API := New(&client.BaseClient{
75+
ec2CredAPI := New(&client.BaseClient{
7676
HTTPClient: &http.Client{},
7777
APIUrl: testdata.TestURL,
7878
AuthMethod: &client.KeystoneTokenAuth{KeystoneToken: testdata.TestToken},
7979
})
8080

81-
httpmock.ActivateNonDefault(ec2API.baseClient.HTTPClient)
81+
httpmock.ActivateNonDefault(ec2CredAPI.baseClient.HTTPClient)
8282
defer httpmock.DeactivateAndReset()
8383

8484
tt.prepare()
8585

8686
ctx := context.Background()
87-
actualResponse, err := ec2API.List(ctx, tt.args.userID)
87+
actualResponse, err := ec2CredAPI.List(ctx, tt.args.userID)
8888

8989
require.ErrorIs(err, tt.expectedError)
9090

@@ -152,19 +152,19 @@ func TestCreate(t *testing.T) {
152152
assert := assert.New(t)
153153
require := require.New(t)
154154

155-
ec2API := New(&client.BaseClient{
155+
ec2CredAPI := New(&client.BaseClient{
156156
HTTPClient: &http.Client{},
157157
APIUrl: testdata.TestURL,
158158
AuthMethod: &client.KeystoneTokenAuth{KeystoneToken: testdata.TestToken},
159159
})
160160

161-
httpmock.ActivateNonDefault(ec2API.baseClient.HTTPClient)
161+
httpmock.ActivateNonDefault(ec2CredAPI.baseClient.HTTPClient)
162162
defer httpmock.DeactivateAndReset()
163163

164164
tt.prepare()
165165

166166
ctx := context.Background()
167-
actualResponse, err := ec2API.Create(ctx, tt.args.userID, tt.args.name, tt.args.projectID)
167+
actualResponse, err := ec2CredAPI.Create(ctx, tt.args.userID, tt.args.name, tt.args.projectID)
168168

169169
require.ErrorIs(err, tt.expectedError)
170170

@@ -223,19 +223,19 @@ func TestDelete(t *testing.T) {
223223
t.Run(tt.name, func(t *testing.T) {
224224
require := require.New(t)
225225

226-
ec2API := New(&client.BaseClient{
226+
ec2CredAPI := New(&client.BaseClient{
227227
HTTPClient: &http.Client{},
228228
APIUrl: testdata.TestURL,
229229
AuthMethod: &client.KeystoneTokenAuth{KeystoneToken: testdata.TestToken},
230230
})
231231

232-
httpmock.ActivateNonDefault(ec2API.baseClient.HTTPClient)
232+
httpmock.ActivateNonDefault(ec2CredAPI.baseClient.HTTPClient)
233233
defer httpmock.DeactivateAndReset()
234234

235235
tt.prepare()
236236

237237
ctx := context.Background()
238-
err := ec2API.Delete(ctx, tt.args.userID, tt.args.accessKey)
238+
err := ec2CredAPI.Delete(ctx, tt.args.userID, tt.args.accessKey)
239239

240240
require.ErrorIs(err, tt.expectedError)
241241
})

service/ec2/schemas.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package ec2
22

3-
// CreatedCredential represents a EC2-credential for the given user.
4-
// It contains "secret_key" field, which appears only once at the end of creating.
3+
// CreatedCredential represents a EC2 credential for the given user.
4+
// It contains "secret_key" field, which appears only once and only after creating.
55
type CreatedCredential struct {
66
Name string `json:"name"`
77
ProjectID string `json:"project_id"`
88
AccessKey string `json:"access_key"`
99
SecretKey string `json:"secret_key"`
1010
}
1111

12-
// Credential represents an EC2-credential for the given user.
12+
// Credential represents an EC2 credential for the given user.
1313
type Credential struct {
1414
Name string `json:"name"`
1515
ProjectID string `json:"project_id"`

0 commit comments

Comments
 (0)