Access Resource Policy API
This service allows customers and administrators to restrict resources (project and player) read/write access for gaming services.
Download OpenAPI specification:
Get a project based policy
A policy consists of multiple policy statements. This endpoint will return a Policy object containing an array of all non-expired policy statements in that policy.
Authorizations
Use any one of the following options.
ServiceAccount (unity.project_resource_policy.get)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: unity.project_resource_policy.get
or
Bearer
HTTP: Bearer
HTTP Authorization Scheme: bearer
Code samples for "Get a project based policy":
Request example
curl -X GET \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ -H "Authorization: Bearer <YOUR_TOKEN>" \ "https://services.api.unity.com/access/resource-policy/v1/projects/{projectId}/environments/{environmentId}/resource-policy"
Response example
{ "statements": [ { "Sid": "statement_id1", "Action": [ "string" ], "Effect": "string", "Principal": "string", "Resource": "urn:ugs:cloud-save:*", "ExpiresAt": "2020-07-20T18:30:51.243Z", "Version": "string" } ]}
Create or update a project based policy
Create or update a project based policy. A maximum of 500 non-expired statements per policy can be created/updated.
Authorizations
Use any one of the following options.
ServiceAccount (unity.project_resource_policy.update)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: unity.project_resource_policy.update
or
Bearer
HTTP: Bearer
HTTP Authorization Scheme: bearer
Code samples for "Create or update a project based policy":
Request example
curl -X PATCH \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ -H "Authorization: Bearer <YOUR_TOKEN>" \ -H "Content-Type: application/json" \ -d '{ "statements": [ { "Sid": "statement_id1", "Action": [ "string" ], "Effect": "string", "Principal": "string", "Resource": "urn:ugs:cloud-save:*", "ExpiresAt": "2020-07-20T18:30:51.243Z", "Version": "string" } ]}' \ "https://services.api.unity.com/access/resource-policy/v1/projects/{projectId}/environments/{environmentId}/resource-policy"
Response example
{ "title": "Bad Request", "status": 400, "detail": "Something is wrong", "details": [ { "code": "ERROR_CODE_123", "path": "nested.value", "message": "Invalid value" } ], "requestId": "aad109f8-033f-4a24-8b77-5032eb3a6158"}
Delete policy statement(s)
Delete policy statement(s) for project-based policy.
Authorizations
Use any one of the following options.
ServiceAccount (unity.project_resource_policy.delete)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: unity.project_resource_policy.delete
or
Bearer
HTTP: Bearer
HTTP Authorization Scheme: bearer
Code samples for "Delete policy statement(s)":
Request example
curl -X POST \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ -H "Authorization: Bearer <YOUR_TOKEN>" \ -H "Content-Type: application/json" \ -d '{ "statementIDs": [ "statementId1", "statementId2" ]}' \ "https://services.api.unity.com/access/resource-policy/v1/projects/{projectId}/environments/{environmentId}/resource-policy:delete-statements"
Response example
{ "title": "Bad Request", "status": 400, "detail": "Something is wrong", "details": [ { "code": "ERROR_CODE_123", "path": "nested.value", "message": "Invalid value" } ], "requestId": "aad109f8-033f-4a24-8b77-5032eb3a6158"}
Get a player based policy
A policy consists of multiple policy statements. This endpoint will return a Policy object containing an array of all non-expired policy statements in that policy.
Authorizations
Use any one of the following options.
ServiceAccount (unity.player_resource_policy.get)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: unity.player_resource_policy.get
or
Bearer
HTTP: Bearer
HTTP Authorization Scheme: bearer
Code samples for "Get a player based policy":
Request example
curl -X GET \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ -H "Authorization: Bearer <YOUR_TOKEN>" \ "https://services.api.unity.com/access/resource-policy/v1/projects/{projectId}/environments/{environmentId}/players/{playerId}/resource-policy"
Response example
{ "playerId": "HgIZuzj0MwDwPO062o0BSVxAcFAV", "statements": [ { "Sid": "statement_id1", "Action": [ "string" ], "Effect": "string", "Principal": "string", "Resource": "urn:ugs:cloud-save:*", "ExpiresAt": "2020-07-20T18:30:51.243Z", "Version": "string" } ]}
Create or update a player based policy
Create or update a player based policy. A maximum of 500 non-expired statements per policy can be created/updated.
Authorizations
Use any one of the following options.
ServiceAccount (unity.player_resource_policy.update)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: unity.player_resource_policy.update
or
Bearer
HTTP: Bearer
HTTP Authorization Scheme: bearer
Code samples for "Create or update a player based policy":
Request example
curl -X PATCH \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ -H "Authorization: Bearer <YOUR_TOKEN>" \ -H "Content-Type: application/json" \ -d '{ "statements": [ { "Sid": "statement_id1", "Action": [ "string" ], "Effect": "string", "Principal": "string", "Resource": "urn:ugs:cloud-save:*", "ExpiresAt": "2020-07-20T18:30:51.243Z", "Version": "string" } ]}' \ "https://services.api.unity.com/access/resource-policy/v1/projects/{projectId}/environments/{environmentId}/players/{playerId}/resource-policy"
Response example
{ "title": "Bad Request", "status": 400, "detail": "Something is wrong", "details": [ { "code": "ERROR_CODE_123", "path": "nested.value", "message": "Invalid value" } ], "requestId": "aad109f8-033f-4a24-8b77-5032eb3a6158"}
Delete policy statement(s)
Delete policy statement(s) for player-based policy.
Authorizations
Use any one of the following options.
ServiceAccount (unity.player_resource_policy.delete)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: unity.player_resource_policy.delete
or
Bearer
HTTP: Bearer
HTTP Authorization Scheme: bearer
Code samples for "Delete policy statement(s)":
Request example
curl -X POST \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ -H "Authorization: Bearer <YOUR_TOKEN>" \ -H "Content-Type: application/json" \ -d '{ "statementIDs": [ "statementId1", "statementId2" ]}' \ "https://services.api.unity.com/access/resource-policy/v1/projects/{projectId}/environments/{environmentId}/players/{playerId}/resource-policy:delete-statements"
Response example
{ "title": "Bad Request", "status": 400, "detail": "Something is wrong", "details": [ { "code": "ERROR_CODE_123", "path": "nested.value", "message": "Invalid value" } ], "requestId": "aad109f8-033f-4a24-8b77-5032eb3a6158"}
Get all player based policies in project
This endpoint returns all player based policies which belong to a specific project and environment.
By default, the API returns 5 results per page. The number of results per page can be customized by including the limit query parameter in the request. To retrieve subsequent pages of results, pass the next query parameter, the value of which will be provided in the response body of the first paginated response.
Authorizations
Use any one of the following options.
ServiceAccount (unity.player_resource_policy.get)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: unity.player_resource_policy.get
or
Bearer
HTTP: Bearer
HTTP Authorization Scheme: bearer
Code samples for "Get all player based policies in project":
Request example
curl -X GET \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ -H "Authorization: Bearer <YOUR_TOKEN>" \ "https://services.api.unity.com/access/resource-policy/v1/projects/{projectId}/environments/{environmentId}/players/resource-policy"
Response example
{ "next": "eyJuZXh0IjoiNTliZDIwYjItMWE5My00Y2YxLWJhZWYtYWY3ZTJiNThmZGY2IiwibGltaXQiOjN9", "results": [ { "playerId": "HgIZuzj0MwDwPO062o0BSVxAcFAV", "statements": [ { "Sid": "statement_id1", "Action": [ null ], "Effect": "string", "Principal": "string", "Resource": "urn:ugs:cloud-save:*", "ExpiresAt": "2020-07-20T18:30:51.243Z", "Version": "string" } ] } ]}