github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dws/v1/tag/CreateClusterTag.go (about)

     1  package tag
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  	"github.com/opentelekomcloud/gophertelekomcloud/openstack/common/tags"
     7  )
     8  
     9  type CreateTagOpts struct {
    10  	// Resource ID. Currently, you can only add tags to a cluster, so specify this parameter to the cluster ID.
    11  	ClusterId string
    12  	Tag       tags.ResourceTag `json:"tag"`
    13  }
    14  
    15  func CreateClusterTag(client *golangsdk.ServiceClient, opts CreateTagOpts) (err error) {
    16  	b, err := build.RequestBody(opts, "")
    17  	if err != nil {
    18  		return
    19  	}
    20  
    21  	// POST /v1.0/{project_id}/clusters/{resource_id}/tags
    22  	_, err = client.Post(client.ServiceURL("clusters", opts.ClusterId, "tags"), b, nil, &golangsdk.RequestOpts{
    23  		OkCodes: []int{200},
    24  	})
    25  	return
    26  }