github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/drs/v3/public/BatchListTaskDetails.go (about)

     1  package public
     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 BatchQueryTaskOpts struct {
    10  	Jobs    []string `json:"jobs"`
    11  	PageReq PageReq  `json:"page_req,omitempty"`
    12  }
    13  
    14  type PageReq struct {
    15  	// Current page number, which cannot exceed the maximum number of pages.
    16  	// (Number of pages = Number of transferred job IDs/Number of tasks on each page)
    17  	// Minimum value: 1.
    18  	// Default value: 1
    19  	CurPage int `json:"cur_page,omitempty"`
    20  	// Number of items on each page. If this parameter is set to 0, all items are obtained.
    21  	// Minimum value: 0
    22  	// Maximum value: 100
    23  	// Default value: 5
    24  	PerPage int `json:"per_page,omitempty"`
    25  }
    26  
    27  func BatchListTaskDetails(client *golangsdk.ServiceClient, opts BatchQueryTaskOpts) (*BatchListTaskDetailsResponse, error) {
    28  	b, err := build.RequestBody(opts, "")
    29  	if err != nil {
    30  		return nil, err
    31  	}
    32  
    33  	// POST /v3/{project_id}/jobs/batch-detail
    34  	raw, err := client.Post(client.ServiceURL("jobs", "batch-detail"), b, nil, &golangsdk.RequestOpts{
    35  		OkCodes: []int{200}})
    36  	if err != nil {
    37  		return nil, err
    38  	}
    39  
    40  	var res BatchListTaskDetailsResponse
    41  	err = extract.Into(raw.Body, &res)
    42  	return &res, err
    43  }
    44  
    45  type BatchListTaskDetailsResponse struct {
    46  	Count   int            `json:"count,omitempty"`
    47  	Results []QueryJobResp `json:"results,omitempty"`
    48  }
    49  
    50  type QueryJobResp struct {
    51  	// Task ID.
    52  	Id string `json:"id,omitempty"`
    53  	// Parent task ID.
    54  	ParentId string `json:"parent_id,omitempty"`
    55  	// Task name.
    56  	Name string `json:"name,omitempty"`
    57  	// Task status. Values:
    58  	// CREATING: The task is being created.
    59  	// CREATE_FAILED: The task fails to be created.
    60  	// CONFIGURATION: The task is being configured.
    61  	// STARTJOBING: The task is being started.
    62  	// WAITING_FOR_START: The task is waiting to be started.
    63  	// START_JOB_FAILED: The task fails to be started.
    64  	// FULL_TRANSFER_STARTED: Full migration is in progress, and the DR scenario is initialized.
    65  	// FULL_TRANSFER_FAILED: Full migration failed. Initialization failed in the DR scenario.
    66  	// FULL_TRANSFER_COMPLETE: Full migration is complete, and the initialization is complete in the DR scenario.
    67  	// INCRE_TRANSFER_STARTED: Incremental migration is being performed, and the DR task is in progress.
    68  	// INCRE_TRANSFER_FAILED: Incremental migration fails and a DR exception occurs.
    69  	// RELEASE_RESOURCE_STARTED: The task is being stopped.
    70  	// RELEASE_RESOURCE_FAILED: Stop task failed.
    71  	// RELEASE_RESOURCE_COMPLETE: The task is stopped.
    72  	// CHANGE_JOB_STARTED: The task is being changed.
    73  	// CHANGE_JOB_FAILED: Change task failed.
    74  	// CHILD_TRANSFER_STARTING: The subtask is being started.
    75  	// CHILD_TRANSFER_STARTED: The subtask is being migrated.
    76  	// CHILD_TRANSFER_COMPLETE: The subtask migration is complete.
    77  	// CHILD_TRANSFER_FAILED: Migrate subtask failed.
    78  	// RELEASE_CHILD_TRANSFER_STARTED: The subtask is being stopped.
    79  	// RELEASE_CHILD_TRANSFER_COMPLETE: The subtask is complete.
    80  	Status string `json:"status,omitempty"`
    81  	// Description.
    82  	Description string `json:"description,omitempty"`
    83  	// Creation time, in timestamp format.
    84  	CreateTime string `json:"create_time,omitempty"`
    85  	// Migration type. Values:
    86  	// FULL_TRANS: full migration
    87  	// INCR_TRANS: incremental migration
    88  	// FULL_INCR_TRANS: full+incremental migration
    89  	TaskType string `json:"task_type,omitempty"`
    90  	// Source database information.
    91  	SourceEndpoint Endpoint `json:"source_endpoint,omitempty"`
    92  	// DMQ information body.
    93  	DmqEndpoint Endpoint `json:"dmq_endpoint,omitempty"`
    94  	// Information about the physical source database.
    95  	SourceSharding []Endpoint `json:"source_sharding,omitempty"`
    96  	// Information body of the destination database.
    97  	TargetEndpoint Endpoint `json:"target_endpoint,omitempty"`
    98  	// Network type. Values:
    99  	// vpn
   100  	// vpc
   101  	// eip
   102  	NetType string `json:"net_type,omitempty"`
   103  	// Failure cause.
   104  	FailedReason string `json:"failed_reason,omitempty"`
   105  	// Replication instance information.
   106  	InstInfo InstInfo `json:"inst_info,omitempty"`
   107  	// Start time, in timestamp format.
   108  	ActualStartTime string `json:"actual_start_time,omitempty"`
   109  	// Full migration completion time, in timestamp format.
   110  	FullTransferCompleteTime string `json:"full_transfer_complete_time,omitempty"`
   111  	// Update time, in timestamp format.
   112  	UpdateTime string `json:"update_time,omitempty"`
   113  	// Task direction. Values:
   114  	// up: The current cloud is the standby cloud in the DR and to-the-cloud scenarios.
   115  	// down: The current cloud is the active cloud in the DR and out-of-cloud scenarios.
   116  	// non-dbs: self-built databases.
   117  	JobDirection string `json:"job_direction,omitempty"`
   118  	// Migration scenario Values:
   119  	// migration: real-time migration.
   120  	// sync: real-time synchronization.
   121  	// cloudDataGuard: real-time disaster recovery.
   122  	DbUseType string `json:"db_use_type,omitempty"`
   123  	// Whether the instance needs to be restarted.
   124  	NeedRestart *bool `json:"need_restart,omitempty"`
   125  	// Whether the destination instance is restricted to read-only.
   126  	IsTargetReadonly *bool `json:"is_target_readonly,omitempty"`
   127  	// Conflict policy. Values:
   128  	// stop: The conflict fails.
   129  	// overwrite: Conflicting data is overwritten.
   130  	// ignore: The conflict is ignored.
   131  	ConflictPolicy string `json:"conflict_policy,omitempty"`
   132  	// DDL filtering policy. Values:
   133  	// drop_database: Filters DDLs.
   134  	// drop_databasefilter_all: Filters out all DLLs.
   135  	// "": No filter.
   136  	FilterDdlPolicy string `json:"filter_ddl_policy,omitempty"`
   137  	// Migration speed limit.
   138  	SpeedLimit []SpeedLimitInfo `json:"speed_limit,omitempty"`
   139  	// Migration schemes. Values:
   140  	// Replication: primary/standby replication.
   141  	// Tungsten: parses logs.
   142  	// PGBaseBackup: PostgreSQL backup.
   143  	SchemaType string `json:"schema_type,omitempty"`
   144  	// The number of nodes.
   145  	NodeNum string `json:"node_num,omitempty"`
   146  	// Whether to select objects.
   147  	ObjectSwitch bool `json:"object_switch,omitempty"`
   148  	// Main task ID
   149  	MasterJobId string `json:"master_job_id,omitempty"`
   150  	// Full snapshot mode.
   151  	FullMode string `json:"full_mode,omitempty"`
   152  	// Whether to migrate the structure.
   153  	StructTrans *bool `json:"struct_trans,omitempty"`
   154  	// Whether to migrate indexes.
   155  	IndexTrans *bool `json:"index_trans,omitempty"`
   156  	// Whether to replace the definer with the user of the destination database.
   157  	ReplaceDefiner *bool `json:"replace_definer,omitempty"`
   158  	// Whether to migrate users.
   159  	MigrateUser *bool `json:"migrate_user,omitempty"`
   160  	// Whether to perform database-level synchronization.
   161  	SyncDatabase *bool `json:"sync_database,omitempty"`
   162  
   163  	ErrorCode    string `json:"error_code,omitempty"`
   164  	ErrorMessage string `json:"error_message,omitempty"`
   165  
   166  	// Information about the root node database of the destination instance.
   167  	TargetRootDb *DefaultRootDb `json:"target_root_db,omitempty"`
   168  	// AZ where the node is located.
   169  	AzCode string `json:"az_code,omitempty"`
   170  	// VPC to which the node belongs.
   171  	VpcId string `json:"vpc_id,omitempty"`
   172  	// Subnet where the node is located.
   173  	SubnetId string `json:"subnet_id,omitempty"`
   174  	// Security group to which the node belongs.
   175  	SecurityGroupId string `json:"security_group_id,omitempty"`
   176  	// Whether the task is a multi-active DR task. The value is true when the task is a dual-active DR task.
   177  	MultiWrite *bool `json:"multi_write,omitempty"`
   178  	// Whether IPv6 is supported
   179  	SupportIpV6 *bool `json:"support_ip_v6,omitempty"`
   180  	// Inherited task ID, which is used for the Oracle_Mrskafka link.
   181  	InheritId string `json:"inherit_id,omitempty"`
   182  	// GTID set of breakpoints.
   183  	Gtid string `json:"gtid,omitempty"`
   184  	// Exception notification settings.
   185  	AlarmNotify *QuerySmnInfoResp `json:"alarm_notify,omitempty"`
   186  	// Whether the task is a cross-AZ synchronization task.
   187  	IsMultiAz *bool `json:"is_multi_az"`
   188  	// AZ name of the node.
   189  	AzName string `json:"az_name"`
   190  	// Primary AZ of the cross-AZ task.
   191  	MasterAz string `json:"master_az"`
   192  	// Standby AZ of the cross-AZ task.
   193  	SlaveAz string `json:"slave_az"`
   194  	// Primary/Standby role of a task.
   195  	NodeRole string `json:"node_role"`
   196  	// Start point of an incremental task.
   197  	IncreStartPosition string `json:"incre_start_position,omitempty"`
   198  }
   199  
   200  type InstInfo struct {
   201  	// Engine type. Values:
   202  	// mysql
   203  	// mongodb
   204  	// cloudDataGuard-mysql
   205  	// mysql-to-taurus
   206  	// postgresql
   207  	EngineType string `json:"engine_type,omitempty"`
   208  	// DB instance type. Values:
   209  	// high
   210  	InstType string `json:"inst_type,omitempty"`
   211  	// Private IP address of the replication instance.
   212  	Ip string `json:"ip,omitempty"`
   213  	// EIP of the replication instance.
   214  	PublicIp string `json:"public_ip,omitempty"`
   215  	// Scheduled start time of a replication instance task.
   216  	StartTime string `json:"start_time,omitempty"`
   217  	// Replication instance status. Values:
   218  	// active
   219  	// deleted
   220  	Status string `json:"status,omitempty"`
   221  	// Storage space of a replication instance.
   222  	VolumeSize int `json:"volume_size,omitempty"`
   223  }
   224  
   225  type DefaultRootDb struct {
   226  	// Database name.
   227  	DbName string `json:"db_name,omitempty"`
   228  	// Encoding format
   229  	DbEncoding string `json:"db_encoding,omitempty"`
   230  }
   231  
   232  type QuerySmnInfoResp struct {
   233  	TopicName     string          `json:"topic_name"`
   234  	DelayTime     int             `json:"delay_time"`
   235  	RtoDisplay    int             `json:"rto_delay"`
   236  	RpoDisplay    int             `json:"rpo_delay"`
   237  	AlarmToUser   *bool           `json:"alarm_to_user"`
   238  	Subscriptions []Subscriptions `json:"subscriptions"`
   239  }
   240  
   241  type Subscriptions struct {
   242  	Endpoints []string `json:"endpoints"`
   243  	Protocol  string   `json:"protocol"`
   244  }