Updated on 2024-04-19 GMT+08:00

Generating a Temporary Login Command

Function

Generate a temporary login command using the value of X-Swr-Dockerlogin in the response header and the value of host in the response body.

URI

POST /v2/manage/utils/secret

For details about parameters, see Table 1.

Table 1 Parameter description

Parameter

Mandatory

Type

Description

projectname

No

String

Project name. The default value is the region name.

For example, my-kualalumpur-1.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format). The value can be application/json;charset=utf-8

or application/json.

The default value is application/json.

X-Auth-Token

Yes

String

User token.

The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 3 Response header parameters

Parameter

Type

Description

X-Swr-Dockerlogin

String

A docker login command, for example, docker login -u cn-north-1@OW******FPUKBXI -p 6f0779072******863d1ae3ccef921b7f33

Table 4 Response body parameters

Parameter

Type

Description

auths

Map<String,AuthInfo>

Authentication information.

Table 5 AuthInfo

Parameter

Type

Description

auth

String

Base64-encoded authentication information.

Example Request

POST https://{endpoint}/v2/manage/utils/secret

POST https://{endpoint}/v2/manage/utils/secret

Example Response

Status code: 200

Creation succeeded.

{
  "auths" : {
    "swr.xxx" : {
      "auth" : "Y24tbm9ydGg******hhMTgzMGVmN2RhZjJm"
    }
  }
}

Status Codes

Status Code

Description

200

Creation succeeded.

400

Request error.

401

Authentication failed.

500

Internal error.