Table of Contents
A low-level client representing Amazon Prometheus Service
Amazon Managed Service for Prometheus
client = session.create_client('amp')
These are the available methods:
Check if an operation can be paginated.
Creates a new AMP workspace.
See also: AWS API Documentation
Request Syntax
response = client.create_workspace(
alias='string',
clientToken='string'
)
Optional, unique, case-sensitive, user-provided identifier to ensure the idempotency of the request.
This field is autopopulated if not provided.
dict
Response Syntax
{
'arn': 'string',
'status': {
'statusCode': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATION_FAILED'
},
'workspaceId': 'string'
}
Response Structure
(dict) --
Represents the output of a CreateWorkspace operation.
arn (string) --
The ARN of the workspace that was just created.
status (dict) --
The status of the workspace that was just created (usually CREATING).
statusCode (string) --
Status code of this workspace.
workspaceId (string) --
The generated ID of the workspace that was just created.
Exceptions
Deletes an AMP workspace.
See also: AWS API Documentation
Request Syntax
response = client.delete_workspace(
clientToken='string',
workspaceId='string'
)
Optional, unique, case-sensitive, user-provided identifier to ensure the idempotency of the request.
This field is autopopulated if not provided.
[REQUIRED]
The ID of the workspace to delete.
None
Exceptions
Describes an existing AMP workspace.
See also: AWS API Documentation
Request Syntax
response = client.describe_workspace(
workspaceId='string'
)
[REQUIRED]
The ID of the workspace to describe.
{
'workspace': {
'alias': 'string',
'arn': 'string',
'createdAt': datetime(2015, 1, 1),
'prometheusEndpoint': 'string',
'status': {
'statusCode': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATION_FAILED'
},
'workspaceId': 'string'
}
}
Response Structure
Represents the output of a DescribeWorkspace operation.
The properties of the selected workspace.
Alias of this workspace.
The Amazon Resource Name (ARN) of this workspace.
The time when the workspace was created.
Prometheus endpoint URI.
The status of this workspace.
Status code of this workspace.
Unique string identifying this workspace.
Exceptions
Generate a presigned url given a client, its method, and arguments
The presigned url
Create a paginator for an operation.
Returns an object that can wait for some condition.
Lists all AMP workspaces, including workspaces being created or deleted.
See also: AWS API Documentation
Request Syntax
response = client.list_workspaces(
alias='string',
maxResults=123,
nextToken='string'
)
dict
Response Syntax
{
'nextToken': 'string',
'workspaces': [
{
'alias': 'string',
'arn': 'string',
'createdAt': datetime(2015, 1, 1),
'status': {
'statusCode': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATION_FAILED'
},
'workspaceId': 'string'
},
]
}
Response Structure
(dict) --
Represents the output of a ListWorkspaces operation.
nextToken (string) --
Pagination token to use when requesting the next page in this list.
workspaces (list) --
The list of existing workspaces, including those undergoing creation or deletion.
(dict) --
Represents a summary of the properties of a workspace.
alias (string) --
Alias of this workspace.
arn (string) --
The AmazonResourceName of this workspace.
createdAt (datetime) --
The time when the workspace was created.
status (dict) --
The status of this workspace.
statusCode (string) --
Status code of this workspace.
workspaceId (string) --
Unique string identifying this workspace.
Exceptions
Updates an AMP workspace alias.
See also: AWS API Documentation
Request Syntax
response = client.update_workspace_alias(
alias='string',
clientToken='string',
workspaceId='string'
)
Optional, unique, case-sensitive, user-provided identifier to ensure the idempotency of the request.
This field is autopopulated if not provided.
[REQUIRED]
The ID of the workspace being updated.
None
Exceptions
Client exceptions are available on a client instance via the exceptions property. For more detailed instructions and examples on the exact usage of client exceptions, see the error handling user guide.
The available client exceptions are:
User does not have sufficient access to perform this action.
Example
try:
...
except client.exceptions.AccessDeniedException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
User does not have sufficient access to perform this action.
message (string) --
Description of the error.
Error (dict) -- Normalized access to common exception attributes.
Updating or deleting a resource can cause an inconsistent state.
Example
try:
...
except client.exceptions.ConflictException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'resourceId': 'string',
'resourceType': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Updating or deleting a resource can cause an inconsistent state.
message (string) --
Description of the error.
resourceId (string) --
Identifier of the resource affected.
resourceType (string) --
Type of the resource affected.
Error (dict) -- Normalized access to common exception attributes.
Unexpected error during processing of request.
Example
try:
...
except client.exceptions.InternalServerException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'retryAfterSeconds': 123,
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Unexpected error during processing of request.
message (string) --
Description of the error.
retryAfterSeconds (integer) --
Advice to clients on when the call can be safely retried.
Error (dict) -- Normalized access to common exception attributes.
Request references a resource which does not exist.
Example
try:
...
except client.exceptions.ResourceNotFoundException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'resourceId': 'string',
'resourceType': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Request references a resource which does not exist.
message (string) --
Description of the error.
resourceId (string) --
Identifier of the resource affected.
resourceType (string) --
Type of the resource affected.
Error (dict) -- Normalized access to common exception attributes.
Request would cause a service quota to be exceeded.
Example
try:
...
except client.exceptions.ServiceQuotaExceededException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'quotaCode': 'string',
'resourceId': 'string',
'resourceType': 'string',
'serviceCode': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Request would cause a service quota to be exceeded.
message (string) --
Description of the error.
quotaCode (string) --
Service Quotas requirement to identify originating quota.
resourceId (string) --
Identifier of the resource affected.
resourceType (string) --
Type of the resource affected.
serviceCode (string) --
Service Quotas requirement to identify originating service.
Error (dict) -- Normalized access to common exception attributes.
Request was denied due to request throttling.
Example
try:
...
except client.exceptions.ThrottlingException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'quotaCode': 'string',
'retryAfterSeconds': 123,
'serviceCode': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Request was denied due to request throttling.
message (string) --
Description of the error.
quotaCode (string) --
Service Quotas requirement to identify originating quota.
retryAfterSeconds (integer) --
Advice to clients on when the call can be safely retried.
serviceCode (string) --
Service Quotas requirement to identify originating service.
Error (dict) -- Normalized access to common exception attributes.
The input fails to satisfy the constraints specified by an AWS service.
Example
try:
...
except client.exceptions.ValidationException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'fieldList': [
{
'message': 'string',
'name': 'string'
},
],
'message': 'string',
'reason': 'UNKNOWN_OPERATION'|'CANNOT_PARSE'|'FIELD_VALIDATION_FAILED'|'OTHER',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
The input fails to satisfy the constraints specified by an AWS service.
fieldList (list) --
The field that caused the error, if applicable. If more than one field caused the error, pick one and elaborate in the message.
(dict) --
Stores information about a field passed inside a request that resulted in an exception.
message (string) --
Message describing why the field failed validation.
name (string) --
The field name.
message (string) --
Description of the error.
reason (string) --
Reason the request failed validation.
Error (dict) -- Normalized access to common exception attributes.
The available paginators are:
paginator = client.get_paginator('list_workspaces')
Creates an iterator that will paginate through responses from PrometheusService.Client.list_workspaces().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
alias='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'workspaces': [
{
'alias': 'string',
'arn': 'string',
'createdAt': datetime(2015, 1, 1),
'status': {
'statusCode': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATION_FAILED'
},
'workspaceId': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
Represents the output of a ListWorkspaces operation.
workspaces (list) --
The list of existing workspaces, including those undergoing creation or deletion.
(dict) --
Represents a summary of the properties of a workspace.
alias (string) --
Alias of this workspace.
arn (string) --
The AmazonResourceName of this workspace.
createdAt (datetime) --
The time when the workspace was created.
status (dict) --
The status of this workspace.
statusCode (string) --
Status code of this workspace.
workspaceId (string) --
Unique string identifying this workspace.
NextToken (string) --
A token to resume pagination.