Creates a link between a source account and a sink that you have created in a monitoring account. After the link is created, data is sent from the source account to the monitoring account. When you create a link, you can optionally specify filters that specify which metric namespaces and which log groups are shared from the source account to the 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.
Parameters:
-
label_template
(LabelTemplate)
–
Specify a friendly human-readable name to use to identify this source account when you are viewing data from it in the monitoring account.
You can use a custom label or use the following variables:
-
$AccountName is the name of the account
-
$AccountEmail is the globally unique email address of the account
-
$AccountEmailNoDomain is the email address of the account without the domain name
In the Amazon Web Services GovCloud (US-East) and Amazon Web Services GovCloud (US-West) Regions, the only supported option is to use custom labels, and the $AccountName, $AccountEmail, and $AccountEmailNoDomain variables all resolve as account-id instead of the specified variable.
-
resource_types
(ResourceTypesInput)
–
An array of strings that define which types of data that the source account shares with the monitoring account.
-
sink_identifier
(ResourceIdentifier)
–
The ARN of the sink to use to create this link. You can use ListSinks to find the ARNs of sinks.
For more information about sinks, see CreateSink.
-
tags
(Optional[TagMapInput], default:
None
)
–
Assigns one or more tags (key-value pairs) to the link.
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.
For more information about using tags to control access, see Controlling access to Amazon Web Services resources using tags.
-
link_configuration
(Optional[LinkConfiguration], default:
None
)
–
Use this structure to optionally create filters that specify that only some metric namespaces or log groups are to be shared from the source account to the monitoring account.
Raises:
Source code in docs_src/capo_oam/_services/async_oam.py
| async def create_link(
self,
label_template: "capo_oam.types.label_template.LabelTemplate",
resource_types: "capo_oam.types.resource_types_input.ResourceTypesInput",
sink_identifier: "capo_oam.types.resource_identifier.ResourceIdentifier",
*,
config_overrides: Optional[AsyncOAMClientConfig] = None,
tags: Optional["capo_oam.types.tag_map_input.TagMapInput"] = None,
link_configuration: Optional[
"capo_oam.types.link_configuration.LinkConfiguration"
] = None,
) -> "capo_oam.types.create_link_output.CreateLinkOutput":
"""<p>Creates a link between a source account and a sink that you have created in a monitoring account. After the link is created, data is sent from the source account to the monitoring account. When you create a link, you can optionally specify filters that specify which metric namespaces and which log groups are shared from the source account to the monitoring account.</p> <p>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.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/OAM/latest/APIReference/API_CreateSink.html">CreateSink</a> and <a href="https://docs.aws.amazon.com/OAM/latest/APIReference/API_PutSinkPolicy.html">PutSinkPolicy</a>.</p> <p>Each monitoring account can be linked to as many as 100,000 source accounts.</p> <p>Each source account can be linked to as many as five monitoring accounts.</p>
Args:
label_template: <p>Specify a friendly human-readable name to use to identify this source account when you are viewing data from it in the monitoring account.</p> <p>You can use a custom label or use the following variables:</p> <ul> <li> <p> <code>$AccountName</code> is the name of the account</p> </li> <li> <p> <code>$AccountEmail</code> is the globally unique email address of the account</p> </li> <li> <p> <code>$AccountEmailNoDomain</code> is the email address of the account without the domain name</p> </li> </ul> <note> <p>In the Amazon Web Services GovCloud (US-East) and Amazon Web Services GovCloud (US-West) Regions, the only supported option is to use custom labels, and the <code>$AccountName</code>, <code>$AccountEmail</code>, and <code>$AccountEmailNoDomain</code> variables all resolve as <i>account-id</i> instead of the specified variable.</p> </note>
resource_types: <p>An array of strings that define which types of data that the source account shares with the monitoring account.</p>
sink_identifier: <p>The ARN of the sink to use to create this link. You can use <a href="https://docs.aws.amazon.com/OAM/latest/APIReference/API_ListSinks.html">ListSinks</a> to find the ARNs of sinks.</p> <p>For more information about sinks, see <a href="https://docs.aws.amazon.com/OAM/latest/APIReference/API_CreateSink.html">CreateSink</a>.</p>
tags: <p>Assigns one or more tags (key-value pairs) to the link. </p> <p>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.</p> <p>For more information about using tags to control access, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html">Controlling access to Amazon Web Services resources using tags</a>.</p>
link_configuration: <p>Use this structure to optionally create filters that specify that only some metric namespaces or log groups are to be shared from the source account to the monitoring account.</p>
Raises:
capo_oam.errors.conflict_exception.ConflictException: <p>A resource was in an inconsistent state during an update or a deletion.</p>
capo_oam.errors.internal_service_fault.InternalServiceFault: <p>Unexpected error while processing the request. Retry the request.</p>
capo_oam.errors.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</p>
capo_oam.errors.missing_required_parameter_exception.MissingRequiredParameterException: <p>A required parameter is missing from the request.</p>
capo_oam.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would cause a service quota to be exceeded.</p>
capo_oam.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_oam.types.create_link_input.CreateLinkInput]",
) -> AsyncOperationResponse[
"capo_oam.types.create_link_output.CreateLinkOutput"
]:
import capo_oam._operations.oamservice.create_link
(
output,
http_response,
) = await capo_oam._operations.oamservice.create_link.async_create_link(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateLink")
)
input_: capo_oam.types.create_link_input.CreateLinkInput = {
"label_template": label_template,
"resource_types": resource_types,
"sink_identifier": sink_identifier,
}
if tags is not None:
input_["tags"] = tags
if link_configuration is not None:
input_["link_configuration"] = link_configuration
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|