github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dis/v2/dump/CreateDWSDumpTask.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 CreateDWSDumpTaskOpts 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 // DWS 22 DestinationType string `json:"destination_type"` 23 // Parameter list of the DWS to which data in the DIS stream will be dumped. 24 DWSDestinationDescriptor DWSDestinationDescriptorOpts `json:"dws_destination_descriptor,omitempty"` 25 } 26 27 func CreateDWSDumpTask(client *golangsdk.ServiceClient, opts CreateDWSDumpTaskOpts) 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 DWSDestinationDescriptorOpts 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 DWS cluster that stores the data in the stream. 78 DWSClusterName string `json:"dws_cluster_name"` 79 // ID of the DWS cluster to which will be dumped. 80 DWSClusterID string `json:"dws_cluster_id"` 81 // Name of the DWS database that stores the data in the stream. 82 DWSDatabaseName string `json:"dws_database_name"` 83 // Schema of the DWS database to which data will be dumped. 84 DWSSchema string `json:"dws_schema"` 85 // Name of the DWS table that stores the data in the stream. 86 DWSTableName string `json:"dws_table_name"` 87 // Delimiter used to separate the columns in the DWS tables. 88 // The value can be a comma (,), semicolon (;), or vertical bar (|). 89 DWSDelimiter string `json:"dws_delimiter"` 90 // Username of the DWS database to which data will be dumped. 91 UserName string `json:"user_name"` 92 // Password of the DWS database to which data will be dumped. 93 UserPassword string `json:"user_password"` 94 // Key created in Key Management Service (KMS) and used to encrypt the password of the DWS database. 95 KMSUserKeyName string `json:"kms_user_key_name"` 96 // ID of the key created in KMS and used to encrypt the password of the DWS database. 97 KMSUserKeyID string `json:"kms_user_key_id"` 98 // Name of the OBS bucket used to temporarily store data in the DIS stream. 99 OBSBucketPath string `json:"obs_bucket_path"` 100 // User-defined directory created in the OBS bucket and used to temporarily store data in the DIS stream. 101 // Directory levels are separated by slashes (/) and cannot start with slashes. 102 // The value can contain a maximum of 50 characters, including letters, digits, underscores (_), and slashes (/). 103 // This parameter is left empty by default. 104 FilePrefix string `json:"file_prefix,omitempty"` 105 // Duration when you can constantly retry dumping data to DWS after the dump fails. 106 // If the dump time exceeds the value of this parameter, the data that fails to be dumped to DWS will be backed up to the OBS bucket_path/file_prefix/dws_error directory. 107 // Value range: 0-7,200 108 // Unit: second 109 // Default value: 1,800 110 RetryDuration string `json:"retry_duration,omitempty"` 111 // Column to be dumped to the DWS table. 112 // If the value is null or empty, all columns are dumped by default. 113 // For example, c1,c2 indicates that columns c1 and c2 in the schema are dumped to DWS. 114 // This parameter is left blank by default. 115 DWSTableColumns string `json:"dws_table_columns,omitempty"` 116 // DWS fault tolerance option (used to specify various parameters of foreign table data). 117 Options Options `json:"options,omitempty"` 118 } 119 120 type Options struct { 121 // Specifies whether to set the field to Null or enable an error message to be displayed in the error table when the last field in a row of the data source file is missing during database import. 122 // Value range: 123 // - true/on 124 // - false/off 125 // Default value: false/off 126 // Enumeration values: 127 // true/on 128 // false/off 129 FillMissingFields string `json:"fill_missing_fields,omitempty"` 130 // Specifies whether to ignore excessive columns when the number of columns in a source data file exceeds that defined in the foreign table. 131 // This parameter is used only during data import. 132 // Value range: 133 // - true/on 134 // - false/off 135 // Default value: false/off 136 // Enumeration values: 137 // true/on 138 // false/off 139 IgnoreExtraData string `json:"ignore_extra_data,omitempty"` 140 // Specifies whether to tolerate invalid characters during data import. 141 // Specifies whether to convert invalid characters based on the conversion rule and import them to the database, or to report an error and stop the import. 142 // Value range: 143 // - true/on 144 // - false/off 145 // Default value: false/off 146 // Enumeration values: 147 // true/on 148 // false/off 149 CompatibleIllegalChars string `json:"compatible_illegal_chars,omitempty"` 150 // Maximum number of data format errors allowed during the data import. 151 // If the number of data format errors does not reach the maximum, the data import is successful. 152 // Value range: 153 // - integer 154 // - unlimited 155 // Default value: 0, 156 // indicating that error information is returned immediately 157 RejectLimit string `json:"reject_limit,omitempty"` 158 // Name of the error table that records data format errors. 159 // After the parallel import is complete, you can query the error information table to obtain the detailed error information. 160 ErrorTableName string `json:"error_table_name,omitempty"` 161 }