Skip to content

Commit 42b5a31

Browse files
committed
Enable filtering of asset tags by datacenter Id.
1 parent 42a4491 commit 42b5a31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compute/tags.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ type deleteTagKey struct {
8484

8585
// GetAssetTagsByType gets all tags applied to assets of the specified type.
8686
//
87+
// datacenterID is optional (pass an empty string for tags from all datacenters).
88+
//
8789
// Note that due to a bug in the CloudControl API, when you go past the last page if results, you'll receive an UNEXPECTED_ERROR response code.
88-
func (client *Client) GetAssetTagsByType(assetType string, paging *Paging) (tags *TagDetails, err error) {
90+
func (client *Client) GetAssetTagsByType(assetType string, datacenterID string, paging *Paging) (tags *TagDetails, err error) {
8991
if paging == nil {
9092
paging = DefaultPaging()
9193
}
@@ -100,6 +102,11 @@ func (client *Client) GetAssetTagsByType(assetType string, paging *Paging) (tags
100102
url.QueryEscape(assetType),
101103
paging.toQueryParameters(),
102104
)
105+
if datacenterID != "" {
106+
requestURI += fmt.Sprintf("&datacenterId=%s",
107+
url.QueryEscape(datacenterID),
108+
)
109+
}
103110
request, err := client.newRequestV25(requestURI, http.MethodGet, nil)
104111
if err != nil {
105112
return nil, err

0 commit comments

Comments
 (0)