# CfnLinkProps

Properties for defining a `CfnLink`.

Used as props by: [CfnLink](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_oam.CfnLink.html)

- Source: Generated at build time
- Type last changed: v2.139.0 · 24 Apr 2024

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_oam as oam } from 'aws-cdk-lib';
const cfnLinkProps: oam.CfnLinkProps = {
  resourceTypes: ['resourceTypes'],
  sinkIdentifier: 'sinkIdentifier',

  // the properties below are optional
  labelTemplate: 'labelTemplate',
  linkConfiguration: {
    logGroupConfiguration: {
      filter: 'filter',
    },
    metricConfiguration: {
      filter: 'filter',
    },
  },
  tags: {
    tagsKey: 'tags',
  },
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_oam as oam

cfn_link_props = oam.CfnLinkProps(
    resource_types=["resourceTypes"],
    sink_identifier="sinkIdentifier",

    # the properties below are optional
    label_template="labelTemplate",
    link_configuration=oam.CfnLink.LinkConfigurationProperty(
        log_group_configuration=oam.CfnLink.LinkFilterProperty(
            filter="filter"
        ),
        metric_configuration=oam.CfnLink.LinkFilterProperty(
            filter="filter"
        )
    ),
    tags={
        "tags_key": "tags"
    }
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.oam.*;

CfnLinkProps cfnLinkProps = CfnLinkProps.builder()
        .resourceTypes(List.of("resourceTypes"))
        .sinkIdentifier("sinkIdentifier")

        // the properties below are optional
        .labelTemplate("labelTemplate")
        .linkConfiguration(LinkConfigurationProperty.builder()
                .logGroupConfiguration(LinkFilterProperty.builder()
                        .filter("filter")
                        .build())
                .metricConfiguration(LinkFilterProperty.builder()
                        .filter("filter")
                        .build())
                .build())
        .tags(Map.of(
                "tagsKey", "tags"))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Oam;

var cfnLinkProps = new CfnLinkProps {
    ResourceTypes = new [] { "resourceTypes" },
    SinkIdentifier = "sinkIdentifier",

    // the properties below are optional
    LabelTemplate = "labelTemplate",
    LinkConfiguration = new LinkConfigurationProperty {
        LogGroupConfiguration = new LinkFilterProperty {
            Filter = "filter"
        },
        MetricConfiguration = new LinkFilterProperty {
            Filter = "filter"
        }
    },
    Tags = new Dictionary<string, string> {
        { "tagsKey", "tags" }
    }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnLinkProps := &CfnLinkProps{
	ResourceTypes: []*string{
		jsii.String("resourceTypes"),
	},
	SinkIdentifier: jsii.String("sinkIdentifier"),

	// the properties below are optional
	LabelTemplate: jsii.String("labelTemplate"),
	LinkConfiguration: &LinkConfigurationProperty{
		LogGroupConfiguration: &LinkFilterProperty{
			Filter: jsii.String("filter"),
		},
		MetricConfiguration: &LinkFilterProperty{
			Filter: jsii.String("filter"),
		},
	},
	Tags: map[string]*string{
		"tagsKey": jsii.String("tags"),
	},
}
```

## Properties

- `labelTemplate`: string — 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 include the following variables in your template:

  - `$AccountName` is the name of the account
  - `$AccountEmail` is a globally-unique email address, which includes the email domain, such as `mariagarcia@example.com`
  - `$AccountEmailNoDomain` is an email address without the domain name, such as `mariagarcia`

  > In the  and  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.

- `linkConfiguration`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnLink.LinkConfigurationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_oam.CfnLink.LinkConfigurationProperty.html) — 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.

- `resourceTypes`: string[] (required) — An array of strings that define which types of data that the source account shares with the monitoring account.

  Valid values are `AWS::CloudWatch::Metric | AWS::Logs::LogGroup | AWS::XRay::Trace | AWS::ApplicationInsights::Application | AWS::InternetMonitor::Monitor` .

- `sinkIdentifier`: string (required) — The ARN of the sink in the monitoring account that you want to link to.

  You can use [ListSinks](https://docs.aws.amazon.com/OAM/latest/APIReference/API_ListSinks.html) to find the ARNs of sinks.

- `tags`: { [key: string]: string } — An array of key-value pairs to apply to the link.

  For more information, see [Tag](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html) .
