# ServiceAttributes

Used as argument in: [Service.fromServiceAttributes](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_servicediscovery.Service.html#fromserviceattributes)

- Source: [`aws-servicediscovery/lib/service.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-servicediscovery/lib/service.ts#L171)
- Type last changed: v2.38.0 · 17 Aug 2022

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_servicediscovery as servicediscovery } from 'aws-cdk-lib';

declare const namespace: servicediscovery.INamespace;
const serviceAttributes: servicediscovery.ServiceAttributes = {
  dnsRecordType: servicediscovery.DnsRecordType.A,
  namespace: namespace,
  routingPolicy: servicediscovery.RoutingPolicy.WEIGHTED,
  serviceArn: 'serviceArn',
  serviceId: 'serviceId',
  serviceName: 'serviceName',

  // the properties below are optional
  discoveryType: servicediscovery.DiscoveryType.API,
};
```

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_servicediscovery as servicediscovery

# namespace: servicediscovery.INamespace

service_attributes = servicediscovery.ServiceAttributes(
    dns_record_type=servicediscovery.DnsRecordType.A,
    namespace=namespace,
    routing_policy=servicediscovery.RoutingPolicy.WEIGHTED,
    service_arn="serviceArn",
    service_id="serviceId",
    service_name="serviceName",

    # the properties below are optional
    discovery_type=servicediscovery.DiscoveryType.API
)
```

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.servicediscovery.*;

INamespace namespace;

ServiceAttributes serviceAttributes = ServiceAttributes.builder()
        .dnsRecordType(DnsRecordType.A)
        .namespace(namespace)
        .routingPolicy(RoutingPolicy.WEIGHTED)
        .serviceArn("serviceArn")
        .serviceId("serviceId")
        .serviceName("serviceName")

        // the properties below are optional
        .discoveryType(DiscoveryType.API)
        .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.ServiceDiscovery;

INamespace namespace;

var serviceAttributes = new ServiceAttributes {
    DnsRecordType = DnsRecordType.A,
    Namespace = namespace,
    RoutingPolicy = RoutingPolicy.WEIGHTED,
    ServiceArn = "serviceArn",
    ServiceId = "serviceId",
    ServiceName = "serviceName",

    // the properties below are optional
    DiscoveryType = DiscoveryType.API
};
```

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"

var namespace INamespace

serviceAttributes := &ServiceAttributes{
	DnsRecordType: awscdk.Aws_servicediscovery.DnsRecordType_A,
	Namespace: namespace,
	RoutingPolicy: awscdk.*Aws_servicediscovery.RoutingPolicy_WEIGHTED,
	ServiceArn: jsii.String("serviceArn"),
	ServiceId: jsii.String("serviceId"),
	ServiceName: jsii.String("serviceName"),

	// the properties below are optional
	DiscoveryType: awscdk.*Aws_servicediscovery.DiscoveryType_API,
}
```

## Properties

- `discoveryType`: [DiscoveryType](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_servicediscovery.DiscoveryType.html)

- `dnsRecordType`: [DnsRecordType](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_servicediscovery.DnsRecordType.html) (required)

- `namespace`: [INamespace](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_servicediscovery.INamespace.html) (required)

- `routingPolicy`: [RoutingPolicy](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_servicediscovery.RoutingPolicy.html) (required)

- `serviceArn`: string (required)

- `serviceId`: string (required)

- `serviceName`: string (required)
