Skip to content

Commit 5169fe8

Browse files
feat(objsto2): iam support (#298)
1 parent 7be04bb commit 5169fe8

36 files changed

+3163
-720
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
55

66
## [Unreleased]
77

8+
### Added
9+
- Managed Object Storage: `ManagedObjectStoragePolicy` struct
10+
- Managed Object Storage: `ManagedObjectStorageUserPolicy` struct
11+
- Managed Object Storage: `IAMURL` field to `ManagedObjectStorageEndpoint`
12+
- Managed Object Storage: `STSURL` field to `ManagedObjectStorageEndpoint`
13+
- Managed Object Storage: `ARN` field to `ManagedObjectStorageUser`
14+
- Managed Object Storage: `Policies` field to `ManagedObjectStorageUser`
15+
- Managed Object Storage: `Status` field to `ManagedObjectStorageUserAccessKey`
16+
17+
### Removed
18+
- **Breaking**, Managed Object Storage: `Users` field removed from `ManagedObjectStorage`
19+
- **Breaking**, Managed Object Storage: `ARN` field removed from `ManagedObjectStorageUser`
20+
- **Breaking**, Managed Object Storage: `OperationalState` field removed from `ManagedObjectStorageUser`
21+
- **Breaking**, Managed Object Storage: `Enabled` field removed from `ManagedObjectStorageUserAccessKey`
22+
- **Breaking**, Managed Object Storage: `Name` field removed from `ManagedObjectStorageUserAccessKey`
23+
- **Breaking**, Managed Object Storage: `UpdatedAt` field removed from `ManagedObjectStorageUserAccessKey`
24+
25+
### Changed
26+
- **Breaking**, Managed Object Storage: `AccessKeyId` field in `ManagedObjectStorageUserAccessKey` renamed to `AccessKeyID`
27+
828
## [7.0.0]
929

1030
### Added

upcloud/managed_object_storage.go

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ const (
1818
ManagedObjectStorageOperationalStateDeleteNetwork ManagedObjectStorageOperationalState = "delete-network"
1919
// ManagedObjectStorageOperationalStateDeleteService indicates that service is being deleted
2020
ManagedObjectStorageOperationalStateDeleteService ManagedObjectStorageOperationalState = "delete-service"
21-
// ManagedObjectStorageOperationalStateDeleteUser indicates that users are being deleted
22-
ManagedObjectStorageOperationalStateDeleteUser ManagedObjectStorageOperationalState = "delete-user"
2321
// ManagedObjectStorageOperationalStatePending indicates newly created service or that started reconfiguration
2422
ManagedObjectStorageOperationalStatePending ManagedObjectStorageOperationalState = "started"
2523
// ManagedObjectStorageOperationalStateRunning indicates that service is up and running
@@ -32,26 +30,24 @@ const (
3230
ManagedObjectStorageOperationalStateSetupNetwork ManagedObjectStorageOperationalState = "setup-network"
3331
// ManagedObjectStorageOperationalStateSetupService indicates that service is being configured
3432
ManagedObjectStorageOperationalStateSetupService ManagedObjectStorageOperationalState = "setup-service"
35-
// ManagedObjectStorageOperationalStateSetupUser indicates that users are being configured
36-
ManagedObjectStorageOperationalStateSetupUser ManagedObjectStorageOperationalState = "setup-user"
3733
// ManagedObjectStorageOperationalStateStopped indicates that service is down
3834
ManagedObjectStorageOperationalStateStopped ManagedObjectStorageOperationalState = "stopped"
3935
)
4036

4137
const (
42-
// ManagedObjectStorageUserOperationalStatePending indicates a newly attached user
43-
ManagedObjectStorageUserOperationalStatePending ManagedObjectStorageUserOperationalState = "pending"
44-
// ManagedObjectStorageUserOperationalStateReady indicates that the user is configured and ready for access keys issuing
45-
ManagedObjectStorageUserOperationalStateReady ManagedObjectStorageUserOperationalState = "ready"
38+
// ManagedObjectStorageUserAccessKeyStatusActive indicates an active access key
39+
ManagedObjectStorageUserAccessKeyStatusActive ManagedObjectStorageUserAccessKeyStatus = "Active"
40+
// ManagedObjectStorageUserAccessKeyStatusInactive indicates an inactive access key
41+
ManagedObjectStorageUserAccessKeyStatusInactive ManagedObjectStorageUserAccessKeyStatus = "Inactive"
4642
)
4743

4844
type (
4945
// ManagedObjectStorageConfiguredStatus indicates the service's current intended status. Managed by the customer
5046
ManagedObjectStorageConfiguredStatus string
5147
// ManagedObjectStorageOperationalState indicates the service's current operational, effective state. Managed by the system
5248
ManagedObjectStorageOperationalState string
53-
// ManagedObjectStorageUserOperationalState indicates the user's current operational, effective state. Managed by the system
54-
ManagedObjectStorageUserOperationalState string
49+
// ManagedObjectStorageUserAccessKeyStatus indicates the access key's current status. Managed by the customer
50+
ManagedObjectStorageUserAccessKeyStatus string
5551
)
5652

5753
// ManagedObjectStorage represents a Managed Object Storage service
@@ -65,14 +61,15 @@ type ManagedObjectStorage struct {
6561
OperationalState ManagedObjectStorageOperationalState `json:"operational_state"`
6662
Region string `json:"region"`
6763
UpdatedAt time.Time `json:"updated_at"`
68-
Users []ManagedObjectStorageUser `json:"users"`
6964
UUID string `json:"uuid"`
7065
}
7166

7267
// ManagedObjectStorageEndpoint represents an endpoint for accessing the Managed Object Storage service
7368
type ManagedObjectStorageEndpoint struct {
7469
DomainName string `json:"domain_name"`
7570
Type string `json:"type"`
71+
IAMURL string `json:"iam_url"`
72+
STSURL string `json:"sts_url"`
7673
}
7774

7875
// ManagedObjectStorageNetwork represents a network from where object storage can be used. Private networks must reside in object storage region
@@ -85,11 +82,30 @@ type ManagedObjectStorageNetwork struct {
8582

8683
// ManagedObjectStorageUser represents a user for the Managed Object Storage service
8784
type ManagedObjectStorageUser struct {
88-
AccessKeys []ManagedObjectStorageUserAccessKey `json:"access_keys"`
89-
CreatedAt time.Time `json:"created_at"`
90-
OperationalState ManagedObjectStorageUserOperationalState `json:"operational_state"`
91-
UpdatedAt time.Time `json:"updated_at"`
92-
Username string `json:"username"`
85+
AccessKeys []ManagedObjectStorageUserAccessKey `json:"access_keys"`
86+
ARN string `json:"arn"`
87+
CreatedAt time.Time `json:"created_at"`
88+
Policies []ManagedObjectStoragePolicy `json:"policies"`
89+
Username string `json:"username"`
90+
}
91+
92+
// ManagedObjectStoragePolicy represents a policy for the Managed Object Storage service
93+
type ManagedObjectStoragePolicy struct {
94+
ARN string `json:"arn"`
95+
AttachmentCount int `json:"attachment_count"`
96+
CreatedAt time.Time `json:"created_at"`
97+
DefaultVersionID string `json:"default_version_id"`
98+
Description string `json:"description"`
99+
Document string `json:"document"`
100+
Name string `json:"name"`
101+
System bool `json:"system"`
102+
UpdatedAt time.Time `json:"updated_at"`
103+
}
104+
105+
// ManagedObjectStorageUserPolicy represents a policy attached to a Managed Object Storage user
106+
type ManagedObjectStorageUserPolicy struct {
107+
ARN string `json:"arn"`
108+
Name string `json:"name"`
93109
}
94110

95111
// ManagedObjectStorageRegion represents a region where Managed Object Storage service can be hosted
@@ -106,13 +122,11 @@ type ManagedObjectStorageRegionZone struct {
106122

107123
// ManagedObjectStorageUserAccessKey represents Access Key details for a Managed Object Storage service user
108124
type ManagedObjectStorageUserAccessKey struct {
109-
AccessKeyId string `json:"access_key_id"`
110-
CreatedAt time.Time `json:"created_at"`
111-
Enabled bool `json:"enabled"`
112-
LastUsedAt time.Time `json:"last_used_at"`
113-
Name string `json:"name"`
114-
SecretAccessKey *string `json:"secret_access_key,omitempty"`
115-
UpdatedAt time.Time `json:"updated_at"`
125+
AccessKeyID string `json:"access_key_id"`
126+
CreatedAt time.Time `json:"created_at"`
127+
LastUsedAt time.Time `json:"last_used_at"`
128+
SecretAccessKey *string `json:"secret_access_key,omitempty"`
129+
Status ManagedObjectStorageUserAccessKeyStatus `json:"status"`
116130
}
117131

118132
// ManagedObjectStorageBucketMetrics represents metrics for a Managed Object Storage service bucket

upcloud/managed_object_storage_test.go

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ func TestManagedObjectStorage(t *testing.T) {
1515
{
1616
DomainName: "7mf5k.upbucket.com",
1717
Type: "public",
18+
IAMURL: "https://7mf5k.upbucket.com:4443/iam",
19+
STSURL: "https://7mf5k.upbucket.com:4443/sts",
1820
},
1921
{
2022
DomainName: "7mf5k-private.upbucket.com",
2123
Type: "private",
24+
IAMURL: "https://7mf5k-private.upbucket.com:4443/iam",
25+
STSURL: "https://7mf5k-private.upbucket.com:4443/sts",
2226
},
2327
},
2428
Labels: []Label{{
@@ -42,26 +46,7 @@ func TestManagedObjectStorage(t *testing.T) {
4246
OperationalState: ManagedObjectStorageOperationalStateRunning,
4347
Region: "europe-1",
4448
UpdatedAt: timeParse("2023-05-07T21:38:15.757405Z"),
45-
Users: []ManagedObjectStorageUser{
46-
{
47-
AccessKeys: []ManagedObjectStorageUserAccessKey{
48-
{
49-
AccessKeyId: "AKIA63F41D01345BB477",
50-
CreatedAt: timeParse("2023-05-07T20:52:19.705405Z"),
51-
Enabled: true,
52-
LastUsedAt: timeParse("2023-05-07T20:52:17Z"),
53-
Name: "example-access-key",
54-
SecretAccessKey: nil,
55-
UpdatedAt: timeParse("2023-05-07T21:06:18.81511Z"),
56-
},
57-
},
58-
CreatedAt: timeParse("2023-05-07T15:55:24.655776Z"),
59-
OperationalState: ManagedObjectStorageUserOperationalStateReady,
60-
UpdatedAt: timeParse("2023-05-07T16:48:14.744079Z"),
61-
Username: "example-user",
62-
},
63-
},
64-
UUID: "1200ecde-db95-4d1c-9133-6508f3232567",
49+
UUID: "1200ecde-db95-4d1c-9133-6508f3232567",
6550
},
6651
`
6752
{
@@ -70,10 +55,14 @@ func TestManagedObjectStorage(t *testing.T) {
7055
"endpoints": [
7156
{
7257
"domain_name": "7mf5k.upbucket.com",
58+
"iam_url": "https://7mf5k.upbucket.com:4443/iam",
59+
"sts_url": "https://7mf5k.upbucket.com:4443/sts",
7360
"type": "public"
7461
},
7562
{
7663
"domain_name": "7mf5k-private.upbucket.com",
64+
"iam_url": "https://7mf5k-private.upbucket.com:4443/iam",
65+
"sts_url": "https://7mf5k-private.upbucket.com:4443/sts",
7766
"type": "private"
7867
}
7968
],
@@ -100,24 +89,6 @@ func TestManagedObjectStorage(t *testing.T) {
10089
"operational_state": "running",
10190
"region": "europe-1",
10291
"updated_at": "2023-05-07T21:38:15.757405Z",
103-
"users": [
104-
{
105-
"access_keys": [
106-
{
107-
"access_key_id": "AKIA63F41D01345BB477",
108-
"created_at": "2023-05-07T20:52:19.705405Z",
109-
"enabled": true,
110-
"last_used_at": "2023-05-07T20:52:17Z",
111-
"name": "example-access-key",
112-
"updated_at": "2023-05-07T21:06:18.81511Z"
113-
}
114-
],
115-
"created_at": "2023-05-07T15:55:24.655776Z",
116-
"operational_state": "ready",
117-
"updated_at": "2023-05-07T16:48:14.744079Z",
118-
"username": "example-user"
119-
}
120-
],
12192
"uuid": "1200ecde-db95-4d1c-9133-6508f3232567"
12293
}
12394
`,

0 commit comments

Comments
 (0)