When changes are made to custom resource properties in a template, Resource Orchestration Service (ROS) sends a request where the RequestType field is set to Update to the custom resource provider. Custom resource code does not have to detect changes because it knows that its properties have changed after Update is called.

Request

A update request contains the following fields:

  • RequestType

    This field is set to Update.

  • ResponseURL

    The presigned public URL. This 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). This 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 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) selected 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 previously 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

    This field must be set to SUCCESS.

  • RequestId

    The unique ID of the request. The response value must be copied from the request.

  • LogicalResourceId

    The name (logical ID) selected by the template developer for the custom resource in the template. The response value must be copied from the request.

  • StackId

    The ID of the stack that contains the custom resource. The response value must be copied from the request.

  • PhysicalResourceId

    The value of this field cannot be changed. The response value must be copied from the request.

  • Data

    Optional. The name-value pairs to be sent in the response. These pairs are defined by the custom resource provider. 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

    This field must be set to FAILED.

  • Reason

    The reason for the response failure.

  • RequestId

    The unique ID of the request. The response value must be copied from the request.

  • LogicalResourceId

    The name (logical ID) selected by the template developer for the custom resource in the template. The response value must be copied from the request.

  • StackId

    The ID of the stack that contains the custom resource. The 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)"
}