Skip to content

Commit 8b04a78

Browse files
feat: add support for policy versions (#459)
Co-authored-by: Toni Kangas <toni.kangas@upcloud.com>
1 parent fcc765b commit 8b04a78

10 files changed

Lines changed: 732 additions & 521 deletions

CHANGELOG.md

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

66
## [Unreleased]
77

8+
### Added
9+
10+
- managed object storage: add support for policy versions
11+
812
### Fixed
913

1014
- account: improve parsing of `Firewall` field in `BillingResourceDetail` to handle both string and float64 types

upcloud/managed_object_storage.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,10 @@ type ManagedObjectStorageCustomDomain struct {
148148
DomainName string `json:"domain_name"`
149149
Type string `json:"type"`
150150
}
151+
152+
type ManagedObjectStoragePolicyVersion struct {
153+
VersionID string `json:"version_id"`
154+
Document string `json:"document"`
155+
IsDefault bool `json:"is_default"`
156+
CreatedAt time.Time `json:"created_at"`
157+
}

upcloud/request/managed_object_storage.go

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,3 +482,65 @@ type WaitForManagedObjectStorageBucketDeletionRequest struct {
482482
func (r *WaitForManagedObjectStorageBucketDeletionRequest) RequestURL() string {
483483
return fmt.Sprintf("%s/%s/buckets", managedObjectStorageBasePath, r.ServiceUUID)
484484
}
485+
486+
type CreateManagedObjectStoragePolicyVersionRequest struct {
487+
ServiceUUID string `json:"-"`
488+
Name string `json:"-"`
489+
Document string `json:"document"`
490+
IsDefault bool `json:"is_default,omitempty"`
491+
}
492+
493+
func (r *CreateManagedObjectStoragePolicyVersionRequest) RequestURL() string {
494+
return fmt.Sprintf(
495+
"%s/%s/policies/%s/versions",
496+
managedObjectStorageBasePath,
497+
r.ServiceUUID,
498+
r.Name,
499+
)
500+
}
501+
502+
type GetManagedObjectStoragePolicyVersionsRequest struct {
503+
ServiceUUID string `json:"-"`
504+
Name string `json:"-"`
505+
}
506+
507+
func (r *GetManagedObjectStoragePolicyVersionsRequest) RequestURL() string {
508+
return fmt.Sprintf(
509+
"%s/%s/policies/%s/versions",
510+
managedObjectStorageBasePath,
511+
r.ServiceUUID,
512+
r.Name,
513+
)
514+
}
515+
516+
type GetManagedObjectStoragePolicyVersionRequest struct {
517+
ServiceUUID string `json:"-"`
518+
Name string `json:"-"`
519+
VersionID string `json:"-"`
520+
}
521+
522+
func (r *GetManagedObjectStoragePolicyVersionRequest) RequestURL() string {
523+
return fmt.Sprintf(
524+
"%s/%s/policies/%s/versions/%s",
525+
managedObjectStorageBasePath,
526+
r.ServiceUUID,
527+
r.Name,
528+
r.VersionID,
529+
)
530+
}
531+
532+
type DeleteManagedObjectStoragePolicyVersionRequest struct {
533+
ServiceUUID string `json:"-"`
534+
Name string `json:"-"`
535+
VersionID string `json:"-"`
536+
}
537+
538+
func (r *DeleteManagedObjectStoragePolicyVersionRequest) RequestURL() string {
539+
return fmt.Sprintf(
540+
"%s/%s/policies/%s/versions/%s",
541+
managedObjectStorageBasePath,
542+
r.ServiceUUID,
543+
r.Name,
544+
r.VersionID,
545+
)
546+
}

upcloud/service/fixtures/createmanagedobjectstoragepolicy.yaml

Lines changed: 0 additions & 151 deletions
This file was deleted.

upcloud/service/fixtures/deletemanagedobjectstoragepolicy.yaml

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)