You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::CodeGuruProfiler::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::CodeGuruProfiler::Client
- Defined in:
- (unknown)
Overview
An API client for Amazon CodeGuru Profiler. To construct a client, you need to configure a :region
and :credentials
.
codeguruprofiler = Aws::CodeGuruProfiler::Client.new(
region: region_name,
credentials: credentials,
# ...
)
See #initialize for a full list of supported configuration options.
Region
You can configure a default region in the following locations:
ENV['AWS_REGION']
Aws.config[:region]
Go here for a list of supported regions.
Credentials
Default credentials are loaded automatically from the following locations:
ENV['AWS_ACCESS_KEY_ID']
andENV['AWS_SECRET_ACCESS_KEY']
Aws.config[:credentials]
- The shared credentials ini file at
~/.aws/credentials
(more information) - From an instance profile when running on EC2
You can also construct a credentials object from one of the following classes:
Alternatively, you configure credentials with :access_key_id
and
:secret_access_key
:
# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))
Aws::CodeGuruProfiler::Client.new(
access_key_id: creds['access_key_id'],
secret_access_key: creds['secret_access_key']
)
Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.
Instance Attribute Summary
Attributes inherited from Seahorse::Client::Base
Constructor collapse
-
#initialize(options = {}) ⇒ Aws::CodeGuruProfiler::Client
constructor
Constructs an API client.
API Operations collapse
-
#add_notification_channels(options = {}) ⇒ Types::AddNotificationChannelsResponse
Add up to 2 anomaly notifications channels for a profiling group.
.
-
#batch_get_frame_metric_data(options = {}) ⇒ Types::BatchGetFrameMetricDataResponse
Returns the time series of values for a requested list of frame metrics from a time period.
.
-
#configure_agent(options = {}) ⇒ Types::ConfigureAgentResponse
Used by profiler agents to report their current state and to receive remote configuration updates.
-
#create_profiling_group(options = {}) ⇒ Types::CreateProfilingGroupResponse
Creates a profiling group.
.
-
#delete_profiling_group(options = {}) ⇒ Struct
Deletes a profiling group.
.
-
#describe_profiling_group(options = {}) ⇒ Types::DescribeProfilingGroupResponse
Returns a
ProfilingGroupDescription
object that contains information about the requested profiling group. -
#get_findings_report_account_summary(options = {}) ⇒ Types::GetFindingsReportAccountSummaryResponse
Returns a list of
FindingsReportSummary
objects that contain analysis results for all profiling groups in your AWS account. -
#get_notification_configuration(options = {}) ⇒ Types::GetNotificationConfigurationResponse
Get the current configuration for anomaly notifications for a profiling group.
.
-
#get_policy(options = {}) ⇒ Types::GetPolicyResponse
Returns the JSON-formatted resource-based policy on a profiling group.
-
#get_profile(options = {}) ⇒ Types::GetProfileResponse
Gets the aggregated profile of a profiling group for a specified time range.
-
#get_recommendations(options = {}) ⇒ Types::GetRecommendationsResponse
Returns a list of
Recommendation
objects that contain recommendations for a profiling group for a given time period. -
#list_findings_reports(options = {}) ⇒ Types::ListFindingsReportsResponse
List the available reports for a given profiling group and time range.
.
-
#list_profile_times(options = {}) ⇒ Types::ListProfileTimesResponse
Lists the start times of the available aggregated profiles of a profiling group for an aggregation period within the specified time range.
.
-
#list_profiling_groups(options = {}) ⇒ Types::ListProfilingGroupsResponse
Returns a list of profiling groups.
-
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse
Returns a list of the tags that are assigned to a specified resource.
-
#post_agent_profile(options = {}) ⇒ Struct
Submits profiling data to an aggregated profile of a profiling group.
-
#put_permission(options = {}) ⇒ Types::PutPermissionResponse
Adds permissions to a profiling group's resource-based policy that are provided using an action group.
-
#remove_notification_channel(options = {}) ⇒ Types::RemoveNotificationChannelResponse
Remove one anomaly notifications channel for a profiling group.
.
-
#remove_permission(options = {}) ⇒ Types::RemovePermissionResponse
Removes permissions from a profiling group's resource-based policy that are provided using an action group.
-
#submit_feedback(options = {}) ⇒ Struct
Sends feedback to CodeGuru Profiler about whether the anomaly detected by the analysis is useful or not.
.
-
#tag_resource(options = {}) ⇒ Struct
Use to assign one or more tags to a resource.
-
#untag_resource(options = {}) ⇒ Struct
Use to remove one or more tags from a resource.
-
#update_profiling_group(options = {}) ⇒ Types::UpdateProfilingGroupResponse
Updates a profiling group.
.
Instance Method Summary collapse
-
#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean
Waiters polls an API operation until a resource enters a desired state.
-
#waiter_names ⇒ Array<Symbol>
Returns the list of supported waiters.
Methods inherited from Seahorse::Client::Base
add_plugin, api, #build_request, clear_plugins, define, new, #operation, #operation_names, plugins, remove_plugin, set_api, set_plugins
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response
Constructor Details
#initialize(options = {}) ⇒ Aws::CodeGuruProfiler::Client
Constructs an API client.
Instance Method Details
#add_notification_channels(options = {}) ⇒ Types::AddNotificationChannelsResponse
Add up to 2 anomaly notifications channels for a profiling group.
#batch_get_frame_metric_data(options = {}) ⇒ Types::BatchGetFrameMetricDataResponse
Returns the time series of values for a requested list of frame metrics from a time period.
#configure_agent(options = {}) ⇒ Types::ConfigureAgentResponse
Used by profiler agents to report their current state and to receive remote configuration updates. For example, ConfigureAgent
can be used to tell and agent whether to profile or not and for how long to return profiling data.
#create_profiling_group(options = {}) ⇒ Types::CreateProfilingGroupResponse
Creates a profiling group.
#delete_profiling_group(options = {}) ⇒ Struct
Deletes a profiling group.
#describe_profiling_group(options = {}) ⇒ Types::DescribeProfilingGroupResponse
Returns a ProfilingGroupDescription
object that contains information about the requested profiling group.
#get_findings_report_account_summary(options = {}) ⇒ Types::GetFindingsReportAccountSummaryResponse
Returns a list of FindingsReportSummary
objects that contain analysis results for all profiling groups in your AWS account.
#get_notification_configuration(options = {}) ⇒ Types::GetNotificationConfigurationResponse
Get the current configuration for anomaly notifications for a profiling group.
#get_policy(options = {}) ⇒ Types::GetPolicyResponse
Returns the JSON-formatted resource-based policy on a profiling group.
#get_profile(options = {}) ⇒ Types::GetProfileResponse
Gets the aggregated profile of a profiling group for a specified time range. Amazon CodeGuru Profiler collects posted agent profiles for a profiling group into aggregated profiles.
<note> <p> Because aggregated profiles expire over time <code>GetProfile</code> is not idempotent. </p> </note> <p> Specify the time range for the requested aggregated profile using 1 or 2 of the following parameters: <code>startTime</code>, <code>endTime</code>, <code>period</code>. The maximum time range allowed is 7 days. If you specify all 3 parameters, an exception is thrown. If you specify only <code>period</code>, the latest aggregated profile is returned. </p> <p> Aggregated profiles are available with aggregation periods of 5 minutes, 1 hour, and 1 day, aligned to UTC. The aggregation period of an aggregated profile determines how long it is retained. For more information, see <a href="<a href="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_AggregatedProfileTime.html">">https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_AggregatedProfileTime.html"></a> <code>AggregatedProfileTime</code> </a>. The aggregated profile's aggregation period determines how long it is retained by CodeGuru Profiler. </p> <ul> <li> <p> If the aggregation period is 5 minutes, the aggregated profile is retained for 15 days. </p> </li> <li> <p> If the aggregation period is 1 hour, the aggregated profile is retained for 60 days. </p> </li> <li> <p> If the aggregation period is 1 day, the aggregated profile is retained for 3 years. </p> </li> </ul> <p>There are two use cases for calling <code>GetProfile</code>.</p> <ol> <li> <p> If you want to return an aggregated profile that already exists, use <a href="<a href="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ListProfileTimes.html">">https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ListProfileTimes.html"></a> <code>ListProfileTimes</code> </a> to view the time ranges of existing aggregated profiles. Use them in a <code>GetProfile</code> request to return a specific, existing aggregated profile. </p> </li> <li> <p> If you want to return an aggregated profile for a time range that doesn't align with an existing aggregated profile, then CodeGuru Profiler makes a best effort to combine existing aggregated profiles from the requested time range and return them as one aggregated profile. </p> <p> If aggregated profiles do not exist for the full time range requested, then aggregated profiles for a smaller time range are returned. For example, if the requested time range is from 00:00 to 00:20, and the existing aggregated profiles are from 00:15 and 00:25, then the aggregated profiles from 00:15 to 00:20 are returned. </p> </li> </ol>
#get_recommendations(options = {}) ⇒ Types::GetRecommendationsResponse
Returns a list of Recommendation
objects that contain recommendations for a profiling group for a given time period. A list of Anomaly
objects that contains details about anomalies detected in the profiling group for the same time period is also returned.
#list_findings_reports(options = {}) ⇒ Types::ListFindingsReportsResponse
List the available reports for a given profiling group and time range.
#list_profile_times(options = {}) ⇒ Types::ListProfileTimesResponse
Lists the start times of the available aggregated profiles of a profiling group for an aggregation period within the specified time range.
#list_profiling_groups(options = {}) ⇒ Types::ListProfilingGroupsResponse
Returns a list of profiling groups. The profiling groups are returned as ProfilingGroupDescription
objects.
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse
Returns a list of the tags that are assigned to a specified resource.
#post_agent_profile(options = {}) ⇒ Struct
Submits profiling data to an aggregated profile of a profiling group. To get an aggregated profile that is created with this profiling data, use GetProfile
.
#put_permission(options = {}) ⇒ Types::PutPermissionResponse
Adds permissions to a profiling group's resource-based policy that are provided using an action group. If a profiling group doesn't have a resource-based policy, one is created for it using the permissions in the action group and the roles and users in the principals
parameter.
<p> The one supported action group that can be added is <code>agentPermission</code> which grants <code>ConfigureAgent</code> and <code>PostAgent</code> permissions. For more information, see <a href="<a href="https://docs.aws.amazon.com/codeguru/latest/profiler-ug/resource-based-policies.html">Resource-based">https://docs.aws.amazon.com/codeguru/latest/profiler-ug/resource-based-policies.html">Resource-based</a> policies in CodeGuru Profiler</a> in the <i>Amazon CodeGuru Profiler User Guide</i>, <a href="<a href="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ConfigureAgent.html">">https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ConfigureAgent.html"></a> <code>ConfigureAgent</code> </a>, and <a href="<a href="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_PostAgentProfile.html">">https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_PostAgentProfile.html"></a> <code>PostAgentProfile</code> </a>. </p> <p> The first time you call <code>PutPermission</code> on a profiling group, do not specify a <code>revisionId</code> because it doesn't have a resource-based policy. Subsequent calls must provide a <code>revisionId</code> to specify which revision of the resource-based policy to add the permissions to. </p> <p> The response contains the profiling group's JSON-formatted resource policy. </p>
#remove_notification_channel(options = {}) ⇒ Types::RemoveNotificationChannelResponse
Remove one anomaly notifications channel for a profiling group.
#remove_permission(options = {}) ⇒ Types::RemovePermissionResponse
Removes permissions from a profiling group's resource-based policy that are provided using an action group. The one supported action group that can be removed is agentPermission
which grants ConfigureAgent
and PostAgent
permissions. For more information, see Resource-based policies in CodeGuru Profiler in the Amazon CodeGuru Profiler User Guide, ConfigureAgent
, and PostAgentProfile
.
#submit_feedback(options = {}) ⇒ Struct
Sends feedback to CodeGuru Profiler about whether the anomaly detected by the analysis is useful or not.
#tag_resource(options = {}) ⇒ Struct
Use to assign one or more tags to a resource.
#untag_resource(options = {}) ⇒ Struct
Use to remove one or more tags from a resource.
#update_profiling_group(options = {}) ⇒ Types::UpdateProfilingGroupResponse
Updates a profiling group.
#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean
Waiters polls an API operation until a resource enters a desired state.
Basic Usage
Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:
# poll for ~25 seconds
client.wait_until(...) do |w|
w.max_attempts = 5
w.delay = 5
end
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(...) do |w|
# disable max attempts
w.max_attempts = nil
# poll for 1 hour, instead of a number of attempts
w.before_wait do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
end
Handling Errors
When a waiter is successful, it returns true
. When a waiter
fails, it raises an error. All errors raised extend from
Waiters::Errors::WaiterFailed.
begin
client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
#waiter_names ⇒ Array<Symbol>
Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:
Waiter Name | Client Method | Default Delay: | Default Max Attempts: |
---|