/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include
#include
#include
#include
#include
#include
namespace Aws
{
namespace OAM
{
/**
* Use Amazon CloudWatch Observability Access Manager to create and manage links
* between source accounts and monitoring accounts by using CloudWatch
* cross-account observability. With CloudWatch cross-account observability,
* you can monitor and troubleshoot applications that span multiple accounts within
* a Region. Seamlessly search, visualize, and analyze your metrics, logs, and
* traces in any of the linked accounts without account boundaries.
* <p>Set up one or more Amazon Web Services accounts as <i>monitoring
* accounts</i> and link them with multiple <i>source
* accounts</i>. A monitoring account is a central Amazon Web Services
* account that can view and interact with observability data generated from source
* accounts. A source account is an individual Amazon Web Services account that
* generates observability data for the resources that reside in it. Source
* accounts share their observability data with the monitoring account. The shared
* observability data can include metrics in Amazon CloudWatch, logs in Amazon
* CloudWatch Logs, and traces in X-Ray.</p>
*/
class AWS_OAM_API OAMClient : public Aws::Client::AWSJsonClient, public Aws::Client::ClientWithAsyncTemplateMethods
{
public:
typedef Aws::Client::AWSJsonClient BASECLASS;
static const char* SERVICE_NAME;
static const char* ALLOCATION_TAG;
typedef OAMClientConfiguration ClientConfigurationType;
typedef OAMEndpointProvider EndpointProviderType;
/**
* Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config
* is not specified, it will be initialized to default values.
*/
OAMClient(const Aws::OAM::OAMClientConfiguration& clientConfiguration = Aws::OAM::OAMClientConfiguration(),
std::shared_ptr endpointProvider = Aws::MakeShared(ALLOCATION_TAG));
/**
* Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config
* is not specified, it will be initialized to default values.
*/
OAMClient(const Aws::Auth::AWSCredentials& credentials,
std::shared_ptr endpointProvider = Aws::MakeShared(ALLOCATION_TAG),
const Aws::OAM::OAMClientConfiguration& clientConfiguration = Aws::OAM::OAMClientConfiguration());
/**
* Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied,
* the default http client factory will be used
*/
OAMClient(const std::shared_ptr& credentialsProvider,
std::shared_ptr endpointProvider = Aws::MakeShared(ALLOCATION_TAG),
const Aws::OAM::OAMClientConfiguration& clientConfiguration = Aws::OAM::OAMClientConfiguration());
/* Legacy constructors due deprecation */
/**
* Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config
* is not specified, it will be initialized to default values.
*/
OAMClient(const Aws::Client::ClientConfiguration& clientConfiguration);
/**
* Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config
* is not specified, it will be initialized to default values.
*/
OAMClient(const Aws::Auth::AWSCredentials& credentials,
const Aws::Client::ClientConfiguration& clientConfiguration);
/**
* Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied,
* the default http client factory will be used
*/
OAMClient(const std::shared_ptr& credentialsProvider,
const Aws::Client::ClientConfiguration& clientConfiguration);
/* End of legacy constructors due deprecation */
virtual ~OAMClient();
/**
* Creates a link between a source account and a sink that you have created in a
* monitoring account.
Before you create a link, you must create a sink in
* the monitoring account and create a sink policy in that account. The sink policy
* must permit the source account to link to it. You can grant permission to source
* accounts by granting permission to an entire organization or to individual
* accounts.
For more information, see CreateSink
* and PutSinkPolicy.
* Each monitoring account can be linked to as many as 100,000 source
* accounts.
Each source account can be linked to as many as five monitoring
* accounts.
See Also:
AWS API
* Reference
*/
virtual Model::CreateLinkOutcome CreateLink(const Model::CreateLinkRequest& request) const;
/**
* A Callable wrapper for CreateLink that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::CreateLinkOutcomeCallable CreateLinkCallable(const CreateLinkRequestT& request) const
{
return SubmitCallable(&OAMClient::CreateLink, request);
}
/**
* An Async wrapper for CreateLink that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void CreateLinkAsync(const CreateLinkRequestT& request, const CreateLinkResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::CreateLink, request, handler, context);
}
/**
* Use this to create a sink in the current account, so that it can be
* used as a monitoring account in CloudWatch cross-account observability. A sink
* is a resource that represents an attachment point in a monitoring account.
* Source accounts can link to the sink to send observability data.
After
* you create a sink, you must create a sink policy that allows source accounts to
* attach to it. For more information, see PutSinkPolicy.
* Each account can contain one sink. If you delete a sink, you can then create
* a new one in that account.
See Also:
AWS API
* Reference
*/
virtual Model::CreateSinkOutcome CreateSink(const Model::CreateSinkRequest& request) const;
/**
* A Callable wrapper for CreateSink that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::CreateSinkOutcomeCallable CreateSinkCallable(const CreateSinkRequestT& request) const
{
return SubmitCallable(&OAMClient::CreateSink, request);
}
/**
* An Async wrapper for CreateSink that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void CreateSinkAsync(const CreateSinkRequestT& request, const CreateSinkResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::CreateSink, request, handler, context);
}
/**
* Deletes a link between a monitoring account sink and a source account. You
* must run this operation in the source account.
See Also:
AWS API
* Reference
*/
virtual Model::DeleteLinkOutcome DeleteLink(const Model::DeleteLinkRequest& request) const;
/**
* A Callable wrapper for DeleteLink that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::DeleteLinkOutcomeCallable DeleteLinkCallable(const DeleteLinkRequestT& request) const
{
return SubmitCallable(&OAMClient::DeleteLink, request);
}
/**
* An Async wrapper for DeleteLink that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void DeleteLinkAsync(const DeleteLinkRequestT& request, const DeleteLinkResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::DeleteLink, request, handler, context);
}
/**
* Deletes a sink. You must delete all links to a sink before you can delete
* that sink.
See Also:
AWS API
* Reference
*/
virtual Model::DeleteSinkOutcome DeleteSink(const Model::DeleteSinkRequest& request) const;
/**
* A Callable wrapper for DeleteSink that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::DeleteSinkOutcomeCallable DeleteSinkCallable(const DeleteSinkRequestT& request) const
{
return SubmitCallable(&OAMClient::DeleteSink, request);
}
/**
* An Async wrapper for DeleteSink that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void DeleteSinkAsync(const DeleteSinkRequestT& request, const DeleteSinkResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::DeleteSink, request, handler, context);
}
/**
* Returns complete information about one link.
To use this operation,
* provide the link ARN. To retrieve a list of link ARNs, use ListLinks.
See
* Also:
AWS API
* Reference
*/
virtual Model::GetLinkOutcome GetLink(const Model::GetLinkRequest& request) const;
/**
* A Callable wrapper for GetLink that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::GetLinkOutcomeCallable GetLinkCallable(const GetLinkRequestT& request) const
{
return SubmitCallable(&OAMClient::GetLink, request);
}
/**
* An Async wrapper for GetLink that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void GetLinkAsync(const GetLinkRequestT& request, const GetLinkResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::GetLink, request, handler, context);
}
/**
* Returns complete information about one monitoring account sink.
To use
* this operation, provide the sink ARN. To retrieve a list of sink ARNs, use ListSinks.
See
* Also:
AWS API
* Reference
*/
virtual Model::GetSinkOutcome GetSink(const Model::GetSinkRequest& request) const;
/**
* A Callable wrapper for GetSink that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::GetSinkOutcomeCallable GetSinkCallable(const GetSinkRequestT& request) const
{
return SubmitCallable(&OAMClient::GetSink, request);
}
/**
* An Async wrapper for GetSink that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void GetSinkAsync(const GetSinkRequestT& request, const GetSinkResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::GetSink, request, handler, context);
}
/**
* Returns the current sink policy attached to this sink. The sink policy
* specifies what accounts can attach to this sink as source accounts, and what
* types of data they can share.
See Also:
AWS
* API Reference
*/
virtual Model::GetSinkPolicyOutcome GetSinkPolicy(const Model::GetSinkPolicyRequest& request) const;
/**
* A Callable wrapper for GetSinkPolicy that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::GetSinkPolicyOutcomeCallable GetSinkPolicyCallable(const GetSinkPolicyRequestT& request) const
{
return SubmitCallable(&OAMClient::GetSinkPolicy, request);
}
/**
* An Async wrapper for GetSinkPolicy that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void GetSinkPolicyAsync(const GetSinkPolicyRequestT& request, const GetSinkPolicyResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::GetSinkPolicy, request, handler, context);
}
/**
* Returns a list of source account links that are linked to this monitoring
* account sink.
To use this operation, provide the sink ARN. To retrieve a
* list of sink ARNs, use ListSinks.
* To find a list of links for one source account, use ListLinks.
See
* Also:
AWS
* API Reference
*/
virtual Model::ListAttachedLinksOutcome ListAttachedLinks(const Model::ListAttachedLinksRequest& request) const;
/**
* A Callable wrapper for ListAttachedLinks that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::ListAttachedLinksOutcomeCallable ListAttachedLinksCallable(const ListAttachedLinksRequestT& request) const
{
return SubmitCallable(&OAMClient::ListAttachedLinks, request);
}
/**
* An Async wrapper for ListAttachedLinks that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void ListAttachedLinksAsync(const ListAttachedLinksRequestT& request, const ListAttachedLinksResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::ListAttachedLinks, request, handler, context);
}
/**
* Use this operation in a source account to return a list of links to
* monitoring account sinks that this source account has.
To find a list of
* links for one monitoring account sink, use ListAttachedLinks
* from within the monitoring account.
See Also:
AWS API
* Reference
*/
virtual Model::ListLinksOutcome ListLinks(const Model::ListLinksRequest& request) const;
/**
* A Callable wrapper for ListLinks that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::ListLinksOutcomeCallable ListLinksCallable(const ListLinksRequestT& request) const
{
return SubmitCallable(&OAMClient::ListLinks, request);
}
/**
* An Async wrapper for ListLinks that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void ListLinksAsync(const ListLinksRequestT& request, const ListLinksResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::ListLinks, request, handler, context);
}
/**
* Use this operation in a monitoring account to return the list of sinks
* created in that account.
See Also:
AWS API
* Reference
*/
virtual Model::ListSinksOutcome ListSinks(const Model::ListSinksRequest& request) const;
/**
* A Callable wrapper for ListSinks that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::ListSinksOutcomeCallable ListSinksCallable(const ListSinksRequestT& request) const
{
return SubmitCallable(&OAMClient::ListSinks, request);
}
/**
* An Async wrapper for ListSinks that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void ListSinksAsync(const ListSinksRequestT& request, const ListSinksResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::ListSinks, request, handler, context);
}
/**
* Displays the tags associated with a resource. Both sinks and links support
* tagging.
See Also:
AWS
* API Reference
*/
virtual Model::ListTagsForResourceOutcome ListTagsForResource(const Model::ListTagsForResourceRequest& request) const;
/**
* A Callable wrapper for ListTagsForResource that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::ListTagsForResourceOutcomeCallable ListTagsForResourceCallable(const ListTagsForResourceRequestT& request) const
{
return SubmitCallable(&OAMClient::ListTagsForResource, request);
}
/**
* An Async wrapper for ListTagsForResource that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void ListTagsForResourceAsync(const ListTagsForResourceRequestT& request, const ListTagsForResourceResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::ListTagsForResource, request, handler, context);
}
/**
* Creates or updates the resource policy that grants permissions to source
* accounts to link to the monitoring account sink. When you create a sink policy,
* you can grant permissions to all accounts in an organization or to individual
* accounts.
You can also use a sink policy to limit the types of data that
* is shared. The three types that you can allow or deny are:
-
* Metrics - Specify with AWS::CloudWatch::Metric
* -
Log groups - Specify with AWS::Logs::LogGroup
* -
Traces - Specify with AWS::XRay::Trace
*
See the examples in this section to see how to specify permitted
* source accounts and data types.
See Also:
AWS
* API Reference
*/
virtual Model::PutSinkPolicyOutcome PutSinkPolicy(const Model::PutSinkPolicyRequest& request) const;
/**
* A Callable wrapper for PutSinkPolicy that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::PutSinkPolicyOutcomeCallable PutSinkPolicyCallable(const PutSinkPolicyRequestT& request) const
{
return SubmitCallable(&OAMClient::PutSinkPolicy, request);
}
/**
* An Async wrapper for PutSinkPolicy that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void PutSinkPolicyAsync(const PutSinkPolicyRequestT& request, const PutSinkPolicyResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::PutSinkPolicy, request, handler, context);
}
/**
* Assigns one or more tags (key-value pairs) to the specified resource. Both
* sinks and links can be tagged.
Tags can help you organize and categorize
* your resources. You can also use them to scope user permissions by granting a
* user permission to access or change only resources with certain tag values.
* Tags don't have any semantic meaning to Amazon Web Services and are
* interpreted strictly as strings of characters.
You can use the
* TagResource
action with a resource that already has tags. If you
* specify a new tag key for the alarm, this tag is appended to the list of tags
* associated with the alarm. If you specify a tag key that is already associated
* with the alarm, the new tag value that you specify replaces the previous value
* for that tag.
You can associate as many as 50 tags with a resource.
* Unlike tagging permissions in other Amazon Web Services services,
* to tag or untag links and sinks you must have the oam:ResourceTag
* permission. The iam:ResourceTag
permission does not allow you to
* tag and untag links and sinks.
See Also:
AWS API
* Reference
*/
virtual Model::TagResourceOutcome TagResource(const Model::TagResourceRequest& request) const;
/**
* A Callable wrapper for TagResource that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::TagResourceOutcomeCallable TagResourceCallable(const TagResourceRequestT& request) const
{
return SubmitCallable(&OAMClient::TagResource, request);
}
/**
* An Async wrapper for TagResource that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void TagResourceAsync(const TagResourceRequestT& request, const TagResourceResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::TagResource, request, handler, context);
}
/**
* Removes one or more tags from the specified resource.
* Unlike tagging permissions in other Amazon Web Services services, to tag or
* untag links and sinks you must have the oam:ResourceTag
permission.
* The iam:TagResource
permission does not allow you to tag and untag
* links and sinks.
See Also:
AWS
* API Reference
*/
virtual Model::UntagResourceOutcome UntagResource(const Model::UntagResourceRequest& request) const;
/**
* A Callable wrapper for UntagResource that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::UntagResourceOutcomeCallable UntagResourceCallable(const UntagResourceRequestT& request) const
{
return SubmitCallable(&OAMClient::UntagResource, request);
}
/**
* An Async wrapper for UntagResource that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void UntagResourceAsync(const UntagResourceRequestT& request, const UntagResourceResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::UntagResource, request, handler, context);
}
/**
* Use this operation to change what types of data are shared from a source
* account to its linked monitoring account sink. You can't change the sink or
* change the monitoring account with this operation.
To update the list of
* tags associated with the sink, use TagResource.
See
* Also:
AWS API
* Reference
*/
virtual Model::UpdateLinkOutcome UpdateLink(const Model::UpdateLinkRequest& request) const;
/**
* A Callable wrapper for UpdateLink that returns a future to the operation so that it can be executed in parallel to other requests.
*/
template
Model::UpdateLinkOutcomeCallable UpdateLinkCallable(const UpdateLinkRequestT& request) const
{
return SubmitCallable(&OAMClient::UpdateLink, request);
}
/**
* An Async wrapper for UpdateLink that queues the request into a thread executor and triggers associated callback when operation has finished.
*/
template
void UpdateLinkAsync(const UpdateLinkRequestT& request, const UpdateLinkResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const
{
return SubmitAsync(&OAMClient::UpdateLink, request, handler, context);
}
void OverrideEndpoint(const Aws::String& endpoint);
std::shared_ptr& accessEndpointProvider();
private:
friend class Aws::Client::ClientWithAsyncTemplateMethods;
void init(const OAMClientConfiguration& clientConfiguration);
OAMClientConfiguration m_clientConfiguration;
std::shared_ptr m_executor;
std::shared_ptr m_endpointProvider;
};
} // namespace OAM
} // namespace Aws