/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.codeguruprofiler; import org.w3c.dom.*; import java.net.*; import java.util.*; import javax.annotation.Generated; import org.apache.commons.logging.*; import com.amazonaws.*; import com.amazonaws.annotation.SdkInternalApi; import com.amazonaws.auth.*; import com.amazonaws.handlers.*; import com.amazonaws.http.*; import com.amazonaws.internal.*; import com.amazonaws.internal.auth.*; import com.amazonaws.metrics.*; import com.amazonaws.regions.*; import com.amazonaws.transform.*; import com.amazonaws.util.*; import com.amazonaws.protocol.json.*; import com.amazonaws.util.AWSRequestMetrics.Field; import com.amazonaws.annotation.ThreadSafe; import com.amazonaws.client.AwsSyncClientParams; import com.amazonaws.client.builder.AdvancedConfig; import com.amazonaws.services.codeguruprofiler.AmazonCodeGuruProfilerClientBuilder; import com.amazonaws.AmazonServiceException; import com.amazonaws.services.codeguruprofiler.model.*; import com.amazonaws.services.codeguruprofiler.model.transform.*; /** * Client for accessing Amazon CodeGuru Profiler. All service calls made using this client are blocking, and will not * return until the service call completes. *
*
* This section provides documentation for the Amazon CodeGuru Profiler API operations. *
** Amazon CodeGuru Profiler collects runtime performance data from your live applications, and provides recommendations * that can help you fine-tune your application performance. Using machine learning algorithms, CodeGuru Profiler can * help you find your most expensive lines of code and suggest ways you can improve efficiency and remove CPU * bottlenecks. *
** Amazon CodeGuru Profiler provides different visualizations of profiling data to help you identify what code is * running on the CPU, see how much time is consumed, and suggest ways to reduce CPU utilization. *
** Amazon CodeGuru Profiler currently supports applications written in all Java virtual machine (JVM) languages and * Python. While CodeGuru Profiler supports both visualizations and recommendations for applications written in Java, it * can also generate visualizations and a subset of recommendations for applications written in other JVM languages and * Python. *
** For more information, see What is Amazon CodeGuru * Profiler in the Amazon CodeGuru Profiler User Guide. *
*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AmazonCodeGuruProfilerClient extends AmazonWebServiceClient implements AmazonCodeGuruProfiler { /** Provider for AWS credentials. */ private final AWSCredentialsProvider awsCredentialsProvider; private static final Log log = LogFactory.getLog(AmazonCodeGuruProfiler.class); /** Default signing name for the service. */ private static final String DEFAULT_SIGNING_NAME = "codeguru-profiler"; /** Client configuration factory providing ClientConfigurations tailored to this client */ protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory(); private final AdvancedConfig advancedConfig; private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory( new JsonClientMetadata() .withProtocolVersion("1.1") .withSupportsCbor(false) .withSupportsIon(false) .withContentTypeOverride("application/json") .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ConflictException").withExceptionUnmarshaller( com.amazonaws.services.codeguruprofiler.model.transform.ConflictExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ResourceNotFoundException").withExceptionUnmarshaller( com.amazonaws.services.codeguruprofiler.model.transform.ResourceNotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ThrottlingException").withExceptionUnmarshaller( com.amazonaws.services.codeguruprofiler.model.transform.ThrottlingExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ValidationException").withExceptionUnmarshaller( com.amazonaws.services.codeguruprofiler.model.transform.ValidationExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ServiceQuotaExceededException").withExceptionUnmarshaller( com.amazonaws.services.codeguruprofiler.model.transform.ServiceQuotaExceededExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InternalServerException").withExceptionUnmarshaller( com.amazonaws.services.codeguruprofiler.model.transform.InternalServerExceptionUnmarshaller.getInstance())) .withBaseServiceExceptionClass(com.amazonaws.services.codeguruprofiler.model.AmazonCodeGuruProfilerException.class)); public static AmazonCodeGuruProfilerClientBuilder builder() { return AmazonCodeGuruProfilerClientBuilder.standard(); } /** * Constructs a new client to invoke service methods on Amazon CodeGuru Profiler using the specified parameters. * ** All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AmazonCodeGuruProfilerClient(AwsSyncClientParams clientParams) { this(clientParams, false); } /** * Constructs a new client to invoke service methods on Amazon CodeGuru Profiler using the specified parameters. * *
* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AmazonCodeGuruProfilerClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) { super(clientParams); this.awsCredentialsProvider = clientParams.getCredentialsProvider(); this.advancedConfig = clientParams.getAdvancedConfig(); init(); } private void init() { setServiceNameIntern(DEFAULT_SIGNING_NAME); setEndpointPrefix(ENDPOINT_PREFIX); // calling this.setEndPoint(...) will also modify the signer accordingly setEndpoint("codeguru-profiler.us-east-1.amazonaws.com"); HandlerChainFactory chainFactory = new HandlerChainFactory(); requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/codeguruprofiler/request.handlers")); requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/codeguruprofiler/request.handler2s")); requestHandler2s.addAll(chainFactory.getGlobalHandlers()); } /** *
* Add up to 2 anomaly notifications channels for a profiling group. *
* * @param addNotificationChannelsRequest * The structure representing the AddNotificationChannelsRequest. * @return Result of the AddNotificationChannels operation returned by the service. * @throws ServiceQuotaExceededException * You have exceeded your service quota. To perform the requested action, remove some of the relevant * resources, or use Service * Quotas to request a service quota increase. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ConflictException * The requested operation would cause a conflict with the current state of a service resource associated * with the request. Resolve the conflict before retrying this request. * @throws ValidationException * The parameter is not valid. * @throws ThrottlingException * The request was denied due to request throttling. * @throws ResourceNotFoundException * The resource specified in the request does not exist. * @sample AmazonCodeGuruProfiler.AddNotificationChannels * @see AWS API Documentation */ @Override public AddNotificationChannelsResult addNotificationChannels(AddNotificationChannelsRequest request) { request = beforeClientExecution(request); return executeAddNotificationChannels(request); } @SdkInternalApi final AddNotificationChannelsResult executeAddNotificationChannels(AddNotificationChannelsRequest addNotificationChannelsRequest) { ExecutionContext executionContext = createExecutionContext(addNotificationChannelsRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request* Returns the time series of values for a requested list of frame metrics from a time period. *
* * @param batchGetFrameMetricDataRequest * The structure representing the BatchGetFrameMetricDataRequest. * @return Result of the BatchGetFrameMetricData operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ValidationException * The parameter is not valid. * @throws ThrottlingException * The request was denied due to request throttling. * @throws ResourceNotFoundException * The resource specified in the request does not exist. * @sample AmazonCodeGuruProfiler.BatchGetFrameMetricData * @see AWS API Documentation */ @Override public BatchGetFrameMetricDataResult batchGetFrameMetricData(BatchGetFrameMetricDataRequest request) { request = beforeClientExecution(request); return executeBatchGetFrameMetricData(request); } @SdkInternalApi final BatchGetFrameMetricDataResult executeBatchGetFrameMetricData(BatchGetFrameMetricDataRequest batchGetFrameMetricDataRequest) { ExecutionContext executionContext = createExecutionContext(batchGetFrameMetricDataRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request
* Used by profiler agents to report their current state and to receive remote configuration updates. For example,
* ConfigureAgent
can be used to tell an agent whether to profile or not and for how long to return
* profiling data.
*
* Creates a profiling group. *
* * @param createProfilingGroupRequest * The structure representing the createProfiliingGroupRequest. * @return Result of the CreateProfilingGroup operation returned by the service. * @throws ServiceQuotaExceededException * You have exceeded your service quota. To perform the requested action, remove some of the relevant * resources, or use Service * Quotas to request a service quota increase. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ConflictException * The requested operation would cause a conflict with the current state of a service resource associated * with the request. Resolve the conflict before retrying this request. * @throws ValidationException * The parameter is not valid. * @throws ThrottlingException * The request was denied due to request throttling. * @sample AmazonCodeGuruProfiler.CreateProfilingGroup * @see AWS API Documentation */ @Override public CreateProfilingGroupResult createProfilingGroup(CreateProfilingGroupRequest request) { request = beforeClientExecution(request); return executeCreateProfilingGroup(request); } @SdkInternalApi final CreateProfilingGroupResult executeCreateProfilingGroup(CreateProfilingGroupRequest createProfilingGroupRequest) { ExecutionContext executionContext = createExecutionContext(createProfilingGroupRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request* Deletes a profiling group. *
* * @param deleteProfilingGroupRequest * The structure representing the deleteProfilingGroupRequest. * @return Result of the DeleteProfilingGroup operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ConflictException * The requested operation would cause a conflict with the current state of a service resource associated * with the request. Resolve the conflict before retrying this request. * @throws ValidationException * The parameter is not valid. * @throws ThrottlingException * The request was denied due to request throttling. * @throws ResourceNotFoundException * The resource specified in the request does not exist. * @sample AmazonCodeGuruProfiler.DeleteProfilingGroup * @see AWS API Documentation */ @Override public DeleteProfilingGroupResult deleteProfilingGroup(DeleteProfilingGroupRequest request) { request = beforeClientExecution(request); return executeDeleteProfilingGroup(request); } @SdkInternalApi final DeleteProfilingGroupResult executeDeleteProfilingGroup(DeleteProfilingGroupRequest deleteProfilingGroupRequest) { ExecutionContext executionContext = createExecutionContext(deleteProfilingGroupRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request
* Returns a
* ProfilingGroupDescription
object that contains information about the requested profiling group.
*
* Returns a list of
* FindingsReportSummary
objects that contain analysis results for all profiling groups in your
* AWS account.
*
* Get the current configuration for anomaly notifications for a profiling group. *
* * @param getNotificationConfigurationRequest * The structure representing the GetNotificationConfigurationRequest. * @return Result of the GetNotificationConfiguration operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ValidationException * The parameter is not valid. * @throws ThrottlingException * The request was denied due to request throttling. * @throws ResourceNotFoundException * The resource specified in the request does not exist. * @sample AmazonCodeGuruProfiler.GetNotificationConfiguration * @see AWS API Documentation */ @Override public GetNotificationConfigurationResult getNotificationConfiguration(GetNotificationConfigurationRequest request) { request = beforeClientExecution(request); return executeGetNotificationConfiguration(request); } @SdkInternalApi final GetNotificationConfigurationResult executeGetNotificationConfiguration(GetNotificationConfigurationRequest getNotificationConfigurationRequest) { ExecutionContext executionContext = createExecutionContext(getNotificationConfigurationRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request* Returns the JSON-formatted resource-based policy on a profiling group. *
* * @param getPolicyRequest * The structure representing thegetPolicyRequest
.
* @return Result of the GetPolicy operation returned by the service.
* @throws InternalServerException
* The server encountered an internal error and is unable to complete the request.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ResourceNotFoundException
* The resource specified in the request does not exist.
* @sample AmazonCodeGuruProfiler.GetPolicy
* @see AWS API
* Documentation
*/
@Override
public GetPolicyResult getPolicy(GetPolicyRequest request) {
request = beforeClientExecution(request);
return executeGetPolicy(request);
}
@SdkInternalApi
final GetPolicyResult executeGetPolicy(GetPolicyRequest getPolicyRequest) {
ExecutionContext executionContext = createExecutionContext(getPolicyRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request* 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="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_AggregatedProfileTime.html"> <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="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ListProfileTimes.html"> <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>
*
*
* @param getProfileRequest
* The structure representing the getProfileRequest.
* @return Result of the GetProfile operation returned by the service.
* @throws InternalServerException
* The server encountered an internal error and is unable to complete the request.
* @throws ValidationException
* The parameter is not valid.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ResourceNotFoundException
* The resource specified in the request does not exist.
* @sample AmazonCodeGuruProfiler.GetProfile
* @see AWS
* API Documentation
*/
@Override
public GetProfileResult getProfile(GetProfileRequest request) {
request = beforeClientExecution(request);
return executeGetProfile(request);
}
@SdkInternalApi
final GetProfileResult executeGetProfile(GetProfileRequest getProfileRequest) {
ExecutionContext executionContext = createExecutionContext(getProfileRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request
* 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 the available reports for a given profiling group and time range. *
* * @param listFindingsReportsRequest * The structure representing the ListFindingsReportsRequest. * @return Result of the ListFindingsReports operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ValidationException * The parameter is not valid. * @throws ThrottlingException * The request was denied due to request throttling. * @throws ResourceNotFoundException * The resource specified in the request does not exist. * @sample AmazonCodeGuruProfiler.ListFindingsReports * @see AWS API Documentation */ @Override public ListFindingsReportsResult listFindingsReports(ListFindingsReportsRequest request) { request = beforeClientExecution(request); return executeListFindingsReports(request); } @SdkInternalApi final ListFindingsReportsResult executeListFindingsReports(ListFindingsReportsRequest listFindingsReportsRequest) { ExecutionContext executionContext = createExecutionContext(listFindingsReportsRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request* Lists the start times of the available aggregated profiles of a profiling group for an aggregation period within * the specified time range. *
* * @param listProfileTimesRequest * The structure representing the listProfileTimesRequest. * @return Result of the ListProfileTimes operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ValidationException * The parameter is not valid. * @throws ThrottlingException * The request was denied due to request throttling. * @throws ResourceNotFoundException * The resource specified in the request does not exist. * @sample AmazonCodeGuruProfiler.ListProfileTimes * @see AWS API Documentation */ @Override public ListProfileTimesResult listProfileTimes(ListProfileTimesRequest request) { request = beforeClientExecution(request); return executeListProfileTimes(request); } @SdkInternalApi final ListProfileTimesResult executeListProfileTimes(ListProfileTimesRequest listProfileTimesRequest) { ExecutionContext executionContext = createExecutionContext(listProfileTimesRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request
* Returns a list of profiling groups. The profiling groups are returned as
* ProfilingGroupDescription
objects.
*
* Returns a list of the tags that are assigned to a specified resource. *
* * @param listTagsForResourceRequest * @return Result of the ListTagsForResource operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ValidationException * The parameter is not valid. * @throws ResourceNotFoundException * The resource specified in the request does not exist. * @sample AmazonCodeGuruProfiler.ListTagsForResource * @see AWS API Documentation */ @Override public ListTagsForResourceResult listTagsForResource(ListTagsForResourceRequest request) { request = beforeClientExecution(request); return executeListTagsForResource(request); } @SdkInternalApi final ListTagsForResourceResult executeListTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) { ExecutionContext executionContext = createExecutionContext(listTagsForResourceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request
* 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
* .
*
* 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="https://docs.aws.amazon.com/codeguru/latest/profiler-ug/resource-based-policies.html">Resource-based policies in CodeGuru Profiler</a> in the <i>Amazon CodeGuru Profiler User Guide</i>, <a href="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ConfigureAgent.html"> <code>ConfigureAgent</code> </a>, and <a href="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_PostAgentProfile.html"> <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>
*
*
* @param putPermissionRequest
* The structure representing the putPermissionRequest
.
* @return Result of the PutPermission operation returned by the service.
* @throws InternalServerException
* The server encountered an internal error and is unable to complete the request.
* @throws ConflictException
* The requested operation would cause a conflict with the current state of a service resource associated
* with the request. Resolve the conflict before retrying this request.
* @throws ValidationException
* The parameter is not valid.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ResourceNotFoundException
* The resource specified in the request does not exist.
* @sample AmazonCodeGuruProfiler.PutPermission
* @see AWS
* API Documentation
*/
@Override
public PutPermissionResult putPermission(PutPermissionRequest request) {
request = beforeClientExecution(request);
return executePutPermission(request);
}
@SdkInternalApi
final PutPermissionResult executePutPermission(PutPermissionRequest putPermissionRequest) {
ExecutionContext executionContext = createExecutionContext(putPermissionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request* Remove one anomaly notifications channel for a profiling group. *
* * @param removeNotificationChannelRequest * The structure representing the RemoveNotificationChannelRequest. * @return Result of the RemoveNotificationChannel operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ValidationException * The parameter is not valid. * @throws ThrottlingException * The request was denied due to request throttling. * @throws ResourceNotFoundException * The resource specified in the request does not exist. * @sample AmazonCodeGuruProfiler.RemoveNotificationChannel * @see AWS API Documentation */ @Override public RemoveNotificationChannelResult removeNotificationChannel(RemoveNotificationChannelRequest request) { request = beforeClientExecution(request); return executeRemoveNotificationChannel(request); } @SdkInternalApi final RemoveNotificationChannelResult executeRemoveNotificationChannel(RemoveNotificationChannelRequest removeNotificationChannelRequest) { ExecutionContext executionContext = createExecutionContext(removeNotificationChannelRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request
* 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
.
*
*The structure representing the <code>removePermissionRequest</code>.</p>
* @return Result of the RemovePermission operation returned by the service. * @throws InternalServerException The server encountered an internal error and is unable to complete the request. * @throws ConflictException The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. * @throws ValidationException The parameter is not valid. * @throws ThrottlingException The request was denied due to request throttling. * @throws ResourceNotFoundException The resource specified in the request does not exist. * @sample AmazonCodeGuruProfiler.RemovePermission * @see AWS API Documentation */ @Override public RemovePermissionResult removePermission(RemovePermissionRequest request) { request = beforeClientExecution(request); return executeRemovePermission(request); } @SdkInternalApi final RemovePermissionResult executeRemovePermission(RemovePermissionRequest removePermissionRequest) { ExecutionContext executionContext = createExecutionContext(removePermissionRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Requestrequest = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new RemovePermissionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(removePermissionRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "CodeGuruProfiler"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RemovePermission"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler > responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RemovePermissionResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** * * Sends feedback to CodeGuru Profiler about whether the anomaly detected by the analysis is useful or not. *
* * @param submitFeedbackRequest * The structure representing the SubmitFeedbackRequest. * @return Result of the SubmitFeedback operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ValidationException * The parameter is not valid. * @throws ThrottlingException * The request was denied due to request throttling. * @throws ResourceNotFoundException * The resource specified in the request does not exist. * @sample AmazonCodeGuruProfiler.SubmitFeedback * @see AWS API Documentation */ @Override public SubmitFeedbackResult submitFeedback(SubmitFeedbackRequest request) { request = beforeClientExecution(request); return executeSubmitFeedback(request); } @SdkInternalApi final SubmitFeedbackResult executeSubmitFeedback(SubmitFeedbackRequest submitFeedbackRequest) { ExecutionContext executionContext = createExecutionContext(submitFeedbackRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Requestrequest = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new SubmitFeedbackRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(submitFeedbackRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "CodeGuruProfiler"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SubmitFeedback"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler > responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SubmitFeedbackResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** * * Use to assign one or more tags to a resource. *
* * @param tagResourceRequest * @return Result of the TagResource operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ValidationException * The parameter is not valid. * @throws ResourceNotFoundException * The resource specified in the request does not exist. * @sample AmazonCodeGuruProfiler.TagResource * @see AWS * API Documentation */ @Override public TagResourceResult tagResource(TagResourceRequest request) { request = beforeClientExecution(request); return executeTagResource(request); } @SdkInternalApi final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) { ExecutionContext executionContext = createExecutionContext(tagResourceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Requestrequest = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "CodeGuruProfiler"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler > responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** * * Use to remove one or more tags from a resource. *
* * @param untagResourceRequest * @return Result of the UntagResource operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ValidationException * The parameter is not valid. * @throws ResourceNotFoundException * The resource specified in the request does not exist. * @sample AmazonCodeGuruProfiler.UntagResource * @see AWS * API Documentation */ @Override public UntagResourceResult untagResource(UntagResourceRequest request) { request = beforeClientExecution(request); return executeUntagResource(request); } @SdkInternalApi final UntagResourceResult executeUntagResource(UntagResourceRequest untagResourceRequest) { ExecutionContext executionContext = createExecutionContext(untagResourceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Requestrequest = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new UntagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(untagResourceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "CodeGuruProfiler"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler > responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UntagResourceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** * * Updates a profiling group. *
* * @param updateProfilingGroupRequest * The structure representing the updateProfilingGroupRequest. * @return Result of the UpdateProfilingGroup operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ConflictException * The requested operation would cause a conflict with the current state of a service resource associated * with the request. Resolve the conflict before retrying this request. * @throws ValidationException * The parameter is not valid. * @throws ThrottlingException * The request was denied due to request throttling. * @throws ResourceNotFoundException * The resource specified in the request does not exist. * @sample AmazonCodeGuruProfiler.UpdateProfilingGroup * @see AWS API Documentation */ @Override public UpdateProfilingGroupResult updateProfilingGroup(UpdateProfilingGroupRequest request) { request = beforeClientExecution(request); return executeUpdateProfilingGroup(request); } @SdkInternalApi final UpdateProfilingGroupResult executeUpdateProfilingGroup(UpdateProfilingGroupRequest updateProfilingGroupRequest) { ExecutionContext executionContext = createExecutionContext(updateProfilingGroupRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Requestrequest = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new UpdateProfilingGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateProfilingGroupRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "CodeGuruProfiler"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateProfilingGroup"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler > responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateProfilingGroupResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** * Returns additional metadata for a previously executed successful, request, typically used for debugging issues * where a service isn't acting as expected. This data isn't considered part of the result data returned by an * operation, so it's available through this separate, diagnostic interface. * * Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic * information for an executed request, you should use this method to retrieve it as soon as possible after * executing the request. * * @param request * The originally executed request * * @return The response metadata for the specified request, or null if none is available. */ public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) { return client.getResponseMetadataForRequest(request); } /** * Normal invoke with authentication. Credentials are required and may be overriden at the request level. **/ private
Response invoke(Request request, HttpResponseHandler > responseHandler, ExecutionContext executionContext) { return invoke(request, responseHandler, executionContext, null, null); } /** * Normal invoke with authentication. Credentials are required and may be overriden at the request level. **/ private Response invoke(Request request, HttpResponseHandler > responseHandler, ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) { executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider)); return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait); } /** * Invoke with no authentication. Credentials are not required and any credentials set on the client or request will * be ignored for this operation. **/ private Response anonymousInvoke(Request request, HttpResponseHandler > responseHandler, ExecutionContext executionContext) { return doInvoke(request, responseHandler, executionContext, null, null); } /** * Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the * ExecutionContext beforehand. **/ private Response doInvoke(Request request, HttpResponseHandler > responseHandler, ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) { if (discoveredEndpoint != null) { request.setEndpoint(discoveredEndpoint); request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery"); } else if (uriFromEndpointTrait != null) { request.setEndpoint(uriFromEndpointTrait); } else { request.setEndpoint(endpoint); } request.setTimeOffset(timeOffset); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata()); return client.execute(request, responseHandler, errorResponseHandler, executionContext); } @com.amazonaws.annotation.SdkInternalApi static com.amazonaws.protocol.json.SdkJsonProtocolFactory getProtocolFactory() { return protocolFactory; } @Override public void shutdown() { super.shutdown(); } }