github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/lts/v2/transfers/UpdateTransfer.go (about) 1 package transfers 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 7 ) 8 9 type UpdateTransferOpts struct { 10 TransferId string `json:"log_transfer_id"` 11 TransferInfo TransferInfo `json:"log_transfer_info"` 12 } 13 14 type TransferInfo struct { 15 // Log transfer format. The value can be RAW or JSON. RAW indicates raw log format, whereas JSON indicates JSON format. JSON and RAW are supported for OBS and DIS transfer tasks, but only RAW is supported for DMS transfer tasks. 16 // 17 // Enumerated values: 18 // 19 // JSON 20 // RAW 21 StorageFormat string `json:"log_storage_format"` 22 // Log transfer status. ENABLE indicates that log transfer is enabled, DISABLE indicates that log transfer is disabled, and EXCEPTION indicates that log transfer is abnormal. 23 // 24 // Enumerated values: 25 // 26 // ENABLE 27 // DISABLE 28 // EXCEPTION 29 TransferStatus string `json:"log_transfer_status"` 30 // Log transfer details. 31 TransferDetail TransferDetail `json:"log_transfer_detail"` 32 } 33 34 type TransferDetail struct { 35 // Length of the transfer interval for an OBS transfer task. This parameter is required to update an OBS transfer task. The log transfer interval is specified by the combination of the values of obs_period and obs_period_unit, and must be set to one of the following: 2 min, 5 min, 30 min, 1 hour, 3 hours, 6 hours, and 12 hours. 36 // 37 // Enumerated values: 38 // 39 // 1 40 // 2 41 // 3 42 // 5 43 // 6 44 // 12 45 // 30 46 ObsPeriod int `json:"obs_period"` 47 // KMS key ID for an OBS transfer task. This parameter is required if encryption is enabled for the target OBS bucket. 48 // 49 // Minimum length: 36 characters 50 // 51 // Maximum length: 36 characters 52 ObsEncryptedId string `json:"obs_encrypted_id,omitempty"` 53 // Transfer file prefix of an OBS transfer task. This parameter is optional. 54 // 55 // The value must match the regular expression: 56 // 57 // ^[a-zA-Z0-9\._-]*$ 58 // 59 // Minimum length: 1 character 60 // 61 // Maximum length: 64 characters 62 ObsPrefixName string `json:"obs_prefix_name,omitempty"` 63 // Unit of the transfer interval for an OBS transfer task. This parameter is required to update an OBS transfer task. The log transfer interval is specified by the combination of the values of obs_period and obs_period_unit, and must be set to one of the following: 2 min, 5 min, 30 min, 1 hour, 3 hours, 6 hours, and 12 hours. 64 // 65 // Enumerated values: 66 // 67 // min 68 // hour 69 ObsPeriodUnit string `json:"obs_period_unit"` 70 // OBS bucket path, which is the log transfer destination. 71 ObsTransferPath string `json:"obs_transfer_path,omitempty"` 72 // OBS bucket name. This parameter is required to update an OBS transfer task. 73 // 74 // Minimum length: 3 characters 75 // 76 // Maximum length: 63 characters 77 ObsBucketName string `json:"obs_bucket_name"` 78 // Whether OBS bucket encryption is enabled. 79 ObsEncryptedEnable bool `json:"obs_encrypted_enable,omitempty"` 80 // Custom transfer path of an OBS transfer task. This parameter is optional. 81 // 82 // The value must match the regular expression: 83 // 84 // ^(/)?([a-zA-Z0-9\._-]+)(/[a-zA-Z0-9\._-]+)*(/)?$ 85 // 86 // Minimum length: 1 character 87 // 88 // Maximum length: 64 characters 89 ObsDirPreFixName string `json:"obs_dir_pre_fix_name,omitempty"` 90 // If tag delivery is enabled, this field must contain the following host information: hostIP, hostId, hostName, pathFile, and collectTime. 91 // 92 // (Optional) Common fields include logStreamName, regionName, logGroupName, and projectId. 93 // 94 // (Optional) Enable the transfer tag: streamTag. 95 Tags []string `json:"tags,omitempty"` 96 } 97 98 func UpdateTransfer(client *golangsdk.ServiceClient, opts UpdateTransferOpts) (*UpdateTransferResponse, error) { 99 b, err := build.RequestBody(opts, "") 100 if err != nil { 101 return nil, err 102 } 103 104 // PUT /v2/{project_id}/transfers 105 raw, err := client.Put(client.ServiceURL("transfers"), b, nil, &golangsdk.RequestOpts{ 106 OkCodes: []int{200}, 107 }) 108 if err != nil { 109 return nil, err 110 } 111 112 var res UpdateTransferResponse 113 err = extract.Into(raw.Body, &res) 114 return &res, err 115 } 116 117 type UpdateTransferResponse struct { 118 // Log group ID. 119 // 120 // Minimum length: 36 characters 121 // 122 // Maximum length: 36 characters 123 LogGroupId string `json:"log_group_id,omitempty"` 124 // Log group name. 125 // 126 // Minimum length: 1 character 127 // 128 // Maximum length: 64 characters 129 LogGroupName string `json:"log_group_name,omitempty"` 130 // Log stream list. 131 LogStreams []LogStreams `json:"log_streams,omitempty"` 132 // Log transfer task ID. 133 // 134 // Minimum length: 36 characters 135 // 136 // Maximum length: 36 characters 137 LogTransferId string `json:"log_transfer_id,omitempty"` 138 // Log transfer information. 139 LogTransferInfo LogTransferInfo `json:"log_transfer_info,omitempty"` 140 } 141 142 type LogStreams struct { 143 // Log stream ID. 144 // 145 // Minimum length: 36 characters 146 // 147 // Maximum length: 36 characters 148 LogStreamId string `json:"log_stream_id"` 149 // Log stream name. 150 // 151 // Minimum length: 1 character 152 // 153 // Maximum length: 64 characters 154 LogStreamName string `json:"log_stream_name"` 155 } 156 157 type LogTransferInfo struct { 158 // Information about delegated log transfer. This parameter is returned for a delegated log transfer task. 159 LogAgencyTransfer LogAgencyTransfer `json:"log_agency_transfer,omitempty"` 160 // Time when the log transfer task was created. 161 // 162 // Minimum value: 0 163 // 164 // Maximum value: 9999999999999 165 LogCreateTime int64 `json:"log_create_time"` 166 // 167 // Log transfer format. The value can be RAW or JSON. RAW indicates raw log format, whereas JSON indicates JSON format. OBS transfer tasks support JSON. 168 // 169 // Enumerated values: 170 // 171 // JSON 172 // RAW 173 LogStorageFormat string `json:"log_storage_format"` 174 // Log transfer details. 175 LogTransferDetail TransferDetail `json:"log_transfer_detail"` 176 // 177 // Log transfer mode. cycle indicates periodical transfer, whereas realTime indicates real-time transfer. cycle is available to OBS transfer tasks and realTime is available to DIS and DMS transfer tasks. 178 // 179 // Enumerated values: 180 // 181 // cycle 182 // realTime 183 LogTransferMode string `json:"log_transfer_mode"` 184 // Log transfer status. ENABLE indicates that log transfer is enabled, DISABLE indicates that log transfer is disabled, and EXCEPTION indicates that log transfer is abnormal. 185 // 186 // Enumerated values: 187 // 188 // ENABLE 189 // DISABLE 190 // EXCEPTION 191 LogTransferStatus string `json:"log_transfer_status"` 192 // Log transfer type. You can transfer logs to OBS. 193 // 194 // Enumerated values: 195 // 196 // OBS 197 LogTransferType string `json:"log_transfer_type"` 198 } 199 200 type LogAgencyTransfer struct { 201 // Delegator account ID. 202 // 203 // Minimum length: 1 character 204 // 205 // Maximum length: 128 characters 206 AgencyDomainId string `json:"agency_domain_id"` 207 // Delegator account name. 208 // 209 // Minimum length: 1 character 210 // 211 // Maximum length: 128 characters 212 AgencyDomainName string `json:"agency_domain_name"` 213 // Name of the agency created by the delegator. 214 // 215 // Minimum length: 1 character 216 // 217 // Maximum length: 128 characters 218 AgencyName string `json:"agency_name"` 219 // Project ID of the delegator. 220 // 221 // Minimum length: 32 characters 222 // 223 // Maximum length: 32 characters 224 AgencyProjectId string `json:"agency_project_id"` 225 // Account ID of the delegated party (ID of the account that created the log transfer task). 226 // 227 // Minimum length: 1 character 228 // 229 // Maximum length: 128 characters 230 BeAgencyDomainId string `json:"be_agency_domain_id"` 231 // 232 // Project ID of the delegated party (project ID of the account that created the log transfer task). 233 // 234 // Minimum length: 32 characters 235 // 236 // Maximum length: 32 characters 237 BeAgencyProjectId string `json:"be_agency_project_id"` 238 }