2018-02-12 17:10:05 +00:00
package egoscale
// ResourceTag is a tag associated with a resource
//
2019-03-14 10:04:04 +00:00
// https://community.exoscale.com/documentation/compute/instance-tags/
2018-02-12 17:10:05 +00:00
type ResourceTag struct {
2018-09-14 08:06:03 +00:00
Account string ` json:"account,omitempty" doc:"the account associated with the tag" `
Customer string ` json:"customer,omitempty" doc:"customer associated with the tag" `
Key string ` json:"key,omitempty" doc:"tag key name" `
ResourceID * UUID ` json:"resourceid,omitempty" doc:"id of the resource" `
ResourceType string ` json:"resourcetype,omitempty" doc:"resource type" `
Value string ` json:"value,omitempty" doc:"tag value" `
2018-02-12 17:10:05 +00:00
}
2019-03-14 10:04:04 +00:00
// ListRequest builds the ListZones request
func ( tag ResourceTag ) ListRequest ( ) ( ListCommand , error ) {
req := & ListTags {
Customer : tag . Customer ,
Key : tag . Key ,
ResourceID : tag . ResourceID ,
ResourceType : tag . ResourceType ,
Value : tag . Value ,
}
return req , nil
}
2018-02-12 17:10:05 +00:00
// CreateTags (Async) creates resource tag(s)
type CreateTags struct {
2018-09-14 08:06:03 +00:00
ResourceIDs [ ] UUID ` json:"resourceids" doc:"list of resources to create the tags for" `
ResourceType string ` json:"resourcetype" doc:"type of the resource" `
Tags [ ] ResourceTag ` json:"tags" doc:"Map of tags (key/value pairs)" `
Customer string ` json:"customer,omitempty" doc:"identifies client specific tag. When the value is not null, the tag can't be used by cloudStack code internally" `
_ bool ` name:"createTags" description:"Creates resource tag(s)" `
2018-02-12 17:10:05 +00:00
}
2019-03-14 10:04:04 +00:00
// Response returns the struct to unmarshal
func ( CreateTags ) Response ( ) interface { } {
2018-09-14 08:06:03 +00:00
return new ( AsyncJobResult )
2018-02-12 17:10:05 +00:00
}
2019-03-14 10:04:04 +00:00
// AsyncResponse returns the struct to unmarshal the async job
func ( CreateTags ) AsyncResponse ( ) interface { } {
return new ( BooleanResponse )
2018-02-12 17:10:05 +00:00
}
// DeleteTags (Async) deletes the resource tag(s)
type DeleteTags struct {
2018-09-14 08:06:03 +00:00
ResourceIDs [ ] UUID ` json:"resourceids" doc:"Delete tags for resource id(s)" `
ResourceType string ` json:"resourcetype" doc:"Delete tag by resource type" `
Tags [ ] ResourceTag ` json:"tags,omitempty" doc:"Delete tags matching key/value pairs" `
_ bool ` name:"deleteTags" description:"Deleting resource tag(s)" `
2018-02-12 17:10:05 +00:00
}
2019-03-14 10:04:04 +00:00
// Response returns the struct to unmarshal
func ( DeleteTags ) Response ( ) interface { } {
2018-09-14 08:06:03 +00:00
return new ( AsyncJobResult )
2018-02-12 17:10:05 +00:00
}
2019-03-14 10:04:04 +00:00
// AsyncResponse returns the struct to unmarshal the async job
func ( DeleteTags ) AsyncResponse ( ) interface { } {
return new ( BooleanResponse )
2018-02-12 17:10:05 +00:00
}
2019-03-14 10:04:04 +00:00
//go:generate go run generate/main.go -interface=Listable ListTags
2018-02-12 17:10:05 +00:00
// ListTags list resource tag(s)
type ListTags struct {
2018-09-14 08:06:03 +00:00
Customer string ` json:"customer,omitempty" doc:"list by customer name" `
Key string ` json:"key,omitempty" doc:"list by key" `
Keyword string ` json:"keyword,omitempty" doc:"List by keyword" `
2018-02-12 17:10:05 +00:00
Page int ` json:"page,omitempty" `
PageSize int ` json:"pagesize,omitempty" `
2018-09-14 08:06:03 +00:00
ResourceID * UUID ` json:"resourceid,omitempty" doc:"list by resource id" `
ResourceType string ` json:"resourcetype,omitempty" doc:"list by resource type" `
Value string ` json:"value,omitempty" doc:"list by value" `
_ bool ` name:"listTags" description:"List resource tag(s)" `
2018-02-12 17:10:05 +00:00
}
// ListTagsResponse represents a list of resource tags
type ListTagsResponse struct {
Count int ` json:"count" `
Tag [ ] ResourceTag ` json:"tag" `
}