When changes are made to custom resource properties in a template, Resource Orchestration Service (ROS) sends a request to the custom resource provider. The RequestType field in the request is set to Update. Custom resource code does not have to detect changes because it knows that its properties have changed after Update is called.
Request
An Update request contains the following fields:
RequestType
This field is set to Update.
ResponseURL
The presigned public URL. The URL receives responses from the custom resource provider to ROS.
IntranetResponseURL
The presigned internal URL. You can use this URL in Elastic Compute Service (ECS). The URL receives responses from the custom resource provider 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 to which the stack with the custom resource belongs.
CallerId
The ID of the Alibaba Cloud account or Resource Access Management (RAM) user that is used to perform this operation.
RegionId
The region ID of the stack that contains the custom resource.
RequestId
The unique ID of the request.
ResourceType
The resource type selected by the template developer for the custom resource in the template. The name of the custom resource type can be up to 68 characters in length and can contain letters, digits, underscores (_), at signs (@), and hyphens (-).
LogicalResourceId
The name (logical ID) specified by the template developer for the custom resource in the template.
PhysicalResourceId
The required physical ID defined by the custom resource provider. This ID is unique to the provider.
ResourceProperties
This field contains the parameters in the Properties section of the request sent by the template developer. The content is defined by the custom resource provider.
OldResourceProperties
This field contains the original parameters in the Properties section defined by the template developer.
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" }
}
}
Responses
Success
When the Update request is sent, the custom resource provider must send a response that contains the following fields to ROS:
Status
Only SUCCESS is returned for this field.
RequestId
The unique ID of the request. This response value must be copied from the request.
LogicalResourceId
The name (logical ID) specified by the template developer for the custom resource in the template. This response value must be copied from the request.
StackId
The ID of the stack that contains the custom resource. This response value must be copied from the request.
PhysicalResourceId
The value of this field cannot be changed. This response value must be copied from the request.
Data
Optional. The name-value pairs to be sent in the response. You can use the Fn::GetAtt function to access the values provided here by name in the template.
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"
}
}
Failed
When the Update request fails, the custom resource provider must send a response that contains the following fields to ROS:
Status
Only FAILED is returned for this field.
Reason
The reason for the response failure.
RequestId
The unique ID of the request. This response value must be copied from the request.
LogicalResourceId
The name (logical ID) specified by the template developer for the custom resource in the template. This response value must be copied from the request.
StackId
The ID of the stack that contains the custom resource. This response value must be copied 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)"
}