Skip to content

Commit ed7d8fa

Browse files
feat(file): add attachments zone (#2524)
Co-authored-by: Jonathan R. <[email protected]>
1 parent 676a97d commit ed7d8fa

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

api/file/v1alpha1/file_sdk.go

+12
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ type Attachment struct {
185185
// ResourceType: the type of the attached resource.
186186
// Default value: unknown_resource_type
187187
ResourceType AttachmentResourceType `json:"resource_type"`
188+
189+
// Zone: the zone where the resource is located.
190+
Zone *scw.Zone `json:"zone"`
188191
}
189192

190193
// FileSystem: Represents a filesystem resource and its properties.
@@ -275,6 +278,9 @@ type ListAttachmentsRequest struct {
275278
// Default value: unknown_resource_type
276279
ResourceType AttachmentResourceType `json:"-"`
277280

281+
// Zone: filter by resource zone.
282+
Zone *scw.Zone `json:"-"`
283+
278284
// Page: page number (starting at 1).
279285
Page *int32 `json:"-"`
280286

@@ -482,6 +488,11 @@ func (s *API) ListAttachments(req *ListAttachmentsRequest, opts ...scw.RequestOp
482488
req.Region = defaultRegion
483489
}
484490

491+
defaultZone, exist := s.client.GetDefaultZone()
492+
if (req.Zone == nil || *req.Zone == "") && exist {
493+
req.Zone = &defaultZone
494+
}
495+
485496
defaultPageSize, exist := s.client.GetDefaultPageSize()
486497
if (req.PageSize == nil || *req.PageSize == 0) && exist {
487498
req.PageSize = &defaultPageSize
@@ -491,6 +502,7 @@ func (s *API) ListAttachments(req *ListAttachmentsRequest, opts ...scw.RequestOp
491502
parameter.AddToQuery(query, "filesystem_id", req.FilesystemID)
492503
parameter.AddToQuery(query, "resource_id", req.ResourceID)
493504
parameter.AddToQuery(query, "resource_type", req.ResourceType)
505+
parameter.AddToQuery(query, "zone", req.Zone)
494506
parameter.AddToQuery(query, "page", req.Page)
495507
parameter.AddToQuery(query, "page_size", req.PageSize)
496508

0 commit comments

Comments
 (0)