# SecretAttributes

Attributes required to import an existing secret into the Stack.

One ARN format (`secretArn`, `secretCompleteArn`, `secretPartialArn`) must be provided.

Used as argument in: [Secret.fromSecretAttributes](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.Secret.html#fromsecretattributes)

- Source: [`aws-secretsmanager/lib/secret.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-secretsmanager/lib/secret.ts#L324)

## Example

TypeScript:

```ts
const userpool = new cognito.UserPool(this, 'Pool');
const secret = secretsmanager.Secret.fromSecretAttributes(this, "CognitoClientSecret", {
    secretCompleteArn: "arn:aws:secretsmanager:xxx:xxx:secret:xxx-xxx"
}).secretValue

const provider = new cognito.UserPoolIdentityProviderGoogle(this, 'Google', {
  clientId: 'amzn-client-id',
  clientSecretValue: secret,
  userPool: userpool,
});
```

Python:

```python
userpool = cognito.UserPool(self, "Pool")
secret = secretsmanager.Secret.from_secret_attributes(self, "CognitoClientSecret",
    secret_complete_arn="arn:aws:secretsmanager:xxx:xxx:secret:xxx-xxx"
).secret_value

provider = cognito.UserPoolIdentityProviderGoogle(self, "Google",
    client_id="amzn-client-id",
    client_secret_value=secret,
    user_pool=userpool
)
```

Java:

```java
UserPool userpool = new UserPool(this, "Pool");
SecretValue secret = Secret.fromSecretAttributes(this, "CognitoClientSecret", SecretAttributes.builder()
        .secretCompleteArn("arn:aws:secretsmanager:xxx:xxx:secret:xxx-xxx")
        .build()).getSecretValue();

UserPoolIdentityProviderGoogle provider = UserPoolIdentityProviderGoogle.Builder.create(this, "Google")
        .clientId("amzn-client-id")
        .clientSecretValue(secret)
        .userPool(userpool)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var userpool = new UserPool(this, "Pool");
var secret = Secret.FromSecretAttributes(this, "CognitoClientSecret", new SecretAttributes {
    SecretCompleteArn = "arn:aws:secretsmanager:xxx:xxx:secret:xxx-xxx"
}).SecretValue;

var provider = new UserPoolIdentityProviderGoogle(this, "Google", new UserPoolIdentityProviderGoogleProps {
    ClientId = "amzn-client-id",
    ClientSecretValue = secret,
    UserPool = userpool
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
userpool := cognito.NewUserPool(this, jsii.String("Pool"))
secret := secretsmanager.Secret_FromSecretAttributes(this, jsii.String("CognitoClientSecret"), &SecretAttributes{
	SecretCompleteArn: jsii.String("arn:aws:secretsmanager:xxx:xxx:secret:xxx-xxx"),
}).SecretValue

provider := cognito.NewUserPoolIdentityProviderGoogle(this, jsii.String("Google"), &UserPoolIdentityProviderGoogleProps{
	ClientId: jsii.String("amzn-client-id"),
	ClientSecretValue: secret,
	UserPool: userpool,
})
```

## Properties

- `encryptionKey`: [IKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — The encryption key that is used to encrypt the secret, unless the default SecretsManager key is used.

- `secretCompleteArn`: string — The complete ARN of the secret in SecretsManager.

  This is the ARN including the Secrets Manager 6-character suffix.
  Cannot be used with `secretArn` or `secretPartialArn`.

- `secretPartialArn`: string — The partial ARN of the secret in SecretsManager.

  This is the ARN without the Secrets Manager 6-character suffix.
  Cannot be used with `secretArn` or `secretCompleteArn`.
