|
88 | 88 | UpdateSnapshotRequest, |
89 | 89 | CreateInstanceFromSnapshotRequest, |
90 | 90 | CreateEndpointRequest, |
| 91 | + MigrateEndpointRequest, |
91 | 92 | ) |
92 | 93 | from .content import ( |
93 | 94 | DATABASE_BACKUP_TRANSIENT_STATUSES, |
|
111 | 112 | marshal_CreateUserRequest, |
112 | 113 | marshal_DeleteInstanceACLRulesRequest, |
113 | 114 | marshal_DeleteInstanceSettingsRequest, |
| 115 | + marshal_MigrateEndpointRequest, |
114 | 116 | marshal_PrepareInstanceLogsRequest, |
115 | 117 | marshal_PurgeInstanceLogsRequest, |
116 | 118 | marshal_RestoreDatabaseBackupRequest, |
@@ -3040,3 +3042,47 @@ async def get_endpoint( |
3040 | 3042 |
|
3041 | 3043 | self._throw_on_error(res) |
3042 | 3044 | return unmarshal_Endpoint(res.json()) |
| 3045 | + |
| 3046 | + async def migrate_endpoint( |
| 3047 | + self, |
| 3048 | + *, |
| 3049 | + endpoint_id: str, |
| 3050 | + instance_id: str, |
| 3051 | + region: Optional[Region] = None, |
| 3052 | + ) -> Endpoint: |
| 3053 | + """ |
| 3054 | + Migrate an existing instance endpoint to another instance |
| 3055 | + :param region: Region to target. If none is passed will use default region from the config |
| 3056 | + :param endpoint_id: UUID of the endpoint you want to migrate |
| 3057 | + :param instance_id: UUID of the instance you want to attach the endpoint to |
| 3058 | + :return: :class:`Endpoint <Endpoint>` |
| 3059 | +
|
| 3060 | + Usage: |
| 3061 | + :: |
| 3062 | +
|
| 3063 | + result = await api.migrate_endpoint( |
| 3064 | + endpoint_id="example", |
| 3065 | + instance_id="example", |
| 3066 | + ) |
| 3067 | + """ |
| 3068 | + |
| 3069 | + param_region = validate_path_param( |
| 3070 | + "region", region or self.client.default_region |
| 3071 | + ) |
| 3072 | + param_endpoint_id = validate_path_param("endpoint_id", endpoint_id) |
| 3073 | + |
| 3074 | + res = self._request( |
| 3075 | + "POST", |
| 3076 | + f"/rdb/v1/regions/{param_region}/endpoints/{param_endpoint_id}/migrate", |
| 3077 | + body=marshal_MigrateEndpointRequest( |
| 3078 | + MigrateEndpointRequest( |
| 3079 | + endpoint_id=endpoint_id, |
| 3080 | + instance_id=instance_id, |
| 3081 | + region=region, |
| 3082 | + ), |
| 3083 | + self.client, |
| 3084 | + ), |
| 3085 | + ) |
| 3086 | + |
| 3087 | + self._throw_on_error(res) |
| 3088 | + return unmarshal_Endpoint(res.json()) |
0 commit comments