GetAuthCode
Retrieves the connection authorization code and required resource information for an existing image or application creation task.
Operation description
Before calling this operation, you must create a task, and the creation or validation resources corresponding to the task must be available.
Obtain the TaskId and actual TaskType from the response of the task creation operation or GetTask.
Specify ResourceType to obtain the connection information for the creation or validation environment.
Use the returned authorization code together with the user, resource group, and application identifiers in the same response for connection.
The authorization code is a sensitive connection credential. Do not record it in public documents or logs. When specifying AppId, you must also specify the matching AppVersionId.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
appstreaming:GetAuthCode |
none |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| TaskType |
string |
Yes |
The actual task type. It must match the creation or validation task corresponding to the TaskId. Use the TaskType returned by GetTask. The task must also have connectable creation or validation resources. You cannot obtain an authorization code for distribution or snapshot tasks that do not have connection resources. Valid values:
|
IMAGE_MANUAL |
| ResourceType |
string |
Yes |
The type of the resource to connect to. Valid values:
The corresponding environment must be created and in a connectable state. |
BUILDER |
| TaskId |
string |
Yes |
The ID of the existing creation or validation task. Create the task and confirm that the corresponding resources are available before calling this operation. |
tid-bp1example**** |
| BizRegionId |
string |
No |
The region compatibility parameter. The destination region of the current connection resource is determined by the execution region of the task. You cannot use this parameter to switch the task region. Omit this parameter. |
cn-hangzhou |
| AppId |
string |
No |
The ID of the application to connect to. When specifying this parameter, you must also provide the matching AppVersionId. If omitted, the application configured in the creation or validation environment is used. |
app-bp1example**** |
| AppVersionId |
string |
No |
The ID of the application version to connect to. This parameter is used together with AppId. This parameter is not the image version ID. |
apv-bp1example**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response to the API call. |
||
| Data |
object |
The business data returned by this operation. |
|
| AppId |
string |
The application ID, used to query the application or unbind the image later. |
app-bp1example**** |
| AppInstanceGroupId |
string |
The delivery group ID of the creation or validation resource. It is used together with the user and application information in this response when connecting. |
aig-bp1example**** |
| AuthCode |
string |
The authorization code used to connect to the creation or validation resource. It is valid for 180 seconds (3 minutes) from the time of issuance. Use it promptly after obtaining it. Use it together with the user, delivery group, and application information in the same response, and keep it confidential as a connection credential. Do not reuse the authorization code after it is successfully redeemed. If it has been used or has expired, call this operation again to obtain a new one. |
e4e169bea1cc48e8afac53********** |
| UserId |
string |
The user ID used when connecting to the creation or validation environment. Use the value returned in this response. |
__vhd_builder__ |
| RegionId |
string |
The region ID in this response. |
cn-hangzhou |
| ProductType |
string |
The purpose type of the connection resource. Valid values:
|
ImageBuilder |
| AppVersionId |
string |
The application version ID, used to locate the specified version of the application. This field is not the image version ID. |
apv-bp1example**** |
| AccessType |
string |
The network access type supported by the connection resource. Valid values:
|
INTERNET |
| Success |
boolean |
Indicates whether the request was processed successfully. true indicates that the request was processed successfully. To check whether an asynchronous task is completed, query the task status separately. |
|
| Code |
string |
The error code. It is returned when the request fails. A successful response may not contain this field. |
InternalError |
| Message |
string |
The error or result message. It is used to describe the cause when the request fails. A successful response may not contain this field. |
Internal error. |
| RequestId |
string |
The unique identifier of the request. You can provide this value for troubleshooting. |
01A1A962-5503-107B-AC8F-EBA85DF905AC |
Examples
Success response
JSON format
{
"Data": {
"AppId": "app-bp1example****",
"AppInstanceGroupId": "aig-bp1example****",
"AuthCode": "e4e169bea1cc48e8afac53**********",
"UserId": "__vhd_builder__",
"RegionId": "cn-hangzhou",
"ProductType": "ImageBuilder",
"AppVersionId": "apv-bp1example****",
"AccessType": "INTERNET"
},
"Success": false,
"Code": "InternalError",
"Message": "Internal error.",
"RequestId": "01A1A962-5503-107B-AC8F-EBA85DF905AC"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InternalError | Internal error. | An internal error occurred. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.