Skip to content

Commit

Permalink
Link CognitoUserPoolClient client id and secret (#460)
Browse files Browse the repository at this point in the history
* Link client id and secret

* Sync

---------

Co-authored-by: Frank <frank@sst.dev>
  • Loading branch information
digitaltoad and fwang committed May 29, 2024
1 parent 3263630 commit 5b16941
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
28 changes: 20 additions & 8 deletions pkg/platform/src/components/aws/cognito-user-pool-client.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import {
ComponentResourceOptions,
Output,
all,
interpolate,
output,
} from "@pulumi/pulumi";
import { ComponentResourceOptions } from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import { Component, Transform, transform } from "../component";
import { Input } from "../input";
import { CognitoUserPoolClientArgs } from "./cognito-user-pool.js";
import { Link } from "../link";

export interface ClientArgs extends CognitoUserPoolClientArgs {
/**
Expand Down Expand Up @@ -37,7 +32,7 @@ export interface ClientArgs extends CognitoUserPoolClientArgs {
*
* You'll find this component returned by the `addClient` method of the `CognitoUserPool` component.
*/
export class CognitoUserPoolClient extends Component {
export class CognitoUserPoolClient extends Component implements Link.Linkable {
private client: aws.cognito.UserPoolClient;

constructor(name: string, args: ClientArgs, opts?: ComponentResourceOptions) {
Expand Down Expand Up @@ -79,6 +74,13 @@ export class CognitoUserPoolClient extends Component {
return this.client.id;
}

/**
* The Cognito user pool client secret.
*/
public get secret() {
return this.client.clientSecret;
}

/**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/
Expand All @@ -90,6 +92,16 @@ export class CognitoUserPoolClient extends Component {
client: this.client,
};
}

/** @internal */
public getSSTLink() {
return {
properties: {
id: this.id,
secret: this.secret,
},
};
}
}

const __pulumiType = "sst:aws:CognitoUserPoolClient";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,30 @@ The underlying [resources](/docs/components/#nodes) this component creates.
The Amazon Cognito user pool client.
</Segment>
### secret
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">Output</code><code class="symbol">&lt;</code><code class="primitive">string</code><code class="symbol">&gt;</code>
</InlineSection>
</Section>
The Cognito user pool client secret.
</Segment>
## SDK
The following are accessible through the [SDK](/docs/reference/sdk/) at runtime.
### Links
<Segment>
<Section type="parameters">
- <p><code class="key">id</code> <code class="primitive">string</code></p>
The Cognito user pool client ID.
- <p><code class="key">secret</code> <code class="primitive">string</code></p>
The Cognito user pool client secret.
</Section>
</Segment>
## ClientArgs
### transform?
<Segment>
Expand Down

0 comments on commit 5b16941

Please sign in to comment.