
com.amazonaws.services.applicationdiscovery.AWSApplicationDiscoveryClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-discovery Show documentation
/*
* Copyright 2010-2016 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.applicationdiscovery;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import java.util.Map.Entry;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
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.services.applicationdiscovery.model.*;
import com.amazonaws.services.applicationdiscovery.model.transform.*;
/**
* Client for accessing AWS Application Discovery Service. All service calls
* made using this client are blocking, and will not return until the service
* call completes.
*
*
* The AWS Application Discovery Service helps Systems Integrators quickly and
* reliably plan application migration projects by automatically identifying
* applications running in on-premises data centers, their associated
* dependencies, and their performance profile.
*
*
* Planning data center migrations can involve thousands of workloads that are
* often deeply interdependent. Application discovery and dependency mapping are
* important early first steps in the migration process, but difficult to
* perform at scale due to the lack of automated tools.
*
*
* The AWS Application Discovery Service automatically collects configuration
* and usage data from servers to develop a list of applications, how they
* perform, and how they are interdependent. This information is securely
* retained in an AWS Application Discovery Service database which you can
* export as a CSV file into your preferred visualization tool or cloud
* migration solution to help reduce the complexity and time in planning your
* cloud migration.
*
*
* The Application Discovery Service is currently available for preview. Only
* customers who are engaged with AWS Professional
* Services or a certified AWS partner can use the service. To see the list
* of certified partners and request access to the Application Discovery
* Service, complete the following preview form.
*
*
* This API reference provides descriptions, syntax, and usage examples for each
* of the actions and data types for the Discovery Service. The topic for each
* action shows the API request parameters and the response. Alternatively, you
* can use one of the AWS SDKs to access an API that is tailored to the
* programming language or platform that you're using. For more information, see
* AWS SDKs.
*
*
* This guide is intended for use with the AWS Discovery Service User Guide .
*
*
* The following are short descriptions of each API action, organized by
* function.
*
*
* Managing AWS Agents Using the Application Discovery Service
*
*
* An AWS agent is software that you install on on-premises servers and virtual
* machines that are targeted for discovery and migration. Agents run on Linux
* and Windows Server and collect server configuration and activity information
* about your applications and infrastructure. Specifically, agents collect the
* following information and send it to the Application Discovery Service using
* Secure Sockets Layer (SSL) encryption:
*
*
* -
*
* User information (user name, home directory)
*
*
* -
*
* Group information (name)
*
*
* -
*
* List of installed packages
*
*
* -
*
* List of kernel modules
*
*
* -
*
* All create and stop process events
*
*
* -
*
* DNS queries
*
*
* -
*
* NIC information
*
*
* -
*
* TCP/UDP process listening ports
*
*
* -
*
* TCPV4/V6 connections
*
*
* -
*
* Operating system information
*
*
* -
*
* System performance
*
*
* -
*
* Process performance
*
*
*
*
* The Application Discovery Service API includes the following actions to
* manage AWS agents:
*
*
* -
*
* StartDataCollectionByAgentIds: Instructs the specified agents to start
* collecting data. The Application Discovery Service takes several minutes to
* receive and process data after you initiate data collection.
*
*
* -
*
* StopDataCollectionByAgentIds: Instructs the specified agents to stop
* collecting data.
*
*
* -
*
* DescribeAgents: Lists AWS agents by ID or lists all agents associated
* with your user account if you did not specify an agent ID. The output
* includes agent IDs, IP addresses, media access control (MAC) addresses, agent
* health, host name where the agent resides, and the version number of each
* agent.
*
*
*
*
* Querying Configuration Items
*
*
* A configuration item is an IT asset that was discovered in your data
* center by an AWS agent. When you use the Application Discovery Service, you
* can specify filters and query specific configuration items. The service
* supports Server, Process, and Connection configuration items. This means you
* can specify a value for the following keys and query your IT assets:
*
*
* Server
*
*
* -
*
* server.HostName
*
*
* -
*
* server.osName
*
*
* -
*
* server.osVersion
*
*
* -
*
* server.configurationId
*
*
* -
*
* server.agentId
*
*
*
*
* Process
*
*
* -
*
* process.name
*
*
* -
*
* process.CommandLine
*
*
* -
*
* process.configurationId
*
*
* -
*
* server.hostName
*
*
* -
*
* server.osName
*
*
* -
*
* server.osVersion
*
*
* -
*
* server.configurationId
*
*
* -
*
* server.agentId
*
*
*
*
* Connection
*
*
* -
*
* connection.sourceIp
*
*
* -
*
* connection.sourcePort
*
*
* -
*
* connection.destinationIp
*
*
* -
*
* connection.destinationPort
*
*
* -
*
* sourceProcess.configurationId
*
*
* -
*
* sourceProcess.commandLine
*
*
* -
*
* sourceProcess.name
*
*
* -
*
* destinationProcessId.configurationId
*
*
* -
*
* destinationProcess.commandLine
*
*
* -
*
* destinationProcess.name
*
*
* -
*
* sourceServer.configurationId
*
*
* -
*
* sourceServer.hostName
*
*
* -
*
* sourceServer.osName
*
*
* -
*
* sourceServer.osVersion
*
*
* -
*
* destinationServer.configurationId
*
*
* -
*
* destinationServer.hostName
*
*
* -
*
* destinationServer.osName
*
*
* -
*
* destinationServer.osVersion
*
*
*
*
* The Application Discovery Service includes the following actions for querying
* configuration items.
*
*
* -
*
* DescribeConfigurations: Retrieves a list of attributes for a specific
* configuration ID. For example, the output for a server configuration
* item includes a list of attributes about the server, including host name,
* operating system, number of network cards, etc.
*
*
* -
*
* ListConfigurations: Retrieves a list of configuration items according
* to the criteria you specify in a filter. The filter criteria identify
* relationship requirements. For example, you can specify filter criteria of
* process.name with values of nginx and apache.
*
*
*
*
* Tagging Discovered Configuration Items
*
*
* You can tag discovered configuration items. Tags are metadata that help you
* categorize IT assets in your data center. Tags use a key-value
* format. For example, {"key": "serverType", "value": "webServer"}
* .
*
*
* -
*
* CreateTags: Creates one or more tags for a configuration items.
*
*
* -
*
* DescribeTags: Retrieves a list of configuration items that are tagged
* with a specific tag. Or, retrieves a list of all tags assigned to a
* specific configuration item.
*
*
* -
*
* DeleteTags: Deletes the association between a configuration item and
* one or more tags.
*
*
*
*
* Exporting Data
*
*
* You can export data as a CSV file to an Amazon S3 bucket or into your
* preferred visualization tool or cloud migration solution to help reduce the
* complexity and time in planning your cloud migration.
*
*
* -
*
* ExportConfigurations: Exports all discovered configuration data to an
* Amazon S3 bucket. Data includes tags and tag associations, processes,
* connections, servers, and system performance. This API returns an export ID
* which you can query using the GetExportStatus API.
*
*
* -
*
* DescribeExportConfigurations: Gets the status of the data export. When
* the export is complete, the service returns an Amazon S3 URL where you can
* download CSV files that include the data.
*
*
*
*/
@ThreadSafe
public class AWSApplicationDiscoveryClient extends AmazonWebServiceClient
implements AWSApplicationDiscovery {
/** Provider for AWS credentials. */
private AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory
.getLog(AWSApplicationDiscovery.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "discovery";
/** The region metadata service name for computing region endpoints. */
private static final String DEFAULT_ENDPOINT_PREFIX = "discovery";
/**
* Client configuration factory providing ClientConfigurations tailored to
* this client
*/
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
private final SdkJsonProtocolFactory protocolFactory = new SdkJsonProtocolFactory(
new JsonClientMetadata()
.withProtocolVersion("1.1")
.withSupportsCbor(false)
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode(
"ServerInternalErrorException")
.withModeledClass(
com.amazonaws.services.applicationdiscovery.model.ServerInternalErrorException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode("InvalidParameterException")
.withModeledClass(
com.amazonaws.services.applicationdiscovery.model.InvalidParameterException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode(
"InvalidParameterValueException")
.withModeledClass(
com.amazonaws.services.applicationdiscovery.model.InvalidParameterValueException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode("ResourceNotFoundException")
.withModeledClass(
com.amazonaws.services.applicationdiscovery.model.ResourceNotFoundException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode(
"OperationNotPermittedException")
.withModeledClass(
com.amazonaws.services.applicationdiscovery.model.OperationNotPermittedException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode(
"AuthorizationErrorException")
.withModeledClass(
com.amazonaws.services.applicationdiscovery.model.AuthorizationErrorException.class)));
/**
* Constructs a new client to invoke service methods on AWS Application
* Discovery Service. A credentials provider chain will be used that
* searches for credentials in this order:
*
* - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
* - Java System Properties - aws.accessKeyId and aws.secretKey
* - Instance profile credentials delivered through the Amazon EC2
* metadata service
*
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @see DefaultAWSCredentialsProviderChain
*/
public AWSApplicationDiscoveryClient() {
this(new DefaultAWSCredentialsProviderChain(), configFactory
.getConfig());
}
/**
* Constructs a new client to invoke service methods on AWS Application
* Discovery Service. A credentials provider chain will be used that
* searches for credentials in this order:
*
* - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
* - Java System Properties - aws.accessKeyId and aws.secretKey
* - Instance profile credentials delivered through the Amazon EC2
* metadata service
*
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param clientConfiguration
* The client configuration options controlling how this client
* connects to AWS Application Discovery Service (ex: proxy settings,
* retry counts, etc.).
*
* @see DefaultAWSCredentialsProviderChain
*/
public AWSApplicationDiscoveryClient(ClientConfiguration clientConfiguration) {
this(new DefaultAWSCredentialsProviderChain(), clientConfiguration);
}
/**
* Constructs a new client to invoke service methods on AWS Application
* Discovery Service using the specified AWS account credentials.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when
* authenticating with AWS services.
*/
public AWSApplicationDiscoveryClient(AWSCredentials awsCredentials) {
this(awsCredentials, configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on AWS Application
* Discovery Service using the specified AWS account credentials and client
* configuration options.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when
* authenticating with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client
* connects to AWS Application Discovery Service (ex: proxy settings,
* retry counts, etc.).
*/
public AWSApplicationDiscoveryClient(AWSCredentials awsCredentials,
ClientConfiguration clientConfiguration) {
super(clientConfiguration);
this.awsCredentialsProvider = new StaticCredentialsProvider(
awsCredentials);
init();
}
/**
* Constructs a new client to invoke service methods on AWS Application
* Discovery Service using the specified AWS account credentials provider.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to
* authenticate requests with AWS services.
*/
public AWSApplicationDiscoveryClient(
AWSCredentialsProvider awsCredentialsProvider) {
this(awsCredentialsProvider, configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on AWS Application
* Discovery Service using the specified AWS account credentials provider
* and client configuration options.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to
* authenticate requests with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client
* connects to AWS Application Discovery Service (ex: proxy settings,
* retry counts, etc.).
*/
public AWSApplicationDiscoveryClient(
AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration) {
this(awsCredentialsProvider, clientConfiguration, null);
}
/**
* Constructs a new client to invoke service methods on AWS Application
* Discovery Service using the specified AWS account credentials provider,
* client configuration options, and request metric collector.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to
* authenticate requests with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client
* connects to AWS Application Discovery Service (ex: proxy settings,
* retry counts, etc.).
* @param requestMetricCollector
* optional request metric collector
*/
public AWSApplicationDiscoveryClient(
AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration,
RequestMetricCollector requestMetricCollector) {
super(clientConfiguration, requestMetricCollector);
this.awsCredentialsProvider = awsCredentialsProvider;
init();
}
private void init() {
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(DEFAULT_ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
setEndpoint("https://discovery.us-west-2.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s
.addAll(chainFactory
.newRequestHandlerChain("/com/amazonaws/services/applicationdiscovery/request.handlers"));
requestHandler2s
.addAll(chainFactory
.newRequestHandler2Chain("/com/amazonaws/services/applicationdiscovery/request.handler2s"));
}
/**
*
* Creates one or more tags for configuration items. Tags are metadata that
* help you categorize IT assets. This API accepts a list of multiple
* configuration items.
*
*
* @param createTagsRequest
* @return Result of the CreateTags operation returned by the service.
* @throws AuthorizationErrorException
* The AWS user account does not have permission to perform the
* action. Check the IAM policy associated with this account.
* @throws ResourceNotFoundException
* The specified configuration ID was not located. Verify the
* configuration ID and try again.
* @throws InvalidParameterException
* One or more parameters are not valid. Verify the parameters and
* try again.
* @throws InvalidParameterValueException
* The value of one or more parameters are either invalid or out of
* range. Verify the parameter values and try again.
* @throws ServerInternalErrorException
* The server experienced an internal error. Try again.
* @sample AWSApplicationDiscovery.CreateTags
*/
@Override
public CreateTagsResult createTags(CreateTagsRequest createTagsRequest) {
ExecutionContext executionContext = createExecutionContext(createTagsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateTagsRequestMarshaller(protocolFactory)
.marshall(super.beforeMarshalling(createTagsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new CreateTagsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes the association between configuration items and one or more tags.
* This API accepts a list of multiple configuration items.
*
*
* @param deleteTagsRequest
* @return Result of the DeleteTags operation returned by the service.
* @throws AuthorizationErrorException
* The AWS user account does not have permission to perform the
* action. Check the IAM policy associated with this account.
* @throws ResourceNotFoundException
* The specified configuration ID was not located. Verify the
* configuration ID and try again.
* @throws InvalidParameterException
* One or more parameters are not valid. Verify the parameters and
* try again.
* @throws InvalidParameterValueException
* The value of one or more parameters are either invalid or out of
* range. Verify the parameter values and try again.
* @throws ServerInternalErrorException
* The server experienced an internal error. Try again.
* @sample AWSApplicationDiscovery.DeleteTags
*/
@Override
public DeleteTagsResult deleteTags(DeleteTagsRequest deleteTagsRequest) {
ExecutionContext executionContext = createExecutionContext(deleteTagsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteTagsRequestMarshaller(protocolFactory)
.marshall(super.beforeMarshalling(deleteTagsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DeleteTagsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Lists AWS agents by ID or lists all agents associated with your user
* account if you did not specify an agent ID.
*
*
* @param describeAgentsRequest
* @return Result of the DescribeAgents operation returned by the service.
* @throws AuthorizationErrorException
* The AWS user account does not have permission to perform the
* action. Check the IAM policy associated with this account.
* @throws InvalidParameterException
* One or more parameters are not valid. Verify the parameters and
* try again.
* @throws InvalidParameterValueException
* The value of one or more parameters are either invalid or out of
* range. Verify the parameter values and try again.
* @throws ServerInternalErrorException
* The server experienced an internal error. Try again.
* @sample AWSApplicationDiscovery.DescribeAgents
*/
@Override
public DescribeAgentsResult describeAgents(
DescribeAgentsRequest describeAgentsRequest) {
ExecutionContext executionContext = createExecutionContext(describeAgentsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeAgentsRequestMarshaller(protocolFactory)
.marshall(super
.beforeMarshalling(describeAgentsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DescribeAgentsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Retrieves a list of attributes for a specific configuration ID. For
* example, the output for a server configuration item includes a
* list of attributes about the server, including host name, operating
* system, number of network cards, etc.
*
*
* @param describeConfigurationsRequest
* @return Result of the DescribeConfigurations operation returned by the
* service.
* @throws AuthorizationErrorException
* The AWS user account does not have permission to perform the
* action. Check the IAM policy associated with this account.
* @throws InvalidParameterException
* One or more parameters are not valid. Verify the parameters and
* try again.
* @throws InvalidParameterValueException
* The value of one or more parameters are either invalid or out of
* range. Verify the parameter values and try again.
* @throws ServerInternalErrorException
* The server experienced an internal error. Try again.
* @sample AWSApplicationDiscovery.DescribeConfigurations
*/
@Override
public DescribeConfigurationsResult describeConfigurations(
DescribeConfigurationsRequest describeConfigurationsRequest) {
ExecutionContext executionContext = createExecutionContext(describeConfigurationsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeConfigurationsRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(describeConfigurationsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DescribeConfigurationsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Retrieves the status of a given export process. You can retrieve status
* from a maximum of 100 processes.
*
*
* @param describeExportConfigurationsRequest
* @return Result of the DescribeExportConfigurations operation returned by
* the service.
* @throws AuthorizationErrorException
* The AWS user account does not have permission to perform the
* action. Check the IAM policy associated with this account.
* @throws ResourceNotFoundException
* The specified configuration ID was not located. Verify the
* configuration ID and try again.
* @throws InvalidParameterException
* One or more parameters are not valid. Verify the parameters and
* try again.
* @throws InvalidParameterValueException
* The value of one or more parameters are either invalid or out of
* range. Verify the parameter values and try again.
* @throws ServerInternalErrorException
* The server experienced an internal error. Try again.
* @sample AWSApplicationDiscovery.DescribeExportConfigurations
*/
@Override
public DescribeExportConfigurationsResult describeExportConfigurations(
DescribeExportConfigurationsRequest describeExportConfigurationsRequest) {
ExecutionContext executionContext = createExecutionContext(describeExportConfigurationsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeExportConfigurationsRequestMarshaller(
protocolFactory)
.marshall(super
.beforeMarshalling(describeExportConfigurationsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DescribeExportConfigurationsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Retrieves a list of configuration items that are tagged with a specific
* tag. Or retrieves a list of all tags assigned to a specific configuration
* item.
*
*
* @param describeTagsRequest
* @return Result of the DescribeTags operation returned by the service.
* @throws AuthorizationErrorException
* The AWS user account does not have permission to perform the
* action. Check the IAM policy associated with this account.
* @throws ResourceNotFoundException
* The specified configuration ID was not located. Verify the
* configuration ID and try again.
* @throws InvalidParameterException
* One or more parameters are not valid. Verify the parameters and
* try again.
* @throws InvalidParameterValueException
* The value of one or more parameters are either invalid or out of
* range. Verify the parameter values and try again.
* @throws ServerInternalErrorException
* The server experienced an internal error. Try again.
* @sample AWSApplicationDiscovery.DescribeTags
*/
@Override
public DescribeTagsResult describeTags(
DescribeTagsRequest describeTagsRequest) {
ExecutionContext executionContext = createExecutionContext(describeTagsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeTagsRequestMarshaller(protocolFactory)
.marshall(super.beforeMarshalling(describeTagsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DescribeTagsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Exports all discovered configuration data to an Amazon S3 bucket or an
* application that enables you to view and evaluate the data. Data includes
* tags and tag associations, processes, connections, servers, and system
* performance. This API returns an export ID which you can query using the
* GetExportStatus API. The system imposes a limit of two
* configuration exports in six hours.
*
*
* @param exportConfigurationsRequest
* @return Result of the ExportConfigurations operation returned by the
* service.
* @throws AuthorizationErrorException
* The AWS user account does not have permission to perform the
* action. Check the IAM policy associated with this account.
* @throws InvalidParameterException
* One or more parameters are not valid. Verify the parameters and
* try again.
* @throws InvalidParameterValueException
* The value of one or more parameters are either invalid or out of
* range. Verify the parameter values and try again.
* @throws ServerInternalErrorException
* The server experienced an internal error. Try again.
* @throws OperationNotPermittedException
* This operation is not permitted.
* @sample AWSApplicationDiscovery.ExportConfigurations
*/
@Override
public ExportConfigurationsResult exportConfigurations(
ExportConfigurationsRequest exportConfigurationsRequest) {
ExecutionContext executionContext = createExecutionContext(exportConfigurationsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ExportConfigurationsRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(exportConfigurationsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new ExportConfigurationsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Retrieves a list of configurations items according to the criteria you
* specify in a filter. The filter criteria identify relationship
* requirements.
*
*
* @param listConfigurationsRequest
* @return Result of the ListConfigurations operation returned by the
* service.
* @throws AuthorizationErrorException
* The AWS user account does not have permission to perform the
* action. Check the IAM policy associated with this account.
* @throws ResourceNotFoundException
* The specified configuration ID was not located. Verify the
* configuration ID and try again.
* @throws InvalidParameterException
* One or more parameters are not valid. Verify the parameters and
* try again.
* @throws InvalidParameterValueException
* The value of one or more parameters are either invalid or out of
* range. Verify the parameter values and try again.
* @throws ServerInternalErrorException
* The server experienced an internal error. Try again.
* @sample AWSApplicationDiscovery.ListConfigurations
*/
@Override
public ListConfigurationsResult listConfigurations(
ListConfigurationsRequest listConfigurationsRequest) {
ExecutionContext executionContext = createExecutionContext(listConfigurationsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListConfigurationsRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(listConfigurationsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new ListConfigurationsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Instructs the specified agents to start collecting data. Agents can
* reside on host servers or virtual machines in your data center.
*
*
* @param startDataCollectionByAgentIdsRequest
* @return Result of the StartDataCollectionByAgentIds operation returned by
* the service.
* @throws AuthorizationErrorException
* The AWS user account does not have permission to perform the
* action. Check the IAM policy associated with this account.
* @throws InvalidParameterException
* One or more parameters are not valid. Verify the parameters and
* try again.
* @throws InvalidParameterValueException
* The value of one or more parameters are either invalid or out of
* range. Verify the parameter values and try again.
* @throws ServerInternalErrorException
* The server experienced an internal error. Try again.
* @sample AWSApplicationDiscovery.StartDataCollectionByAgentIds
*/
@Override
public StartDataCollectionByAgentIdsResult startDataCollectionByAgentIds(
StartDataCollectionByAgentIdsRequest startDataCollectionByAgentIdsRequest) {
ExecutionContext executionContext = createExecutionContext(startDataCollectionByAgentIdsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartDataCollectionByAgentIdsRequestMarshaller(
protocolFactory)
.marshall(super
.beforeMarshalling(startDataCollectionByAgentIdsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new StartDataCollectionByAgentIdsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Instructs the specified agents to stop collecting data.
*
*
* @param stopDataCollectionByAgentIdsRequest
* @return Result of the StopDataCollectionByAgentIds operation returned by
* the service.
* @throws AuthorizationErrorException
* The AWS user account does not have permission to perform the
* action. Check the IAM policy associated with this account.
* @throws InvalidParameterException
* One or more parameters are not valid. Verify the parameters and
* try again.
* @throws InvalidParameterValueException
* The value of one or more parameters are either invalid or out of
* range. Verify the parameter values and try again.
* @throws ServerInternalErrorException
* The server experienced an internal error. Try again.
* @sample AWSApplicationDiscovery.StopDataCollectionByAgentIds
*/
@Override
public StopDataCollectionByAgentIdsResult stopDataCollectionByAgentIds(
StopDataCollectionByAgentIdsRequest stopDataCollectionByAgentIdsRequest) {
ExecutionContext executionContext = createExecutionContext(stopDataCollectionByAgentIdsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StopDataCollectionByAgentIdsRequestMarshaller(
protocolFactory)
.marshall(super
.beforeMarshalling(stopDataCollectionByAgentIdsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new StopDataCollectionByAgentIdsResultJsonUnmarshaller());
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) {
executionContext.setCredentialsProvider(CredentialUtils
.getCredentialsProvider(request.getOriginalRequest(),
awsCredentialsProvider));
return doInvoke(request, responseHandler, executionContext);
}
/**
* 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);
}
/**
* 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) {
request.setEndpoint(endpoint);
request.setTimeOffset(timeOffset);
HttpResponseHandler errorResponseHandler = protocolFactory
.createErrorResponseHandler(new JsonErrorResponseMetadata());
return client.execute(request, responseHandler, errorResponseHandler,
executionContext);
}
}