Class: Aws::PrometheusService::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::PrometheusService::Client
- Includes:
- ClientStubs
- Defined in:
- gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb
Overview
An API client for PrometheusService. To construct a client, you need to configure a :region
and :credentials
.
client = Aws::PrometheusService::Client.new(
region: region_name,
credentials: credentials,
# ...
)
For details on configuring region and credentials see the developer guide.
See #initialize for a full list of supported configuration options.
Instance Attribute Summary
Attributes inherited from Seahorse::Client::Base
API Operations collapse
-
#create_alert_manager_definition(params = {}) ⇒ Types::CreateAlertManagerDefinitionResponse
The
CreateAlertManagerDefinition
operation creates the alert manager definition in a workspace. -
#create_logging_configuration(params = {}) ⇒ Types::CreateLoggingConfigurationResponse
The
CreateLoggingConfiguration
operation creates a logging configuration for the workspace. -
#create_rule_groups_namespace(params = {}) ⇒ Types::CreateRuleGroupsNamespaceResponse
The
CreateRuleGroupsNamespace
operation creates a rule groups namespace within a workspace. -
#create_scraper(params = {}) ⇒ Types::CreateScraperResponse
The
CreateScraper
operation creates a scraper to collect metrics. -
#create_workspace(params = {}) ⇒ Types::CreateWorkspaceResponse
Creates a Prometheus workspace.
-
#delete_alert_manager_definition(params = {}) ⇒ Struct
Deletes the alert manager definition from a workspace.
-
#delete_logging_configuration(params = {}) ⇒ Struct
Deletes the logging configuration for a workspace.
-
#delete_rule_groups_namespace(params = {}) ⇒ Struct
Deletes one rule groups namespace and its associated rule groups definition.
-
#delete_scraper(params = {}) ⇒ Types::DeleteScraperResponse
The
DeleteScraper
operation deletes one scraper, and stops any metrics collection that the scraper performs. -
#delete_workspace(params = {}) ⇒ Struct
Deletes an existing workspace.
-
#describe_alert_manager_definition(params = {}) ⇒ Types::DescribeAlertManagerDefinitionResponse
Retrieves the full information about the alert manager definition for a workspace.
-
#describe_logging_configuration(params = {}) ⇒ Types::DescribeLoggingConfigurationResponse
Returns complete information about the current logging configuration of the workspace.
-
#describe_rule_groups_namespace(params = {}) ⇒ Types::DescribeRuleGroupsNamespaceResponse
Returns complete information about one rule groups namespace.
-
#describe_scraper(params = {}) ⇒ Types::DescribeScraperResponse
The
DescribeScraper
operation displays information about an existing scraper. -
#describe_workspace(params = {}) ⇒ Types::DescribeWorkspaceResponse
Returns information about an existing workspace.
-
#get_default_scraper_configuration(params = {}) ⇒ Types::GetDefaultScraperConfigurationResponse
The
GetDefaultScraperConfiguration
operation returns the default scraper configuration used when Amazon EKS creates a scraper for you. -
#list_rule_groups_namespaces(params = {}) ⇒ Types::ListRuleGroupsNamespacesResponse
Returns a list of rule groups namespaces in a workspace.
-
#list_scrapers(params = {}) ⇒ Types::ListScrapersResponse
The
ListScrapers
operation lists all of the scrapers in your account. -
#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceResponse
The
ListTagsForResource
operation returns the tags that are associated with an Amazon Managed Service for Prometheus resource. -
#list_workspaces(params = {}) ⇒ Types::ListWorkspacesResponse
Lists all of the Amazon Managed Service for Prometheus workspaces in your account.
-
#put_alert_manager_definition(params = {}) ⇒ Types::PutAlertManagerDefinitionResponse
Updates an existing alert manager definition in a workspace.
-
#put_rule_groups_namespace(params = {}) ⇒ Types::PutRuleGroupsNamespaceResponse
Updates an existing rule groups namespace within a workspace.
-
#tag_resource(params = {}) ⇒ Struct
The
TagResource
operation associates tags with an Amazon Managed Service for Prometheus resource. -
#untag_resource(params = {}) ⇒ Struct
Removes the specified tags from an Amazon Managed Service for Prometheus resource.
-
#update_logging_configuration(params = {}) ⇒ Types::UpdateLoggingConfigurationResponse
Updates the log group ARN or the workspace ID of the current logging configuration.
-
#update_workspace_alias(params = {}) ⇒ Struct
Updates the alias of an existing workspace.
Instance Method Summary collapse
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
-
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
Methods included from ClientStubs
#api_requests, #stub_data, #stub_responses
Methods inherited from Seahorse::Client::Base
add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
385 386 387 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 385 def initialize(*args) super end |
Instance Method Details
#create_alert_manager_definition(params = {}) ⇒ Types::CreateAlertManagerDefinitionResponse
The CreateAlertManagerDefinition
operation creates the alert manager
definition in a workspace. If a workspace already has an alert manager
definition, don't use this operation to update it. Instead, use
PutAlertManagerDefinition
.
438 439 440 441 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 438 def create_alert_manager_definition(params = {}, = {}) req = build_request(:create_alert_manager_definition, params) req.send_request() end |
#create_logging_configuration(params = {}) ⇒ Types::CreateLoggingConfigurationResponse
The CreateLoggingConfiguration
operation creates a logging
configuration for the workspace. Use this operation to set the
CloudWatch log group to which the logs will be published to.
482 483 484 485 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 482 def create_logging_configuration(params = {}, = {}) req = build_request(:create_logging_configuration, params) req.send_request() end |
#create_rule_groups_namespace(params = {}) ⇒ Types::CreateRuleGroupsNamespaceResponse
The CreateRuleGroupsNamespace
operation creates a rule groups
namespace within a workspace. A rule groups namespace is associated
with exactly one rules file. A workspace can have multiple rule groups
namespaces.
Use this operation only to create new rule groups namespaces. To
update an existing rule groups namespace, use
PutRuleGroupsNamespace
.
557 558 559 560 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 557 def create_rule_groups_namespace(params = {}, = {}) req = build_request(:create_rule_groups_namespace, params) req.send_request() end |
#create_scraper(params = {}) ⇒ Types::CreateScraperResponse
The CreateScraper
operation creates a scraper to collect metrics. A
scraper pulls metrics from Prometheus-compatible sources within an
Amazon EKS cluster, and sends them to your Amazon Managed Service for
Prometheus workspace. You can configure the scraper to control what
metrics are collected, and what transformations are applied prior to
sending them to your workspace.
If needed, an IAM role will be created for you that gives Amazon Managed Service for Prometheus access to the metrics in your cluster. For more information, see Using roles for scraping metrics from EKS in the Amazon Managed Service for Prometheus User Guide.
You cannot update a scraper. If you want to change the configuration of the scraper, create a new scraper and delete the old one.
The scrapeConfiguration
parameter contains the base64-encoded
version of the YAML configuration file.
664 665 666 667 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 664 def create_scraper(params = {}, = {}) req = build_request(:create_scraper, params) req.send_request() end |
#create_workspace(params = {}) ⇒ Types::CreateWorkspaceResponse
Creates a Prometheus workspace. A workspace is a logical space dedicated to the storage and querying of Prometheus metrics. You can have one or more workspaces in each Region in your account.
732 733 734 735 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 732 def create_workspace(params = {}, = {}) req = build_request(:create_workspace, params) req.send_request() end |
#delete_alert_manager_definition(params = {}) ⇒ Struct
Deletes the alert manager definition from a workspace.
762 763 764 765 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 762 def delete_alert_manager_definition(params = {}, = {}) req = build_request(:delete_alert_manager_definition, params) req.send_request() end |
#delete_logging_configuration(params = {}) ⇒ Struct
Deletes the logging configuration for a workspace.
793 794 795 796 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 793 def delete_logging_configuration(params = {}, = {}) req = build_request(:delete_logging_configuration, params) req.send_request() end |
#delete_rule_groups_namespace(params = {}) ⇒ Struct
Deletes one rule groups namespace and its associated rule groups definition.
829 830 831 832 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 829 def delete_rule_groups_namespace(params = {}, = {}) req = build_request(:delete_rule_groups_namespace, params) req.send_request() end |
#delete_scraper(params = {}) ⇒ Types::DeleteScraperResponse
The DeleteScraper
operation deletes one scraper, and stops any
metrics collection that the scraper performs.
868 869 870 871 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 868 def delete_scraper(params = {}, = {}) req = build_request(:delete_scraper, params) req.send_request() end |
#delete_workspace(params = {}) ⇒ Struct
Deletes an existing workspace.
904 905 906 907 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 904 def delete_workspace(params = {}, = {}) req = build_request(:delete_workspace, params) req.send_request() end |
#describe_alert_manager_definition(params = {}) ⇒ Types::DescribeAlertManagerDefinitionResponse
Retrieves the full information about the alert manager definition for a workspace.
937 938 939 940 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 937 def describe_alert_manager_definition(params = {}, = {}) req = build_request(:describe_alert_manager_definition, params) req.send_request() end |
#describe_logging_configuration(params = {}) ⇒ Types::DescribeLoggingConfigurationResponse
Returns complete information about the current logging configuration of the workspace.
971 972 973 974 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 971 def describe_logging_configuration(params = {}, = {}) req = build_request(:describe_logging_configuration, params) req.send_request() end |
#describe_rule_groups_namespace(params = {}) ⇒ Types::DescribeRuleGroupsNamespaceResponse
Returns complete information about one rule groups namespace. To
retrieve a list of rule groups namespaces, use
ListRuleGroupsNamespaces
.
1013 1014 1015 1016 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1013 def describe_rule_groups_namespace(params = {}, = {}) req = build_request(:describe_rule_groups_namespace, params) req.send_request() end |
#describe_scraper(params = {}) ⇒ Types::DescribeScraperResponse
The DescribeScraper
operation displays information about an existing
scraper.
The following waiters are defined for this operation (see #wait_until for detailed usage):
- scraper_active
- scraper_deleted
1064 1065 1066 1067 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1064 def describe_scraper(params = {}, = {}) req = build_request(:describe_scraper, params) req.send_request() end |
#describe_workspace(params = {}) ⇒ Types::DescribeWorkspaceResponse
Returns information about an existing workspace.
The following waiters are defined for this operation (see #wait_until for detailed usage):
- workspace_active
- workspace_deleted
1106 1107 1108 1109 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1106 def describe_workspace(params = {}, = {}) req = build_request(:describe_workspace, params) req.send_request() end |
#get_default_scraper_configuration(params = {}) ⇒ Types::GetDefaultScraperConfigurationResponse
The GetDefaultScraperConfiguration
operation returns the default
scraper configuration used when Amazon EKS creates a scraper for you.
1126 1127 1128 1129 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1126 def get_default_scraper_configuration(params = {}, = {}) req = build_request(:get_default_scraper_configuration, params) req.send_request() end |
#list_rule_groups_namespaces(params = {}) ⇒ Types::ListRuleGroupsNamespacesResponse
Returns a list of rule groups namespaces in a workspace.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1187 1188 1189 1190 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1187 def list_rule_groups_namespaces(params = {}, = {}) req = build_request(:list_rule_groups_namespaces, params) req.send_request() end |
#list_scrapers(params = {}) ⇒ Types::ListScrapersResponse
The ListScrapers
operation lists all of the scrapers in your
account. This includes scrapers being created or deleted. You can
optionally filter the returned list.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1267 1268 1269 1270 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1267 def list_scrapers(params = {}, = {}) req = build_request(:list_scrapers, params) req.send_request() end |
#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceResponse
The ListTagsForResource
operation returns the tags that are
associated with an Amazon Managed Service for Prometheus resource.
Currently, the only resources that can be tagged are workspaces and
rule groups namespaces.
1300 1301 1302 1303 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1300 def (params = {}, = {}) req = build_request(:list_tags_for_resource, params) req.send_request() end |
#list_workspaces(params = {}) ⇒ Types::ListWorkspacesResponse
Lists all of the Amazon Managed Service for Prometheus workspaces in your account. This includes workspaces being created or deleted.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1361 1362 1363 1364 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1361 def list_workspaces(params = {}, = {}) req = build_request(:list_workspaces, params) req.send_request() end |
#put_alert_manager_definition(params = {}) ⇒ Types::PutAlertManagerDefinitionResponse
Updates an existing alert manager definition in a workspace. If the
workspace does not already have an alert manager definition, don't
use this operation to create it. Instead, use
CreateAlertManagerDefinition
.
1413 1414 1415 1416 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1413 def put_alert_manager_definition(params = {}, = {}) req = build_request(:put_alert_manager_definition, params) req.send_request() end |
#put_rule_groups_namespace(params = {}) ⇒ Types::PutRuleGroupsNamespaceResponse
Updates an existing rule groups namespace within a workspace. A rule groups namespace is associated with exactly one rules file. A workspace can have multiple rule groups namespaces.
Use this operation only to update existing rule groups namespaces. To
create a new rule groups namespace, use CreateRuleGroupsNamespace
.
You can't use this operation to add tags to an existing rule groups
namespace. Instead, use TagResource
.
1482 1483 1484 1485 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1482 def put_rule_groups_namespace(params = {}, = {}) req = build_request(:put_rule_groups_namespace, params) req.send_request() end |
#tag_resource(params = {}) ⇒ Struct
The TagResource
operation associates tags with an Amazon Managed
Service for Prometheus resource. The only resources that can be tagged
are workspaces and rule groups namespaces.
If you specify a new tag key for the resource, this tag is appended to the list of tags associated with the resource. If you specify a tag key that is already associated with the resource, the new tag value that you specify replaces the previous value for that tag.
1519 1520 1521 1522 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1519 def tag_resource(params = {}, = {}) req = build_request(:tag_resource, params) req.send_request() end |
#untag_resource(params = {}) ⇒ Struct
Removes the specified tags from an Amazon Managed Service for Prometheus resource. The only resources that can be tagged are workspaces and rule groups namespaces.
1547 1548 1549 1550 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1547 def untag_resource(params = {}, = {}) req = build_request(:untag_resource, params) req.send_request() end |
#update_logging_configuration(params = {}) ⇒ Types::UpdateLoggingConfigurationResponse
Updates the log group ARN or the workspace ID of the current logging configuration.
1590 1591 1592 1593 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1590 def update_logging_configuration(params = {}, = {}) req = build_request(:update_logging_configuration, params) req.send_request() end |
#update_workspace_alias(params = {}) ⇒ Struct
Updates the alias of an existing workspace.
1627 1628 1629 1630 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1627 def update_workspace_alias(params = {}, = {}) req = build_request(:update_workspace_alias, params) req.send_request() end |
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
Basic Usage
A waiter will call an API operation until:
- It is successful
- It enters a terminal state
- It makes the maximum number of attempts
In between attempts, the waiter will sleep.
# polls in a loop, sleeping between attempts
client.wait_until(waiter_name, params)
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You can pass configuration as the final arguments hash.
# poll for ~25 seconds
client.wait_until(waiter_name, params, {
max_attempts: 5,
delay: 5,
})
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success
or :failure
from these callbacks,
it will terminate the waiter.
started_at = Time.now
client.wait_until(waiter_name, params, {
# disable max attempts
max_attempts: nil,
# poll for 1 hour, instead of a number of attempts
before_wait: -> (attempts, response) do
throw :failure if Time.now - started_at > 3600
end
})
Handling Errors
When a waiter is unsuccessful, it will raise an error. All of the failure errors extend from Waiters::Errors::WaiterFailed.
begin
client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
Valid Waiters
The following table lists the valid waiter names, the operations they call,
and the default :delay
and :max_attempts
values.
waiter_name | params | :delay | :max_attempts |
---|---|---|---|
scraper_active | #describe_scraper | 2 | 60 |
scraper_deleted | #describe_scraper | 2 | 60 |
workspace_active | #describe_workspace | 2 | 60 |
workspace_deleted | #describe_workspace | 2 | 60 |
1740 1741 1742 1743 1744 |
# File 'gems/aws-sdk-prometheusservice/lib/aws-sdk-prometheusservice/client.rb', line 1740 def wait_until(waiter_name, params = {}, = {}) w = waiter(waiter_name, ) yield(w.waiter) if block_given? # deprecated w.wait(params) end |