public final class Resource
extends java.lang.Object
| Constructor and Description |
|---|
Resource(PAMService service,
APIRequestHandler rest) |
| Modifier and Type | Method and Description |
|---|---|
CreateResourceDetails |
createResource(ResourceModel resourceModel)
Create a new resource with provided attributes
|
boolean |
deleteResource(long resourceId)
Delete the Resource using resource id
|
boolean |
deleteResource(java.lang.String resourceName)
Delete the Resource using resource name
|
org.json.JSONObject |
downloadFile(java.lang.String resourceName,
java.lang.String accountName,
java.lang.String reason)
To get contents of files, keys, certificates, etc.
|
org.json.JSONObject |
downloadFile(java.lang.String resourceName,
java.lang.String accountName,
java.lang.String reason,
boolean isCustomField,
sdkEnumConstants.CustomFieldType customFieldType,
java.lang.String customFieldLabel)
To get contents of files, keys, certificates, etc.
|
org.json.JSONObject |
downloadFile(java.lang.String resourceName,
java.lang.String accountName,
java.lang.String reason,
long ticketId)
To get contents of files, keys, certificates, etc.
|
org.json.JSONObject |
downloadFile(java.lang.String resourceName,
java.lang.String accountName,
java.lang.String reason,
long ticketId,
boolean isCustomField,
sdkEnumConstants.CustomFieldType customFieldType,
java.lang.String customFieldLabel)
To get contents of files, keys, certificates, etc.
|
boolean |
editResource(java.lang.String resourceName,
ResourceModel resourceModel)
Edit already existing resource
|
java.util.List<AccountOfResource> |
getAccounts(long resourceId)
Get the accounts that are part of a resource using resource id
|
java.util.List<AccountOfResource> |
getAccounts(java.lang.String resourceName)
Get the accounts that belongs to the resource using resource name
|
org.json.JSONObject |
getAllResourceTypes(org.json.JSONArray resTypeNames)
To list all the resource types in the organization.
|
org.json.JSONObject |
getassociatedResourceGroups(java.lang.String resourceName)
get resource group names of the particular resource associated
|
ResourceAccountID |
getResourceAndAccountID(java.lang.String resourceName,
java.lang.String accountName)
Get the unique ID of the resource and account
|
long |
getResourceID(java.lang.String resourceName)
Get the unique ID of the resource
|
java.util.List<ResourceDetails> |
getSharedResources()
To get the list of resources which are owned by or shared to the user.
|
boolean |
shareResourceToUsergroup(java.lang.String resourceName,
sdkEnumConstants.AccessPermission accessPermission,
java.lang.String usergroupName)
share a resource to usergroup
|
boolean |
sharerResourceToUser(java.lang.String resourceName,
java.lang.String userName,
sdkEnumConstants.AccessPermission accessPermission)
Share a resource to an user using resource and user name
|
public Resource(PAMService service, APIRequestHandler rest) throws SDKRegistrationException
SDKRegistrationExceptionpublic java.util.List<ResourceDetails> getSharedResources() throws SDKConnectionException, SDKOperationFailedException
ResourceDetails objects containing resource detailsSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messagepublic java.util.List<AccountOfResource> getAccounts(long resourceId) throws SDKConnectionException, SDKOperationFailedException, SDKInvalidArgumentException
resourceId - mandatory,a non negative ID of the resource whose accounts are to be fetchedAccountOfResource instances containing details of accounts under the resourceSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic java.util.List<AccountOfResource> getAccounts(java.lang.String resourceName) throws SDKConnectionException, SDKOperationFailedException, SDKInvalidArgumentException
resourceName - mandatory,a non null and non empty name of the resource whose accounts are to be fetchedAccountOfResource instances containing details of accounts under the resourceSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic CreateResourceDetails createResource(ResourceModel resourceModel) throws SDKConnectionException, SDKOperationFailedException, SDKInvalidArgumentException
resourceModel - mandatory,instance of ResourceModel with all necessary field setSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic boolean editResource(java.lang.String resourceName,
ResourceModel resourceModel)
throws SDKConnectionException,
SDKOperationFailedException,
SDKInvalidArgumentException
resourceName - mandatory, non negative ID of the resource to editresourceModel - mandatory,instance of ResourceModel with necessary field set.The field resourceName is mandatory and has to be set before passing resource model to this function
SDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic ResourceAccountID getResourceAndAccountID(java.lang.String resourceName, java.lang.String accountName) throws SDKConnectionException, SDKOperationFailedException, SDKInvalidArgumentException
resourceName - mandatory, non null, non empty name of the resourceaccountName - mandatory, non null, non empty name of the account under the resourceResourceAccountID containing resource and account idSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic long getResourceID(java.lang.String resourceName)
throws SDKConnectionException,
SDKOperationFailedException,
SDKInvalidArgumentException
resourceName - mandatory, non null, non empty name of the resourceSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic boolean deleteResource(long resourceId)
throws SDKConnectionException,
SDKOperationFailedException,
SDKInvalidArgumentException
resourceId - mandatory, non negative ID of the resourceSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic boolean deleteResource(java.lang.String resourceName)
throws SDKConnectionException,
SDKOperationFailedException,
SDKInvalidArgumentException
resourceName - mandatory, non null, non empty name of the resourceSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic boolean sharerResourceToUser(java.lang.String resourceName,
java.lang.String userName,
sdkEnumConstants.AccessPermission accessPermission)
throws SDKConnectionException,
SDKOperationFailedException,
SDKInvalidArgumentException
resourceName - mandatory, non null, non empty name of resource to be shareduserName - mandatory, non null, non empty name of user to whom resource is to be sharedaccessPermission - mandatory non null sdkEnumConstants.AccessPermission, accessLevel to be provided to the user over the resourceSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic org.json.JSONObject getassociatedResourceGroups(java.lang.String resourceName)
throws SDKInvalidArgumentException,
SDKConnectionException,
SDKOperationFailedException
resourceName - mandatory,not null name of the resource.SDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic boolean shareResourceToUsergroup(java.lang.String resourceName,
sdkEnumConstants.AccessPermission accessPermission,
java.lang.String usergroupName)
throws SDKConnectionException,
SDKOperationFailedException,
SDKInvalidArgumentException
resourceName - mandatory,not null name of the resource to be sharedaccessPermission - mandatory,type of accesspermissionusergroupName - mandatory,not null name of the usergroup to which the resource have to be sharedSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic org.json.JSONObject getAllResourceTypes(org.json.JSONArray resTypeNames)
throws SDKInvalidArgumentException,
SDKConnectionException,
SDKOperationFailedException
resTypeNames - mandatory,not null list of resource type namesSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic org.json.JSONObject downloadFile(java.lang.String resourceName,
java.lang.String accountName,
java.lang.String reason)
throws SDKInvalidArgumentException,
SDKConnectionException,
SDKOperationFailedException
resourceName - mandatory,not null name of the resourceaccountName - mandatory,not null name of the accountreason - optional,reason,if any specific reason is availableSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic org.json.JSONObject downloadFile(java.lang.String resourceName,
java.lang.String accountName,
java.lang.String reason,
long ticketId)
throws SDKInvalidArgumentException,
SDKConnectionException,
SDKOperationFailedException
resourceName - mandatory,not null name of the resourceaccountName - mandatory,not null name of the accountreason - optional,reason,if any specific reason is availableticketId - mandatory,not negative ticketid,if ticketing system is enabledSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic org.json.JSONObject downloadFile(java.lang.String resourceName,
java.lang.String accountName,
java.lang.String reason,
boolean isCustomField,
sdkEnumConstants.CustomFieldType customFieldType,
java.lang.String customFieldLabel)
throws SDKInvalidArgumentException,
SDKConnectionException,
SDKOperationFailedException
resourceName - mandatory,not null name of the resourceaccountName - mandatory,not null name of the accountreason - optional,reason,if any specific reason is availableisCustomField - mandatory,boolean value wether customfield is present for the particular resourcecustomFieldType - mandatory,not null type of the customfield - resource/AccountcustomFieldLabel - mandatory,not null name of the customfield labelSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedpublic org.json.JSONObject downloadFile(java.lang.String resourceName,
java.lang.String accountName,
java.lang.String reason,
long ticketId,
boolean isCustomField,
sdkEnumConstants.CustomFieldType customFieldType,
java.lang.String customFieldLabel)
throws SDKInvalidArgumentException,
SDKConnectionException,
SDKOperationFailedException
resourceName - mandatory,not null name of the resourceaccountName - mandatory,not null name of the accountreason - optional,reason,if any specific reason is availableticketId - mandatory,not negative ticketid,if ticketing system is enabledisCustomField - mandatory,boolean value wether customfield is present for the particular resourcecustomFieldType - mandatory,not null type of the customfield - resource/AccountcustomFieldLabel - mandatory,not null name of the customfield labelSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messageSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not provided