github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/cts/v3/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 // Tracker type. The value can be system (management tracker). 10 TrackerType string `json:"tracker_type" required:"true"` 11 // Tracker name. When tracker_type is set to system, the default value system is used. 12 TrackerName string `json:"tracker_name" required:"true"` 13 // Configurations of an OBS bucket to which traces will be transferred. 14 ObsInfo ObsInfo `json:"obs_info,omitempty"` 15 // Indicates whether to enable trace analysis. 16 IsLtsEnabled bool `json:"is_lts_enabled,omitempty"` 17 } 18 19 type ObsInfo struct { 20 // OBS bucket name. The value contains 3 to 63 characters and must start with a digit or lowercase letter. 21 // Only lowercase letters, digits, hyphens (-), and periods (.) are allowed. 22 BucketName string `json:"bucket_name,omitempty"` 23 // Prefix of trace files that need to be stored in OBS buckets. 24 // The value can contain 0 to 64 characters, including letters, digits, hyphens (-), underscores (_), and periods (.). 25 FilePrefixName string `json:"file_prefix_name,omitempty"` 26 // Whether the OBS bucket is automatically created by the tracker. 27 IsObsCreated *bool `json:"is_obs_created,omitempty"` 28 // Duration that traces are stored in the OBS bucket. When tracker_type is set to system, 29 // the default value is 0, indicating permanent storage. 30 BucketLifecycle *int `json:"bucket_lifecycle,omitempty"` 31 } 32 33 func Create(client *golangsdk.ServiceClient, opts CreateOpts) (*Tracker, error) { 34 b, err := build.RequestBody(opts, "") 35 if err != nil { 36 return nil, err 37 } 38 39 // POST /3/{project_id}/tracker 40 raw, err := client.Post(client.ServiceURL("tracker"), b, nil, nil) 41 return extra(err, raw) 42 }