github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/cts/v1/tracker/Create.go (about)

     1  package tracker
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type CreateOpts struct {
     9  	// OBS bucket name. The value contains 3 to 63 characters and must start with a digit or lowercase letter.
    10  	// Only lowercase letters, digits, hyphens (-), and periods (.) are allowed.
    11  	BucketName string `json:"bucket_name" required:"true"`
    12  	// Prefix of trace files that need to be stored in OBS buckets. The value can contain 0 to 64 characters,
    13  	// including letters, digits, hyphens (-), underscores (_), and periods (.).
    14  	FilePrefixName string `json:"file_prefix_name,omitempty"`
    15  	// Whether trace analysis is enabled.
    16  	// When you enable trace analysis, a log group named CTS and a log stream named system-trace are created in LTS.
    17  	Lts CreateLts `json:"lts,omitempty"`
    18  }
    19  
    20  type CreateLts struct {
    21  	IsLtsEnabled *bool `json:"is_lts_enabled,omitempty"`
    22  }
    23  
    24  func Create(client *golangsdk.ServiceClient, opts CreateOpts) (*Tracker, error) {
    25  	b, err := build.RequestBody(opts, "")
    26  	if err != nil {
    27  		return nil, err
    28  	}
    29  
    30  	// POST /v1.0/{project_id}/tracker
    31  	raw, err := client.Post(client.ServiceURL("tracker"), b, nil, nil)
    32  	return extra(err, raw)
    33  }