为应用创建新的 AppMirror 资源
POST /accounts/{account_id}/k8s/v1/apps/{app_id}/appMirrors
指示要创建的 AppMirror API 资源的所需值。
参数
| 名称 | Type | 在 | Required | Description |
|---|---|---|---|---|
account_id |
string |
path |
True |
包含帐户资源的 ID
|
app_id |
string |
path |
True |
包含应用程序资源的 ID |
请求正文
指示要创建的 AppMirror API 资源的所需值。
| 名称 | Type | Required | Description |
|---|---|---|---|
type |
string |
True |
资源的媒体类型。定义的值为:
|
version |
string |
True |
资源的版本。定义的值为:
|
sourceAppID |
string |
True |
源应用程序的标识符。仅在将 sourceAppID 与 destinationAppID 交换时更新。定义的值为:
|
目标集群 ID |
string |
True |
托管目标应用程序的托管群集的标识符。必须在创建时提供,因为它确定将在哪个群集上创建目标应用程序。如果在更新时提供,它必须匹配目标应用程序的群集 ID,因此只能在将 sourceAppID 与 destinationAppID 交换时更改。定义的值为:
|
namespaceMapping |
False |
创建目标应用程序时要使用的命名空间,对应于源应用程序的命名空间。每个 JSON 对象都包含字段 "clusterID" 和 "namespaces",其中 "clusterID" 值是源或目标集群的 JSON 字符串 ID,"namespaces" 值是 JSON 字符串的 JSON 数组。每个集群必须正好有一个 JSON 对象,命名空间将通过索引关联。如果未提供,源集群的相同命名空间将在目标集群中使用。定义的值为:
|
|
storageClasses |
数组["storageClasses"] |
False |
创建新的持久卷声明 (PVC) 时要在目标集群上使用的存储类。每个 JSON 对象都包含字段 "clusterID" 和 "storageClassName",其中 "clusterID" 值是源或目标集群的 JSON 字符串 ID,"storageClassName" 是在该集群上创建 PVC 时要使用的存储类。如果未提供或缺少集群的值,则将对该集群使用默认存储类。定义的值为:
|
stateDesired |
string |
True |
关系的期望状态。在创建时,唯一有效的值是 "established"。定义的值为:
|
元数据 |
False |
与资源关联的客户端和服务指定的元数据。定义的值为:
|
请求示例
{
"type": "application/astra-appMirror",
"version": "1.0",
"sourceAppID": "efd639b6-fc92-4112-8841-0c0ab7890ae0",
"destinationClusterID": "c5d023a9-4061-4a8a-bfbf-3be11ff06226",
"stateDesired": "established"
}
响应
Status: 201, Returns the newly created appMirror resource in the JSON response body.
| 名称 | Type | Required | Description |
|---|---|---|---|
type |
string |
True |
资源的媒体类型。定义的值为:
|
version |
string |
True |
资源的版本。定义的值为:
|
id |
string |
True |
资源的全局唯一标识符。定义的值为:
|
sourceAppID |
string |
True |
源应用程序的标识符。仅在将 sourceAppID 与 destinationAppID 交换时更新。定义的值为:
|
sourceClusterID |
string |
True |
托管源应用程序的托管群集的标识符。此字段是只读的,并根据源应用程序的主机群集确定。如果在更新中提供,则它必须与源应用程序的群集 ID 匹配,因此只能在将 sourceAppID 与 destinationAppID 交换时进行更改。定义的值为:
|
目标应用程序 ID |
string |
False |
目标应用程序的标识符。无法在创建时提供,因为新的应用程序 ID 将作为关系初始化的一部分生成。只能在将 sourceAppID 与 destinationAppID 交换时更新。定义的值为:
|
目标集群 ID |
string |
True |
托管目标应用程序的托管群集的标识符。必须在创建时提供,因为它确定将在哪个群集上创建目标应用程序。如果在更新时提供,它必须匹配目标应用程序的群集 ID,因此只能在将 sourceAppID 与 destinationAppID 交换时更改。定义的值为:
|
namespaceMapping |
False |
创建目标应用程序时要使用的命名空间,对应于源应用程序的命名空间。每个 JSON 对象都包含字段 "clusterID" 和 "namespaces",其中 "clusterID" 值是源或目标集群的 JSON 字符串 ID,"namespaces" 值是 JSON 字符串的 JSON 数组。每个集群必须正好有一个 JSON 对象,命名空间将通过索引关联。如果未提供,源集群的相同命名空间将在目标集群中使用。定义的值为:
|
|
storageClasses |
数组["storageClasses"] |
False |
创建新的持久卷声明 (PVC) 时要在目标集群上使用的存储类。每个 JSON 对象都包含字段 "clusterID" 和 "storageClassName",其中 "clusterID" 值是源或目标集群的 JSON 字符串 ID,"storageClassName" 是在该集群上创建 PVC 时要使用的存储类。如果未提供或缺少集群的值,则将对该集群使用默认存储类。定义的值为:
|
状态 |
string |
True |
关系的状态。定义的值为:
|
stateTransitions |
False |
允许的状态转换。此资源可以进行以下状态转换:
|
|
stateDesired |
string |
True |
关系的期望状态。在创建时,唯一有效的值是 "established"。定义的值为:
|
stateAllowed |
数组[string] |
False |
可以在给定状态下请求的状态。可以在每个定义的状态下请求以下状态:
|
stateDetails |
True |
有关当前状态的其他详细信息,包括为什么达到当前状态。如果没有可用的详细信息,此数组将为空。定义的值为:
|
|
transferState |
string |
False |
当前或最近快照传输的状态。定义的值为:
|
transferStateTransitions |
False |
从给定定义状态允许的状态转换。此资源可以进行以下状态转换:
|
|
transferStateDetails |
False |
有关当前状态的其他详细信息,包括为什么达到当前状态。如果没有可用的详细信息,此数组将为空。定义的值为:
|
|
healthState |
string |
True |
资源的运行状况。定义的值为:
|
healthStateTransitions |
True |
从给定定义状态允许的状态转换。此资源可以进行以下状态转换:
|
|
healthStateDetails |
True |
有关当前状态的其他详细信息,包括为什么达到当前状态。如果没有可用的详细信息,此数组将为空。定义的值为:
|
|
元数据 |
True |
与资源关联的客户端和服务指定的元数据。定义的值为:
|
响应示例
{
"type": "application/astra-appMirror",
"version": "1.0",
"id": "c5fbadd4-5d9e-5942-bb7f-f5386b6b6253",
"sourceAppID": "efd639b6-fc92-4112-8841-0c0ab7890ae0",
"sourceClusterID": "5789e026-c2e2-41e9-ab00-9766bcfa8951",
"destinationAppID": "cd7b6d91-fc19-4983-a754-9a7bb4d80a7b",
"destinationClusterID": "c5d023a9-4061-4a8a-bfbf-3be11ff06226",
"state": "establishing",
"stateTransitions": [
{
"from": "establishing",
"to": [
"established",
"deleting"
]
},
{
"from": "established",
"to": [
"failingOver",
"deleting"
]
},
{
"from": "failingOver",
"to": [
"failedOver",
"deleting"
]
},
{
"from": "failedOver",
"to": [
"establishing",
"deleting"
]
},
{
"from": "deleting",
"to": [
"deleted"
]
}
],
"stateDesired": "established",
"stateAllowed": [
"deleted"
],
"stateDetails": [
{
"type": "https://astra.netapp.io/stateDetails/3",
"title": "AppMirror is being established",
"detail": "The AppMirror relationship is in the process of being established."
}
],
"healthState": "warning",
"healthStateTransitions": [
{
"from": "indeterminate",
"to": [
"normal",
"warning",
"critical"
]
},
{
"from": "normal",
"to": [
"indeterminate",
"warning",
"critical"
]
},
{
"from": "warning",
"to": [
"indeterminate",
"normal",
"critical"
]
},
{
"from": "critical",
"to": [
"indeterminate",
"normal",
"warning"
]
}
],
"healthStateDetails": [
{
"type": "https://astra.netapp.io/stateDetails/4",
"title": "AppMirror not yet established",
"detail": "The relationship is in the process of being established, so it's not protecting the app data yet."
}
],
"metadata": {
"labels": [],
"creationTimestamp": "2022-10-06T20:58:16.305662Z",
"modificationTimestamp": "2022-10-06T20:58:16.305662Z",
"createdBy": "8f84cf09-8036-51e4-b579-bd30cb07b269"
}
}
响应
Status: 401, Unauthorized
| 名称 | Type | Required | Description |
|---|---|---|---|
type |
string |
True |
|
标题 |
string |
True |
|
详细信息 |
string |
True |
|
状态 |
string |
True |
|
correlationID |
string |
False |
响应示例
{
"type": "https://astra.netapp.io/problems/3",
"title": "Missing bearer token",
"detail": "The request is missing the required bearer token.",
"status": "401"
}
响应
Status: 400, Bad request
| 名称 | Type | Required | Description |
|---|---|---|---|
type |
string |
True |
|
标题 |
string |
True |
|
详细信息 |
string |
True |
|
状态 |
string |
True |
|
correlationID |
string |
False |
|
invalidFields |
数组["invalidFields"] |
False |
无效请求正文字段列表 |
响应示例
{
"type": "https://astra.netapp.io/problems/5",
"title": "Invalid query parameters",
"detail": "The supplied query parameters are invalid.",
"status": "400"
}
响应
Status: 409, Conflict
| 名称 | Type | Required | Description |
|---|---|---|---|
type |
string |
True |
|
标题 |
string |
True |
|
详细信息 |
string |
True |
|
状态 |
string |
True |
|
correlationID |
string |
False |
响应示例
{
"type": "https://astra.netapp.io/problems/10",
"title": "JSON resource conflict",
"detail": "The request body JSON contains a field that conflicts with an idempotent value.",
"status": "409"
}
响应
Status: 403, Forbidden
| 名称 | Type | Required | Description |
|---|---|---|---|
type |
string |
True |
|
标题 |
string |
True |
|
详细信息 |
string |
True |
|
状态 |
string |
True |
|
correlationID |
string |
False |
响应示例
{
"type": "https://astra.netapp.io/problems/11",
"title": "Operation not permitted",
"detail": "The requested operation isn't permitted.",
"status": "403"
}
错误
Status: 404, Not found
| 名称 | Type | Required | Description |
|---|---|---|---|
type |
string |
True |
|
标题 |
string |
True |
|
详细信息 |
string |
True |
|
状态 |
string |
True |
|
correlationID |
string |
False |
错误响应示例
{
"type": "https://astra.netapp.io/problems/2",
"title": "Collection not found",
"detail": "The collection specified in the request URI wasn't found.",
"status": "404"
}
定义
查看定义
namespaceMapping
| 名称 | Type | Required | Description |
|---|---|---|---|
clusterID |
string |
False |
为其指定了命名空间的集群的标识符。定义的值为:
|
命名空间 |
数组[string] |
False |
要在集群上使用的命名空间列表。按索引与其他集群命名空间列表相关联。定义的值为:
|
storageClasses
| 名称 | Type | Required | Description |
|---|---|---|---|
clusterID |
string |
False |
为其指定了存储类的集群的标识符。定义的值为:
|
storageClassName |
string |
False |
在"clusterID"中指定的集群上创建 PVC 时要使用的存储类的名称。定义的值为:
|
类型 Astra 标签
| 名称 | Type | Required | Description |
|---|---|---|---|
name |
string |
True |
|
value |
string |
True |
type_astra_metadata_update
与资源关联的客户端和服务指定的元数据。定义的值为:
-
符合 Astra 元数据架构如果在创建时未指定,则将创建没有标签的元数据对象。如果在更新时未指定,则元数据对象的标签、creationTimestamp 和 createdBy 将保留而不进行修改。
| 名称 | Type | Required | Description |
|---|---|---|---|
labels |
数组["类型 Astra 标签"] |
False |
|
creationTimestamp |
string |
False |
|
modificationTimestamp |
string |
False |
|
已创建 |
string |
False |
|
modifiedBy |
string |
False |
type_astra_stateTransition
| 名称 | Type | Required | Description |
|---|---|---|---|
自 |
string |
True |
|
to |
数组[string] |
True |
type_astra_stateDetail
| 名称 | Type | Required | Description |
|---|---|---|---|
type |
string |
True |
|
标题 |
string |
True |
|
详细信息 |
string |
True |
invalidParams
| 名称 | Type | Required | Description |
|---|---|---|---|
name |
string |
True |
无效查询参数的名称 |
原因 |
string |
True |
查询参数无效的原因 |
invalidFields
| 名称 | Type | Required | Description |
|---|---|---|---|
name |
string |
True |
无效请求正文字段的名称 |
原因 |
string |
True |
请求正文字段无效的原因 |