github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dis/v2/dump/CreateDLIDumpTask.go (about) 1 package dump 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 ) 7 8 type CreateDLIDumpTaskOpts struct { 9 // Name of the stream. 10 // Maximum: 60 11 StreamName string 12 // Dump destination. 13 // Possible values: 14 // - OBS: Data is dumped to OBS. 15 // - MRS: Data is dumped to MRS. 16 // - DLI: Data is dumped to DLI. 17 // - CLOUDTABLE: Data is dumped to CloudTable. 18 // - DWS: Data is dumped to DWS. 19 // Default: NOWHERE 20 // Enumeration values: 21 // DLI 22 DestinationType string `json:"destination_type"` 23 // Parameter list of the DLI to which data in the DIS stream will be dumped. 24 DLIDestinationDescriptor DLIDestinationDescriptorOpts `json:"mrs_destination_descriptor,omitempty"` 25 } 26 27 func CreateDLIDumpTask(client *golangsdk.ServiceClient, opts CreateDLIDumpTaskOpts) error { 28 b, err := build.RequestBody(opts, "") 29 if err != nil { 30 return err 31 } 32 33 // POST /v2/{project_id}/streams/{stream_name}/transfer-tasks 34 _, err = client.Post(client.ServiceURL("streams", opts.StreamName, "transfer-tasks"), b, nil, &golangsdk.RequestOpts{ 35 OkCodes: []int{200}, 36 }) 37 return err 38 } 39 40 type DLIDestinationDescriptorOpts struct { 41 // Name of the dump task. 42 // The task name consists of letters, digits, hyphens (-), and underscores (_). 43 // It must be a string of 1 to 64 characters. 44 TaskName string `json:"task_name"` 45 // Name of the agency created on IAM. 46 // DIS uses an agency to access your specified resources. 47 // The parameters for creating an agency are as follows: 48 // - Agency Type: Cloud service 49 // - Cloud Service: DIS 50 // - Validity Period: unlimited 51 // - Scope: Global service, 52 // Project: OBS. Select the Tenant Administrator role for the global service project. 53 // If agencies have been created, you can obtain available agencies from the agency list by using the "Listing Agencies " API. 54 // This parameter cannot be left blank and the parameter value cannot exceed 64 characters. 55 // If there are dump tasks on the console, the system displays a message indicating that an agency will be automatically created. 56 // The name of the automatically created agency is dis_admin_agency. 57 // Maximum: 64 58 AgencyName string `json:"agency_name"` 59 // User-defined interval at which data is imported from the current DIS stream into OBS. 60 // If no data is pushed to the DIS stream during the current interval, no dump file package will be generated. 61 // Value range: 30-900 62 // Default value: 300 63 // Unit: second 64 // Minimum: 30 65 // Maximum: 900 66 // Default: 300 67 DeliverTimeInterval string `json:"deliver_time_interval"` 68 // Offset. 69 // LATEST: Maximum offset indicating that the latest data will be extracted. 70 // TRIM_HORIZON: Minimum offset indicating that the earliest data will be extracted. 71 // Default value: LATEST 72 // Default: LATEST 73 // Enumeration values: 74 // LATEST 75 // TRIM_HORIZON 76 ConsumerStrategy string `json:"consumer_strategy,omitempty"` 77 // Name of the DLI database to which data in the DIS stream will be dumped. 78 DLIDatabaseName string `json:"dli_database_name"` 79 // Name of the DLI table to which data in the DIS stream will be dumped. 80 // Note: 81 // Only tables whose data location is DLI are supported, and you must have the permission to insert data into the tables. 82 DLITableName string `json:"dli_table_name"` 83 // Name of the OBS bucket used to temporarily store data in the DIS stream. 84 OBSBucketPath string `json:"obs_bucket_path"` 85 // Self-defined directory created in the OBS bucket and used to temporarily store data in the DIS stream. 86 // Directory levels are separated by slashes (/) and cannot start with slashes. 87 // The value can contain a maximum of 50 characters, including letters, digits, underscores (_), and slashes (/). 88 // This parameter is left empty by default. 89 FilePrefix string `json:"file_prefix,omitempty"` 90 // Time duration for DIS to retry if data fails to be dumped to DLI. 91 // If the retry time exceeds the value of this parameter, the data that fails to be dumped is backed up to the OBS bucket_path/file_prefix/mrs_error directory 92 // Value range: 0-7,200 93 // Unit: second 94 // Default value: 1,800 95 // If this parameter is set to 0, DIS does not retry when the dump fails. 96 RetryDuration string `json:"retry_duration,omitempty"` 97 }