When you change the properties of a custom resource in a template, Resource Orchestration Service (ROS) sends a custom resource request with `RequestType` set to `Update`. The custom resource code does not need to detect the change because the `Update` call already indicates that the properties were modified.
Request
An update request contains the following fields:
- RequestType
Set to `Update`.
- ResponseURL
A presigned public network URL that the custom resource provider uses to send responses to ROS.
- IntranetResponseURL
A presigned internal network URL for use within ECS. The custom resource provider uses this URL to send responses to ROS.
- StackId
The ID of the stack that contains the custom resource.
- StackName
The name of the stack that contains the custom resource.
- ResourceOwnerId
The ID of the Alibaba Cloud account that owns the stack containing the custom resource.
- CallerId
The ID of the account that performs the stack operation. This can be an Alibaba Cloud account or a Resource Access Management (RAM) user.
- RegionId
The region of the stack containing the custom resource.
- RequestId
The unique ID of the request.
- ResourceType
The resource type of the custom resource, as specified by the template developer in the ROS template. The resource type name can be up to 68 characters in length and can contain letters, digits, underscores (_), at signs (@), and hyphens (-).
- LogicalResourceId
The name (logical ID) of the custom resource, as specified by the template developer in the ROS template.
- PhysicalResourceId
The physical ID defined by the custom resource provider. This ID is unique to the provider.
- ResourceProperties
The content of the `Parameters` object within `Properties` as specified by the template developer. The structure is defined by the custom resource provider.
- OldResourceProperties
The content of the `Parameters` object within `Properties` from the previous resource configuration.
Example
{
"RequestType" : "Update",
"RequestId" : "unique id for this update request",
"ResponseURL" : "pre-signed-url-for-update-response",
"IntranetResponseURL" : "pre-signed-intranet-url-for-create-response",
"ResourceType" : "Custom::MyCustomResourceType",
"LogicalResourceId" : "name of resource in template",
"PhysicalResourceId" : "custom resource provider-defined physical id",
"StackId" : "stack id",
"StackName" : "stack name",
"ResourceOwnerId": "resource owner id",
"CallerId": "caller id",
"RegionId": "region id",
"ResourceProperties" : {
"key1" : "new-string",
"key2" : [ "new-list" ],
"key3" : { "key4" : "new-map" }
},
"OldResourceProperties" : {
"key1" : "string",
"key2" : [ "list" ],
"key3" : { "key4" : "map" }
}
}
Response
Success
When an update request succeeds, the custom resource provider must send a response to ROS with the following fields:
- Status
Must be `SUCCESS`.
- RequestId
The unique ID of the request. Copy this value from the request.
- LogicalResourceId
The name (logical ID) of the custom resource, as specified by the template developer in the ROS template. Copy this value from the request.
- StackId
The ID of the stack that contains the custom resource. Copy this value from the request.
- PhysicalResourceId
This value is immutable. Copy this value from the request.
- Data
Optional. Name-value pairs defined by the custom resource provider and returned in the response. You can use the `Fn::GetAtt` function in the template to access these values by name.
Example
{
"Status" : "SUCCESS",
"RequestId" : "unique id for this update request (copied from request)",
"LogicalResourceId" : "name of resource in template (copied from request)",
"StackId" : "stack id (copied from request)",
"PhysicalResourceId" : "custom resource provider-defined physical id",
"Data" : {
"keyThatCanBeUsedInGetAtt1" : "data for key 1",
"keyThatCanBeUsedInGetAtt2" : "data for key 2"
}
}
Failure
If an update request fails, send a response to ROS with the following fields:
- Status
Must be `FAILED`.
- Reason
A description of the reason for the failure.
- RequestId
The unique ID of the request. Copy this value from the request.
- LogicalResourceId
The name (logical ID) of the custom resource, as specified by the template developer in the ROS template. Copy this value from the request.
- StackId
The ID of the stack that contains the custom resource. Copy this value from the request.
Example
{
"Status" : "FAILED",
"Reason" : "Required failure reason string",
"RequestId" : "unique id for this update request (copied from request)",
"LogicalResourceId" : "name of resource in template (copied from request)",
"StackId" : "stack id (copied from request)"
}