public class TaskRouterCapability extends CapabilityToken
CapabilityToken.DomainException
Constructor and Description |
---|
TaskRouterCapability(String accountSid,
String authToken,
String workspaceSid,
String channelId)
Create a new Capability object to authorize clients to interact with the
TaskRouter service.
|
Modifier and Type | Method and Description |
---|---|
TaskRouterCapability |
addPolicy(Policy policy) |
void |
addPolicy(String url,
String method,
Map<String,FilterRequirement> queryFilter,
Map<String,FilterRequirement> postFilter,
boolean allow)
Add policy to list of access policies.
|
void |
allow(String url,
String method,
Map<String,FilterRequirement> queryFilter,
Map<String,FilterRequirement> postFilter)
Add Allow access policy.
|
void |
allowDelete()
Allow deletion of the defined resource.
|
void |
allowDeleteSubresources()
Allow deletion of any subresources of the defined resource.
|
void |
allowFetchSubresources()
Allow fetching all subresources of the defined resource.
|
void |
allowTaskReservationUpdates()
Deprecated.
Please use
{TaskRouterWorkerCapability.allowReservationUpdates} instead
|
void |
allowUpdates()
Allow updating attributes of the defined resource.
|
void |
allowUpdatesSubresources()
Allow updating attributes of all subresources of the defined resource.
|
void |
allowWorkerActivityUpdates()
Deprecated.
Please use {TaskRouterWorkerCapability.allowActivityUpdates}
instead
|
void |
allowWorkerFetchAttributes()
Deprecated.
Please use {TaskRouterWorkerCapability} instead; added
automatically in constructor
|
void |
deny(String url,
String method,
Map<String,FilterRequirement> queryFilter,
Map<String,FilterRequirement> postFilter)
Add Deny access policy.
|
String |
generateToken()
Generate a capability token with the currently-configured policies on
this object.
|
String |
generateToken(long ttl)
Generate a capability token with the currently-configured policies on
this object.
|
public TaskRouterCapability(String accountSid, String authToken, String workspaceSid, String channelId)
accountSid
- Account to authorize actions forauthToken
- Auth token for the account. Used to sign tokens and will not
be included in the generated tokens.workspaceSid
- Workspace to authorize tokens for.channelId
- Authorized Channelpublic void allowFetchSubresources()
public void allowUpdates()
public void allowUpdatesSubresources()
public void allowDelete()
public void allowDeleteSubresources()
@Deprecated public void allowWorkerActivityUpdates()
UnsupportedOperationException
- if cannot apply policy@Deprecated public void allowWorkerFetchAttributes()
UnsupportedOperationException
- if cannot apply policy@Deprecated public void allowTaskReservationUpdates()
UnsupportedOperationException
- if cannot apply policypublic TaskRouterCapability addPolicy(Policy policy)
public void addPolicy(String url, String method, Map<String,FilterRequirement> queryFilter, Map<String,FilterRequirement> postFilter, boolean allow)
url
- url of the resourcemethod
- method to the resourcequeryFilter
- query filter parameterspostFilter
- post filter parametersallow
- whether or not to allow access on this policypublic void allow(String url, String method, Map<String,FilterRequirement> queryFilter, Map<String,FilterRequirement> postFilter)
url
- url of the resourcemethod
- method to the resourcequeryFilter
- query filter parameterspostFilter
- post filter parameterspublic void deny(String url, String method, Map<String,FilterRequirement> queryFilter, Map<String,FilterRequirement> postFilter)
url
- url of the resourcemethod
- method to the resourcequeryFilter
- query filter parameterspostFilter
- post filter parameterspublic String generateToken() throws CapabilityToken.DomainException
DomainException
- if unable to generate tokenCapabilityToken.DomainException
public String generateToken(long ttl) throws CapabilityToken.DomainException
ttl
- Expiration time in secondsDomainException
- if unable to generate tokenCapabilityToken.DomainException
Copyright © 2011 Twilio, Inc. All Rights Reserved.