GetServiceLastAccessedDetails

Updated at:

Queries the details of a permission audit report based on the job ID returned by the GenerateServiceLastAccessedDetails operation. The report includes the services accessible to Resource Access Management (RAM) entities and the time of the last access attempt to each service.

Operation description

Before you use the permission audit feature to change the permissions of a RAM identity, read Usage notes for the permission audit overview.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ram:GetServiceLastAccessedDetails

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Marker

string

No

The token used to query the next page of results. The Marker parameter is not required for the first API call.

When you call the API for the first time, if the total number of returned entries exceeds the MaxItems limit, the data is truncated. Only MaxItems entries are returned, the IsTruncated parameter is set to true, and a Marker value is returned. You can use the returned Marker value to continue calling the API with other request parameters unchanged to query the truncated data. You can repeat this process until IsTruncated is set to false, which indicates that all data has been queried.

CgxMaXN0UmFtVXNlcnMSEDExNzkxNDgwMzgyMTQyNTUaATIgZA==

MaxItems

integer

No

The maximum number of entries per page.

Valid values: 1 to 100.

Default value: 50.

50

JobId

string

Yes

The ID of the permission audit task, which is generated by the GenerateServiceLastAccessedDetails operation.

ba536aab-84c6-43af-8bcb-aa2cae2a34eb

Used to query the task result after a task is generated by GenerateServiceLastAccessedDetails.

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The ID of the request.

697852FB-50D7-44D9-9774-530C31EAC572

Marker

string

This parameter is returned only when IsTruncated is set to true. If true is returned, you must continue calling this operation and use the Marker value to obtain the truncated content.

CgxMaXN0UmFtVXNlcnMSEDE5OTQ5NTMxMDYwOTAzNzkaAjQ0IGQ=

IsTruncated

boolean

Indicates whether the returned result is truncated. Valid values:

  • true

  • false

Valid values:

  • true :

    true

  • false :

    false

true

JobCompletionTime

string

The time when the task was completed.

2024-06-08T02:24:48Z

JobCreationTime

string

The time when the task was created.

2024-06-08T02:20:47Z

JobStatus

string

The status of the task. Valid values:

  • IN_PROGRESS: The task is being processed.

  • COMPLETED: The task is completed.

  • FAILED: The task failed.

COMPLETED

JobType

string

The granularity of the permission audit report. Valid values:

  • SERVICE_LEVEL: Analyzes the recent access information at the RAM code granularity for cloud services supported by permission audit.

  • ACTION_LEVEL: Analyzes the recent access information at the RAM action granularity for action-level cloud services supported by permission audit.

Valid values:

  • ACTION_LEVEL :

    ACTION_LEVEL

  • SERVICE_LEVEL :

    SERVICE_LEVEL

SERVICE_LEVEL

JobError

object

The error message returned when the task fails. This parameter is not returned when the task is completed.

Message

string

The error message.

InternalError

Code

string

The error code.

InternalError

ServicesLastAccessed

array<object>

The list of last access information for cloud services. This list is empty if the RAM identity does not have access permissions for any cloud service.

array<object>

RAMCode

string

The RAM code of the cloud service.

ecs

ServiceCodes

array

The list of cloud service codes.

string

The cloud service code.

ECS

LastAuthenticated

string

The time when the analyzed RAM identity last attempted to access the service.

2024-01-29T07:48:35Z

LastAuthenticatedEntity

string

The ARN of the analyzed RAM identity.

acs:ram::123459***:role/TestRole

TotalAuthenticatedEntities

integer

The number of identities that attempted to access the service.

1

TrackedActionsLastAccessed

array<object>

The list of action-level access information. This information is returned when the granularity of the created permission audit task is ACTION_LEVEL.

object

ActionName

string

The name of the action.

ram:CreateAccessKey

ServiceCodes

array

The list of cloud service codes.

string

The cloud service code.

ECS

LastAccessedTime

string

The time when the analyzed RAM identity last attempted to perform the action.

2024-01-29T07:48:35Z

LastAccessedEntity

string

The ARN of the analyzed RAM identity.

acs:ram::123459***:role/TestRole

GrantPolicies

array<object>

The list of access policies that grant permission to access the cloud service.

object

PolicyName

string

The name of the access policy.

AdministratorAccess

PolicyType

string

The type of the access policy. Valid values:

  • System: system policy

  • Custom: custom policy

Valid values:

  • Custom :

    Custom

  • System :

    System

System

AttachedScope

string

The authorization scope of the access policy. Valid values:

  • Account ID (format: 123459***): account-level authorization

  • Resource group ID (format: rg-123***): resource group-level authorization

Valid values:

  • 123459*** :

    123459***

  • rg-aek2f*** :

    rg-aek2f***

123459***

AttachedEntity

string

The ARN of the entity to which the access policy grants permission. Valid values:

  • Resource Access Management (RAM) user: acs:ram::<account_id>:user/<user_name>

  • RAM role: acs:ram::<account_id>:role/<role_name>

  • RAM user group: acs:ram::<account_id>:group/<group_name>

acs:ram::123459***:role/TestRole

Examples

Success response

JSON format

{
  "RequestId": "697852FB-50D7-44D9-9774-530C31EAC572",
  "Marker": "CgxMaXN0UmFtVXNlcnMSEDE5OTQ5NTMxMDYwOTAzNzkaAjQ0IGQ=",
  "IsTruncated": true,
  "JobCompletionTime": "2024-06-08T02:24:48Z",
  "JobCreationTime": "2024-06-08T02:20:47Z",
  "JobStatus": "COMPLETED",
  "JobType": "SERVICE_LEVEL",
  "JobError": {
    "Message": "InternalError",
    "Code": "InternalError"
  },
  "ServicesLastAccessed": [
    {
      "RAMCode": "ecs",
      "ServiceCodes": [
        "ECS"
      ],
      "LastAuthenticated": "2024-01-29T07:48:35Z",
      "LastAuthenticatedEntity": "acs:ram::123459***:role/TestRole",
      "TotalAuthenticatedEntities": 1,
      "TrackedActionsLastAccessed": [
        {
          "ActionName": "ram:CreateAccessKey",
          "ServiceCodes": [
            "ECS"
          ],
          "LastAccessedTime": "2024-01-29T07:48:35Z",
          "LastAccessedEntity": "acs:ram::123459***:role/TestRole"
        }
      ],
      "GrantPolicies": [
        {
          "PolicyName": "AdministratorAccess",
          "PolicyType": "System",
          "AttachedScope": "123459***",
          "AttachedEntity": "acs:ram::123459***:role/TestRole"
        }
      ]
    }
  ]
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter.Marker Marker is invalid. The Marker parameter is invalid. may be due to expired, or invalid
400 NoSuchEntity.Job No such job. No corresponding task
400 NotSupport.Account.Site This site not support the account. This site does not support this account.
500 InternalError Internal Error.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.