All Products
Search
Document Center

Serverless App Engine:UpdateSecret

Last Updated:Aug 02, 2023

Updates a Secret.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation uses only common request headers and does not have operation-specific request headers. For more information, see Common request and response headers.

Request syntax

PUT /pop/v1/sam/secret/secret HTTP/1.1

Request parameters

Parameter

Type

Position

Required

Example

Description

NamespaceId

String

Query

Yes

cn-beijing:test

The ID of the namespace in which the Secret resides. If the namespace is the default namespace, specify only the corresponding region ID. Example: cn-beijing.

SecretId

Long

Query

Yes

16

The Secret ID.

Object

Body

Yes

The information about the Secret.

SecretData

String

Body

Yes

{".dockerconfigjson":"eyJhdXRocyI6eyJyZWdpc3RyeS12cGMuY24tYmVpamluZy5hbGl5dW5jcy5jb20iOnsidXNlcm5hbWUiOiJ1c2VybmFtZSIsInBhc3N3b3JkIjoicGFzc3dvcmQiLCJhdXRoIjoiZFhObGNtNWhiV1U2Y0dGemMzZHZjbVE9In0sInJlZ2lzdHJ5LmNuLWJlaWppbmcuYWxpeXVuY3MuY29tIjp7InVzZXJuYW1lIjoidXNlcm5hbWUiLCJwYXNzd29yZCI6InBhc3N3b3JkIiwiYXV0aCI6ImRYTmxjbTVoYldVNmNHRnpjM2R2Y21RPSJ9fX0="}

The information about the key-value pairs of the Secret. You must configure this parameter. Format:

{"Data":"{\"k1\":\"v1\", \"k2\":\"v2\"}"}

k specifies a key and v specifies a value. For more information, see Manage a Kubernetes Secret.

Response parameters

Parameter

Type

Example

Description

RequestId

String

91F93257-7A4A-4BD3-9A7E-2F6EAE6D****

The request ID.

Message

String

success

The returned message.

TraceId

String

0a98a02315955564772843261e****

The trace ID that is used to query the details of the request.

Data

Object

The returned result.

SecretId

Long

16

The Secret ID.

ErrorCode

String

Null

The error code. Valid values:

  • If the call is successful, the ErrorCode parameter is not returned.

  • If the call fails, the ErrorCode parameter is returned. For more information, see the "Error codes" section in this topic.

Code

String

200

The HTTP status code. Valid values:

  • 2xx: The call was successful.

  • 3xx: The call was redirected.

  • 4xx: The call failed.

  • 5xx: A server error occurred.

Success

Boolean

true

Indicates whether the Secret was updated. Valid values:

  • true: The Secret was updated.

  • false: The Secret failed to be updated.

Examples

Sample requests

PUT /pop/v1/sam/secret/secret?NamespaceId=cn-beijing:test&SecretId=16 HTTP/1.1
Host:sae.aliyuncs.com
Content-Type:application/json

{
  "SecretData" : "{\".dockerconfigjson\":\"eyJhdXRocyI6eyJyZWdpc3RyeS12cGMuY24tYmVpamluZy5hbGl5dW5jcy5jb20iOnsidXNlcm5hbWUiOiJ1c2VybmFtZSIsInBhc3N3b3JkIjoicGFzc3dvcmQiLCJhdXRoIjoiZFhObGNtNWhiV1U2Y0dGemMzZHZjbVE9In0sInJlZ2lzdHJ5LmNuLWJlaWppbmcuYWxpeXVuY3MuY29tIjp7InVzZXJuYW1lIjoidXNlcm5hbWUiLCJwYXNzd29yZCI6InBhc3N3b3JkIiwiYXV0aCI6ImRYTmxjbTVoYldVNmNHRnpjM2R2Y21RPSJ9fX0=\"}"
}

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<UpdateSecretResponse>
    <RequestId>91F93257-7A4A-4BD3-9A7E-2F6EAE6D****</RequestId>
    <Message>success</Message>
    <TraceId>0a98a02315955564772843261e****</TraceId>
    <Data>
        <SecretId>16</SecretId>
    </Data>
    <Code>200</Code>
    <Success>true</Success>
</UpdateSecretResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "91F93257-7A4A-4BD3-9A7E-2F6EAE6D****",
  "Message" : "success",
  "TraceId" : "0a98a02315955564772843261e****",
  "Data" : {
    "SecretId" : "16"
  },
  "Code" : "200",
  "Success" : true
}

Error codes

HTTP status code

Error code

Error message

Description

400

InvalidParameter.NotEmpty

You must specify the parameter %s.

The value of the %s parameter is invalid. This parameter cannot be left empty.

400

InvalidParameter.Obviously

The specified parameter is invalid {%s}.

The value of the {%s} parameter is invalid.

400

InvalidParameter.WithMessage

The parameter is invalid {%s}: %s

The value %s of the {%s} parameter is invalid.

400

InvalidSecretId.NotFound

The specified SecretId [%s] does not exist in our records.

The specified Secret ID [%s] does not exist.

400

InvalidSecretDataKey.NotFound

The specified Key [%s] does not exist in the specified Secret [%s].

The specified Secret key does not exist in the current Secret [%s].

500

OperationFailed.RPCError

Internal RPC request processing error.

The system failed to process an internal RPC request.

For a list of error codes, see Service error codes.