github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dis/v2/dump/CreateMRSDumpTask.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 CreateMRSDumpTaskOpts 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 // MRS 22 DestinationType string `json:"destination_type"` 23 // Parameter list of the MRS to which data in the DIS stream will be dumped. 24 MRSDestinationDescriptor MRSDestinationDescriptorOpts `json:"mrs_destination_descriptor,omitempty"` 25 } 26 27 func CreateMRSDumpTask(client *golangsdk.ServiceClient, opts CreateMRSDumpTaskOpts) 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 MRSDestinationDescriptorOpts 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 MRS cluster that stores the data in the stream. 78 // Note: 79 // Only MRS clusters with non-Kerberos authentication are supported 80 MRSClusterName string `json:"mrs_cluster_name"` 81 // ID of the MRS cluster to which data in the DIS stream will be dumped. 82 MRSClusterID string `json:"mrs_cluster_id"` 83 // Hadoop Distributed File System (HDFS) path of the MRS cluster to which data in the DIS stream will be dumped. 84 MRSHdfsPatch string `json:"mrs_hdfs_patch"` 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 // Directory to store files that will be dumped to the chosen MRS cluster. 91 // Different directory levels are separated by slash (/). 92 // Value range: 93 // a string of 0 to 50 characters This parameter is left empty by default. 94 HDFSPrefixFolder string `json:"hdfs_prefix_folder,omitempty"` 95 // Name of the OBS bucket used to temporarily store data in the DIS stream. 96 OBSBucketPath string `json:"obs_bucket_path"` 97 // Time duration for DIS to retry if data fails to be dumped. 98 // 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 99 // Value range: 0-7,200 100 // Unit: second 101 // Default value: 1,800 102 // If this parameter is set to 0, DIS does not retry when the dump fails. 103 RetryDuration string `json:"retry_duration,omitempty"` 104 }