# DomainlessCredentialSpec

Credential specification for domainless gMSA.

Extends: [CredentialSpec](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CredentialSpec.html) › DomainlessCredentialSpec
Obtainable from: DomainlessCredentialSpec.fromS3Bucket, DomainlessCredentialSpec.fromSsmParameter

- Source: [`aws-ecs/lib/credential-spec.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ecs/lib/credential-spec.ts#L91)
- Type last changed: v2.129.0 · 21 Feb 2024

## Example

TypeScript:

```ts
// Make sure the task definition's execution role has permissions to read from the S3 bucket or SSM parameter where the CredSpec file is stored.
declare const bucket: s3.Bucket;
declare const taskDefinition: ecs.TaskDefinition;

// Domainless gMSA container from a S3 bucket object.
taskDefinition.addContainer('gmsa-domainless-container', {
  image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
  cpu: 128,
  memoryLimitMiB: 256,
  credentialSpecs: [ecs.DomainlessCredentialSpec.fromS3Bucket(bucket, 'credSpec')],
});
```

Python:

```python
# Make sure the task definition's execution role has permissions to read from the S3 bucket or SSM parameter where the CredSpec file is stored.
# bucket: s3.Bucket
# task_definition: ecs.TaskDefinition

# Domainless gMSA container from a S3 bucket object.
task_definition.add_container("gmsa-domainless-container",
    image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample"),
    cpu=128,
    memory_limit_mi_b=256,
    credential_specs=[ecs.DomainlessCredentialSpec.from_s3_bucket(bucket, "credSpec")]
)
```

Java:

```java
// Make sure the task definition's execution role has permissions to read from the S3 bucket or SSM parameter where the CredSpec file is stored.
Bucket bucket;
TaskDefinition taskDefinition;

// Domainless gMSA container from a S3 bucket object.
taskDefinition.addContainer("gmsa-domainless-container", ContainerDefinitionOptions.builder()
        .image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
        .cpu(128)
        .memoryLimitMiB(256)
        .credentialSpecs(List.of(DomainlessCredentialSpec.fromS3Bucket(bucket, "credSpec")))
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// Make sure the task definition's execution role has permissions to read from the S3 bucket or SSM parameter where the CredSpec file is stored.
Bucket bucket;
TaskDefinition taskDefinition;

// Domainless gMSA container from a S3 bucket object.
taskDefinition.AddContainer("gmsa-domainless-container", new ContainerDefinitionOptions {
    Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample"),
    Cpu = 128,
    MemoryLimitMiB = 256,
    CredentialSpecs = new [] { DomainlessCredentialSpec.FromS3Bucket(bucket, "credSpec") }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Make sure the task definition's execution role has permissions to read from the S3 bucket or SSM parameter where the CredSpec file is stored.
var bucket Bucket
var taskDefinition TaskDefinition

// Domainless gMSA container from a S3 bucket object.
taskDefinition.AddContainer(jsii.String("gmsa-domainless-container"), &ContainerDefinitionOptions{
	Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")),
	Cpu: jsii.Number(128),
	MemoryLimitMiB: jsii.Number(256),
	CredentialSpecs: []CredentialSpec{
		ecs.DomainlessCredentialSpec_FromS3Bucket(bucket, jsii.String("credSpec")),
	},
})
```

## Initializer

TypeScript:

```ts
new DomainlessCredentialSpec(fileLocation: string)
```

Python:

```python
DomainlessCredentialSpec(file_location: str)
```

Java:

```java
new DomainlessCredentialSpec(String fileLocation)
```

C# / .NET:

```csharp
new DomainlessCredentialSpec(string fileLocation)
```

Golang:

```go
NewDomainlessCredentialSpec(FileLocation *string)
```

## Properties

- `fileLocation`: string — Location or ARN from where to retrieve the CredSpec file.

- `prefixId`: string — Prefix string based on the type of CredSpec.

## Methods

- `bind(): CredentialSpecConfig` — Called when the container is initialized to allow this object to bind to the stack.

- `fromS3Bucket(bucket: IBucket, key: string): DomainlessCredentialSpec // chainable` (static) — Loads the CredSpec from a S3 bucket object.

  **Parameters**

  - `bucket` — The S3 bucket.
  - `key` — The object key.

  **Returns:** CredSpec with it's locations set to the S3 object's ARN.

- `fromSsmParameter(parameter: IParameter): DomainlessCredentialSpec // chainable` (static) — Loads the CredSpec from a SSM parameter.

  **Parameters**

  - `parameter` — The SSM parameter.

  **Returns:** CredSpec with it's locations set to the SSM parameter's ARN.
