github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dis/v2/dump/CreateCloudTableDumpTask.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 CreateCloudTableDumpTaskOpts 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 CloudTable to which data in the DIS stream will be dumped. 24 CloudTableDestinationDescriptor CloudTableDestinationDescriptorOpts `json:"cloudtable_destination_descriptor,omitempty"` 25 } 26 27 func CreateCloudTableDumpTask(client *golangsdk.ServiceClient, opts CreateCloudTableDumpTaskOpts) 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 CloudTableDestinationDescriptorOpts 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 CloudTable cluster to which data will be dumped. 78 // If you choose to dump data to OpenTSDB, OpenTSDB must be enabled for the cluster. 79 CloudTableClusterName string `json:"cloudtable_cluster_name"` 80 // ID of the CloudTable cluster to which data will be dumped. 81 // If you choose to dump data to OpenTSDB, OpenTSDB must be enabled for the cluster. 82 CloudTableClusterID string `json:"cloudtable_cluster_id"` 83 // HBase table name of the CloudTable cluster to which data will be dumped. 84 // The parameter is mandatory when data is dumped to the CloudTable HBase. 85 CloudTableTableName string `json:"cloudtable_table_name,omitempty"` 86 // Schema configuration of the CloudTable HBase data. 87 // You can set either this parameter or opentsdb_schema, but this parameter is mandatory when data will be dumped to HBase. 88 // After this parameter is set, the JSON data in the stream can be converted to another format and then be imported to the CloudTable HBase. 89 CloudtableSchema CloudtableSchema `json:"cloudtable_schema,omitempty"` 90 // Schema configuration of the CloudTable OpenTSDB data. 91 // You can set either this parameter or opentsdb_schema, but this parameter is mandatory when data will be dumped to OpenTSDB. 92 // After this parameter is set, the JSON data in the stream can be converted to another format and then be imported to the CloudTable OpenTSDB. 93 OpenTSDBSchema OpenTSDBSchema `json:"opentsdb_schema,omitempty"` 94 // Delimiter used to separate the user data that generates HBase row keys. 95 // Value range: , . | ; \ - _ and ~ 96 // Default value: . 97 CloudtableRowKeyDelimiter string `json:"cloudtable_row_key_delimiter,omitempty"` 98 // Name of the OBS bucket used to back up data that failed to be dumped to CloudTable. 99 OBSBackupBucketPath string `json:"obs_backup_bucket_path,omitempty"` 100 // Self-defined directory created in the OBS bucket and used to back up data that failed to be dumped to CloudTable. 101 // Directory levels are separated by slashes (/) and cannot start with slashes. 102 // Value range: a string of letters, digits, and underscores (_) 103 // The maximum length is 50 characters. 104 // This parameter is left empty by default. 105 BackupFilePrefix string `json:"backup_file_prefix,omitempty"` 106 // Time duration for DIS to retry if data fails to be dumped to CloudTable. 107 // If this threshold is exceeded, the data that fails to be dumped will be backed up to the OBS bucket/ backup_file_prefix / cloudtable_error or OBS bucket/ backup_file_prefix / opentsdb_error directory. 108 // Value range: 0-7,200 109 // Unit: second 110 // Default value: 1,800 111 RetryDuration string `json:"retry_duration,omitempty"` 112 } 113 114 type CloudtableSchema struct { 115 // HBase rowkey schema used by the CloudTable cluster to convert JSON data into HBase rowkeys. 116 // Value range: 1-64 117 RowKey []RowKey `json:"row_key"` 118 // HBase column schema used by the CloudTable cluster to convert JSON data into HBase columns. 119 // Value range: 1 to 4,096 120 Columns []Column `json:"columns"` 121 } 122 123 type RowKey struct { 124 // JSON attribute name, which is used to generate HBase rowkeys for JSON data in the DIS stream. 125 Value string `json:"value"` 126 // JSON attribute type of JSON data in the DIS stream. 127 // Value range: 128 // - Bigint 129 // - Double 130 // - Boolean 131 // - Timestamp 132 // - String 133 // - Decimal 134 // Enumeration values: 135 // Bigint 136 // Double 137 // Boolean 138 // Timestamp 139 // String 140 // Decimal 141 Type string `json:"type"` 142 } 143 144 type Column struct { 145 // Name of the HBase column family to which data will be dumped. 146 ColumnFamilyName string `json:"column_family_name"` 147 // Name of the HBase column to which data will be dumped. 148 // Value range: a string of 1 to 32 characters, consisting of only letters, digits, and underscores (_) 149 ColumnName string `json:"column_name"` 150 // JSON attribute name, which is used to generate HBase column values for JSON data in the DIS stream. 151 Value string `json:"value"` 152 // JSON attribute type of JSON data in the DIS stream. 153 // Value range: 154 // - Bigint 155 // - Double 156 // - Boolean 157 // - Timestamp 158 // - String 159 // - Decimal 160 // Enumeration values: 161 // Bigint 162 // Double 163 // Boolean 164 // Timestamp 165 // String 166 // Decimal 167 Type string `json:"type"` 168 } 169 170 type OpenTSDBSchema struct { 171 // Schema configuration of the OpenTSDB data metric in the CloudTable cluster. 172 // After this parameter is set, the JSON data in the stream can be converted to the metric of the OpenTSDB data. 173 Metric []OpenTSDBMetric `json:"metric"` 174 // Schema configuration of the OpenTSDB data timestamp in the CloudTable cluster. 175 // After this parameter is set, the JSON data in the stream can be converted to the timestamp of the OpenTSDB data. 176 Timestamp OpenTSDBTimestamp `json:"timestamp"` 177 // Schema configuration of the OpenTSDB data value in the CloudTable cluster. 178 // After this parameter is set, the JSON data in the stream can be converted to the value of the OpenTSDB data. 179 Value OpenTSDBValue `json:"value"` 180 // Schema configuration of the OpenTSDB data tags in the CloudTable cluster. 181 // After this parameter is set, the JSON data in the stream can be converted to the tags of the OpenTSDB data. 182 Tags []OpenTSDBTags `json:"tags"` 183 } 184 185 type OpenTSDBMetric struct { 186 // When type is set to Constant, the value of metric is the value of Value. 187 // When value is set to String, the value of metric is the value of the JSON attribute of the user data in the stream. 188 // Enumeration values: 189 // Constant 190 // String 191 Type string `json:"type"` 192 // Constant value or JSON attribute name of the user data in the stream. 193 // This value is 1 to 32 characters long. 194 // Only letters, digits, and periods (.) are allowed. 195 Value string `json:"value"` 196 } 197 198 type OpenTSDBTimestamp struct { 199 // When type is set to Timestamp, the value type of the JSON attribute of the user data in the stream is Timestamp, and the timestamp of OpenTSDB can be generated without converting the data format. 200 // When type is set to String, the value type of the JSON attribute of the user data in the stream is Date, and the timestamp of OpenTSDB can be generated only after the data format is converted. 201 Type string `json:"type"` 202 // JSON attribute name of the user data in the stream. 203 // Value range: a string of 1 to 32 characters, consisting of only letters, digits, and underscores (_) 204 Value string `json:"value"` 205 // This parameter is mandatory when type is set to String. 206 // When the value type of the JSON attribute of the user data in the stream is Date, format is required to convert the data format to generate the timestamp of OpenTSDB. 207 // Value range: 208 // - yyyy/MM/dd HH:mm:ss 209 // - MM/dd/yyyy HH:mm:ss 210 // - dd/MM/yyyy HH:mm:ss 211 // - yyyy-MM-dd HH:mm:ss 212 // - MM-dd-yyyy HH:mm:ss 213 // - dd-MM-yyyy HH:mm:ss 214 // Enumeration values: 215 // yyyy/MM/dd HH:mm:ss 216 // MM/dd/yyyy HH:mm:ss 217 // dd/MM/yyyy HH:mm:ss 218 // yyyy-MM-dd HH:mm:ss 219 // MM-dd-yyyy HH:mm:ss 220 // dd-MM-yyyy HH:mm:ss 221 Format string `json:"format"` 222 } 223 224 type OpenTSDBValue struct { 225 // Dump destination. 226 // Possible values: 227 // Value range: 228 // - Bigint 229 // - Double 230 // - Boolean 231 // - Timestamp 232 // - String 233 // - Decimal 234 Type string `json:"type"` 235 // Constant value or JSON attribute name of the user data in the stream. 236 // Value range: a string of 1 to 32 characters, consisting of only letters, digits, and underscores (_) 237 Value string `json:"value"` 238 } 239 240 type OpenTSDBTags struct { 241 // Tag name of the OpenTSDB data that stores the data in the stream. 242 // Value range: a string of 1 to 32 characters, consisting of only letters, digits, and underscores (_) 243 Name string `json:"name"` 244 // Type name of the JSON attribute of the user data in the stream. 245 // Value range: 246 // - Bigint 247 // - Double 248 // - Boolean 249 // - Timestamp 250 // - String 251 // - Decimal 252 Type string `json:"type"` 253 // Constant value or JSON attribute name of the user data in the stream. 254 // Value range: a string of 1 to 32 characters, consisting of only letters, digits, and underscores (_) 255 Value string `json:"value"` 256 }