All Products
Search
Document Center

Tair:SwitchNetwork

Last Updated:Apr 03, 2024

Changes the virtual private cloud (VPC) or vSwitch of an ApsaraDB for Redis instance. If the instance is deployed in the classic network, the network type of the instance is changed from the classic network to VPC.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
kvstore:SwitchNetworkWRITE
  • DBInstance
    acs:kvstore:{#regionId}:{#accountId}:instance/{#instanceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TargetNetworkTypestringNo

The network type to which you want to switch. If you want to switch to VPC network, Set the value to VPC.

Enumeration Value:
  • CLASSIC
  • VPC
VPC
VpcIdstringYes

The ID of the VPC to which you want to switch. You can call the DescribeVpcs operation to query the VPC ID.

Note
  • The VPC and the ApsaraDB for Redis instance must be deployed in the same region.

  • After you set this parameter, you must also set the VSwitchId parameter.

vpc-bp1nme44gek34slfc****
VSwitchIdstringYes

The ID of the vSwitch that belongs to the VPC to which you want to switch. You can call the DescribeVpcs operation to query the VPC ID.

Note The vSwitch and the ApsaraDB for Redis instance must be deployed in the same zone.
vsw-bp1e7clcw529l773d****
InstanceIdstringYes

The ID of the instance. You can call the DescribeInstances operation to query the ID of the instance.

r-bp1zxszhcgatnx****
RetainClassicstringNo

Specifies whether to retain the original classic network endpoint after you switch the instance from classic network to VPC. Default value: False. Valid values:

  • True: retains the classic network endpoint.
  • False: does not retain the classic network endpoint.
Note This parameter is available only when the network type of the instance is classic network.
True
ClassicExpiredDaysstringNo

The retention period of the classic network endpoint. Valid values: 14, 30, 60, and 120. Unit: days.

Note
  • This parameter is available and required only when the RetainClassic parameter is set to True.

  • After you complete the switchover operation, you can also call the ModifyInstanceNetExpireTime operation to modify the retention period of the classic network endpoint.

30

Response parameters

ParameterTypeDescriptionExample
object
TaskIdstring

The ID of the task.

578678678
RequestIdstring

The ID of the request.

F0997EE8-F4C2-4503-9168-85177ED78C70

Examples

Sample success responses

JSONformat

{
  "TaskId": "578678678",
  "RequestId": "F0997EE8-F4C2-4503-9168-85177ED78C70"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidToken.MalformedThe Specified parameter Token is not valid.-
400VpcServiceErrorInvoke vpc service failed.-
400IzNotSupportVpcErrorSpecify iz not support vpc.The specified iz does not support VPCs.
400IzNotSupportSwitchNetworkErrorSpecify iz not support switch network.The specified iz does not support network switching.
400VpcVerifyErrorVpcId is wrong.-
400VpcAndVSwitchNotChangeVpcId and vSwitchId not change.The VpcId and vSwitchId parameter values are not changed.
403ResourceAlreadyExistsResource already exists.-
403InsufficientResourceCapacityip resource is conflict with other custins.-
403VpcFreePasswordNoSupportThe custins opend VPCFreePassword not support this operation.This operation is not supported for the instance because the VPC is secret-free.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-02-26The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    Error Codes 403 change
2023-07-20API Description Update. The Error code has changedsee changesets
Change itemChange content
API DescriptionAPI Description Update.
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403