public static final class ApplyTokenRequest.Builder extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
ApplyTokenRequest.Builder |
actions(String actions)
The permission type of the token.
|
ApplyTokenRequest |
build() |
ApplyTokenRequest.Builder |
expireTime(Long expireTime)
The timestamp that indicates the point in time when the token expires.
|
ApplyTokenRequest.Builder |
instanceId(String instanceId)
The ID of the ApsaraMQ for MQTT instance.
|
ApplyTokenRequest.Builder |
regionId(String regionId)
This parameter is required.
|
ApplyTokenRequest.Builder |
resources(String resources)
The topics on the ApsaraMQ for MQTT instance.
|
public ApplyTokenRequest.Builder regionId(String regionId)
This parameter is required.
public ApplyTokenRequest.Builder actions(String actions)
The permission type of the token. Valid values:
This parameter is required.
example:R
public ApplyTokenRequest.Builder expireTime(Long expireTime)
The timestamp that indicates the point in time when the token expires. Unit: milliseconds. The minimum validity period of a token is 60 seconds, and the maximum validity period of a token is 30 days. If you specify a validity period of more than 30 days for a token, no errors are returned. However, the token is valid only for 30 days.
For example, you want to specify a validity period of 60 seconds for a token. If the current system timestamp is 1609434061000, you must set this parameter to 1609434121000. The value is calculated by using the following formula: 1609434061000 + 60 x 1000 = 1609434121000.
This parameter is required.
example:1609434121000
public ApplyTokenRequest.Builder instanceId(String instanceId)
The ID of the ApsaraMQ for MQTT instance. The ID must be consistent with the ID of the instance that the ApsaraMQ for MQTT client uses. You can obtain the instance ID on the Instance Details page that corresponds to the instance in the ApsaraMQ for MQTT console.
This parameter is required.
example:post-cn-0pp12gl****
public ApplyTokenRequest.Builder resources(String resources)
The topics on the ApsaraMQ for MQTT instance. Separate multiple topics with commas (,). Each token can be used to access up to 100 topics. Multiple topics are sorted in alphabetic order. MQTT wildcards, including single-level wildcards represented by plus signs (+) and multi-level wildcards represented by number signs (#), can be used for the Resources parameter that you register to apply for a token.
For example, if you set the Resources parameter to Topic1/+ when you apply for a token, the ApsaraMQ for MQTT client can manage the topics in Topic1/xxx. If you set the Resources parameter to Topic1/# when you apply for a token, the ApsaraMQ for MQTT client can manage topics of any level in Topic1/xxx/xxx/xxx.
ApsaraMQ for MQTT supports subtopics. You can specify subtopics in the code for messaging instead of configuring them in the ApsaraMQ for MQTT console. Forward slashes (/) are used to separate topics of different levels. For more information, see Terms.
This parameter is required.
example:TopicA/+
public ApplyTokenRequest build()
Copyright © 2025. All rights reserved.