repo_name string | dataset string | owner string | lang string | func_name string | code string | docstring string | url string | sha string |
|---|---|---|---|---|---|---|---|---|
ion | github_2023 | sst | typescript | Cdn.url | public get url() {
return interpolate`https://${this.distribution.domainName}`;
} | /**
* The CloudFront URL of the distribution.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cdn.ts#L567-L569 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Cdn.domainUrl | public get domainUrl() {
return this._domainUrl;
} | /**
* If the custom domain is enabled, this is the URL of the distribution with the
* custom domain.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cdn.ts#L575-L577 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Cdn.nodes | public get nodes() {
return {
/**
* The Amazon CloudFront distribution.
*/
distribution: this.distribution,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cdn.ts#L582-L589 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Cluster.nodes | public get nodes() {
return {
/**
* The Amazon ECS Cluster.
*/
cluster: this.cluster,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cluster-v1.ts#L872-L879 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Cluster.addService | public addService(name: string, args?: ClusterServiceArgs) {
// Do not prefix the service to allow `Resource.MyService` to work.
return new ServiceV1(name, {
cluster: {
name: this.cluster.name,
arn: this.cluster.arn,
},
vpc: this.args.vpc,
...args,
});
} | /**
* Add a service to the cluster.
*
* @param name Name of the service.
* @param args Configure the service.
*
* @example
*
* ```ts title="sst.config.ts"
* cluster.addService("MyService");
* ```
*
* Set a custom domain for the service.
*
* ```js {2} title="sst.config.ts"
* cluster.addService("MyService", {
* domain: "example.com"
* });
* ```
*
* #### Enable auto-scaling
*
* ```ts title="sst.config.ts"
* cluster.addService("MyService", {
* scaling: {
* min: 4,
* max: 16,
* cpuUtilization: 50,
* memoryUtilization: 50,
* }
* });
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cluster-v1.ts#L914-L924 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Cluster.nodes | public get nodes() {
return {
/**
* The Amazon ECS Cluster.
*/
cluster: this.cluster,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cluster.ts#L1247-L1254 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Cluster.addService | public addService(name: string, args?: ClusterServiceArgs) {
// Do not prefix the service to allow `Resource.MyService` to work.
return new Service(
name,
{
cluster: {
name: this.cluster.name,
arn: this.cluster.arn,
},
vpc: this.constructorArgs.vpc,
...args,
},
{ provider: this.constructorOpts.provider },
);
} | /**
* Add a service to the cluster.
*
* @param name Name of the service.
* @param args Configure the service.
*
* @example
*
* ```ts title="sst.config.ts"
* cluster.addService("MyService");
* ```
*
* You can also configure the service. For example, set a custom domain.
*
* ```js {2} title="sst.config.ts"
* cluster.addService("MyService", {
* domain: "example.com"
* });
* ```
*
* Enable auto-scaling.
*
* ```ts title="sst.config.ts"
* cluster.addService("MyService", {
* scaling: {
* min: 4,
* max: 16,
* cpuUtilization: 50,
* memoryUtilization: 50,
* }
* });
* ```
*
* By default this starts a single container. To add multiple containers in the service, pass in an array of containers args.
*
* ```ts title="sst.config.ts"
* cluster.addService("MyService", {
* architecture: "arm64",
* containers: [
* {
* name: "app",
* image: "nginxdemos/hello:plain-text"
* },
* {
* name: "admin",
* image: {
* context: "./admin",
* dockerfile: "Dockerfile"
* }
* }
* ]
* });
* ```
*
* This is useful for running sidecar containers.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cluster.ts#L1312-L1326 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoIdentityPool.id | public get id() {
return this.identityPool.id;
} | /**
* The Cognito identity pool ID.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-identity-pool.ts#L321-L323 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoIdentityPool.nodes | public get nodes() {
return {
/**
* The Amazon Cognito identity pool.
*/
identityPool: this.identityPool,
/**
* The authenticated IAM role.
*/
authenticatedRole: this.authRole,
/**
* The unauthenticated IAM role.
*/
unauthenticatedRole: this.unauthRole,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-identity-pool.ts#L328-L343 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoIdentityPool.getSSTLink | public getSSTLink() {
return {
properties: {
id: this.id,
},
include: [
permission({
actions: ["cognito-identity:*"],
resources: [this.identityPool.arn],
}),
],
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-identity-pool.ts#L346-L358 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoIdentityPool.get | public static get(name: string, identityPoolID: Input<string>) {
const identityPool = cognito.IdentityPool.get(
`${name}IdentityPool`,
identityPoolID,
);
const attachment = cognito.IdentityPoolRoleAttachment.get(
`${name}RoleAttachment`,
identityPoolID,
);
const authRole = iam.Role.get(
`${name}AuthRole`,
attachment.roles.authenticated.apply((arn) => parseRoleArn(arn).roleName),
);
const unauthRole = iam.Role.get(
`${name}UnauthRole`,
attachment.roles.unauthenticated.apply(
(arn) => parseRoleArn(arn).roleName,
),
);
return new CognitoIdentityPool(name, {
ref: true,
identityPool,
authRole,
unauthRole,
} as unknown as CognitoIdentityPoolArgs);
} | /**
* Reference an existing Identity Pool with the given ID. This is useful when you
* create a Identity Pool in one stage and want to share it in another. It avoids having to
* create a new Identity Pool in the other stage.
*
* :::tip
* You can use the `static get` method to share Identity Pools across stages.
* :::
*
* @param name The name of the component.
* @param identityPoolID The ID of the existing Identity Pool.
*
* @example
* Imagine you create a Identity Pool in the `dev` stage. And in your personal stage `frank`,
* instead of creating a new pool, you want to share the same pool from `dev`.
*
* ```ts title="sst.config.ts"
* const identityPool = $app.stage === "frank"
* ? sst.aws.CognitoIdentityPool.get("MyIdentityPool", "us-east-1:02facf30-e2f3-49ec-9e79-c55187415cf8")
* : new sst.aws.CognitoIdentityPool("MyIdentityPool");
* ```
*
* Here `us-east-1:02facf30-e2f3-49ec-9e79-c55187415cf8` is the ID of the Identity Pool created in the `dev` stage.
* You can find this by outputting the Identity Pool ID in the `dev` stage.
*
* ```ts title="sst.config.ts"
* return {
* identityPool: identityPool.id
* };
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-identity-pool.ts#L391-L416 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoIdentityProvider.providerName | public get providerName() {
return this.identityProvider.providerName;
} | /**
* The Cognito identity provider name.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-identity-provider.ts#L77-L79 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoIdentityProvider.nodes | public get nodes() {
return {
/**
* The Cognito identity provider.
*/
identityProvider: this.identityProvider,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-identity-provider.ts#L84-L91 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoUserPoolClient.id | public get id() {
return this.client.id;
} | /**
* The Cognito User Pool client ID.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-user-pool-client.ts#L72-L74 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoUserPoolClient.secret | public get secret() {
return this.client.clientSecret;
} | /**
* The Cognito User Pool client secret.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-user-pool-client.ts#L79-L81 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoUserPoolClient.nodes | public get nodes() {
return {
/**
* The Cognito User Pool client.
*/
client: this.client,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-user-pool-client.ts#L86-L93 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoUserPoolClient.getSSTLink | public getSSTLink() {
return {
properties: {
id: this.id,
secret: this.secret,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-user-pool-client.ts#L96-L103 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoUserPool.id | public get id() {
return this.userPool.id;
} | /**
* The Cognito User Pool ID.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-user-pool.ts#L624-L626 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoUserPool.arn | public get arn() {
return this.userPool.arn;
} | /**
* The Cognito User Pool ARN.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-user-pool.ts#L631-L633 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoUserPool.nodes | public get nodes() {
return {
/**
* The Amazon Cognito User Pool.
*/
userPool: this.userPool,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-user-pool.ts#L638-L645 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoUserPool.addClient | public addClient(name: string, args?: CognitoUserPoolClientArgs) {
// Note: Referencing an existing client will be implemented in the future:
// sst.aws.UserPool.getClient("pool", { userPooldID, clientID });
return new CognitoUserPoolClient(
name,
{
userPool: this.id,
...args,
},
{ provider: this.constructorOpts.provider },
);
} | /**
* Add a client to the User Pool.
*
* @param name Name of the client.
* @param args Configure the client.
*
* @example
*
* ```ts
* userPool.addClient("Web");
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-user-pool.ts#L659-L671 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoUserPool.addIdentityProvider | public addIdentityProvider(name: string, args: CognitoIdentityProviderArgs) {
return new CognitoIdentityProvider(
name,
{
userPool: this.id,
...args,
},
{ provider: this.constructorOpts.provider },
);
} | /**
* Add a federated identity provider to the User Pool.
*
* @param name Name of the identity provider.
* @param args Configure the identity provider.
*
* @example
*
* For example, add a GitHub (OIDC) identity provider.
*
* ```ts title="sst.config.ts"
* const GithubClientId = new sst.Secret("GITHUB_CLIENT_ID");
* const GithubClientSecret = new sst.Secret("GITHUB_CLIENT_SECRET");
*
* userPool.addIdentityProvider("GitHub", {
* type: "oidc",
* details: {
* authorize_scopes: "read:user user:email",
* client_id: GithubClientId.value,
* client_secret: GithubClientSecret.value,
* oidc_issuer: "https://github.com/",
* },
* attributes: {
* email: "email",
* username: "sub",
* },
* });
* ```
*
* Or add a Google identity provider.
*
* ```ts title="sst.config.ts"
* const GoogleClientId = new sst.Secret("GOOGLE_CLIENT_ID");
* const GoogleClientSecret = new sst.Secret("GOOGLE_CLIENT_SECRET");
*
* userPool.addIdentityProvider("Google", {
* type: "google",
* details: {
* authorize_scopes: "email profile",
* client_id: GoogleClientId.value,
* client_secret: GoogleClientSecret.value,
* },
* attributes: {
* email: "email",
* name: "name",
* username: "sub",
* },
* });
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-user-pool.ts#L723-L732 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoUserPool.getSSTLink | public getSSTLink() {
return {
properties: {
id: this.id,
},
include: [
permission({
actions: ["cognito-idp:*"],
resources: [this.userPool.arn],
}),
],
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-user-pool.ts#L735-L747 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | CognitoUserPool.get | public static get(name: string, userPoolID: Input<string>) {
const userPool = cognito.UserPool.get(`${name}UserPool`, userPoolID);
return new CognitoUserPool(name, {
ref: true,
userPool,
} as unknown as CognitoUserPoolArgs);
} | /**
* Reference an existing User Pool with the given ID. This is useful when you
* create a User Pool in one stage and want to share it in another. It avoids having to
* create a new User Pool in the other stage.
*
* :::tip
* You can use the `static get` method to share User Pools across stages.
* :::
*
* @param name The name of the component.
* @param userPoolID The ID of the existing User Pool.
*
* @example
* Imagine you create a User Pool in the `dev` stage. And in your personal stage `frank`,
* instead of creating a new pool, you want to share the same pool from `dev`.
*
* ```ts title="sst.config.ts"
* const userPool = $app.stage === "frank"
* ? sst.aws.CognitoUserPool.get("MyUserPool", "us-east-1_gcF5PjhQK")
* : new sst.aws.CognitoUserPool("MyUserPool");
* ```
*
* Here `us-east-1_gcF5PjhQK` is the ID of the User Pool created in the `dev` stage.
* You can find this by outputting the User Pool ID in the `dev` stage.
*
* ```ts title="sst.config.ts"
* return {
* userPool: userPool.id
* };
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cognito-user-pool.ts#L780-L786 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Cron.nodes | public get nodes() {
return {
/**
* The AWS Lambda Function that's invoked when the cron job runs.
*/
job: this.fn.apply((fn) => fn.getFunction()),
/**
* The EventBridge Rule resource.
*/
rule: this.rule,
/**
* The EventBridge Target resource.
*/
target: this.target,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/cron.ts#L185-L200 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | createAlias | function createAlias(
namePrefix: string,
record: AliasRecord,
opts: ComponentResourceOptions,
) {
return ["A", "AAAA"].map((type) =>
_createRecord(
namePrefix,
{
type,
name: record.name,
aliases: [
{
name: record.aliasName,
zoneId: record.aliasZone,
evaluateTargetHealth: true,
},
],
},
opts,
),
);
} | /**
* Creates alias records in the hosted zone.
*
* @param namePrefix The prefix to use for the resource names.
* @param record The alias record to create.
* @param opts The component resource options.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/dns.ts#L108-L130 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | createRecord | function createRecord(
namePrefix: string,
record: Record,
opts: ComponentResourceOptions,
) {
return _createRecord(
namePrefix,
{
type: record.type,
name: record.name,
ttl: 60,
records: [record.value],
},
opts,
);
} | /**
* Creates a DNS record in the hosted zone.
*
* @param namePrefix The prefix to use for the resource names.
* @param record The DNS record to create.
* @param opts The component resource options.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/dns.ts#L139-L154 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | DynamoLambdaSubscriber.nodes | public get nodes() {
return {
/**
* The Lambda function that'll be notified.
*/
function: this.fn.apply((fn) => fn.getFunction()),
/**
* The Lambda event source mapping.
*/
eventSourceMapping: this.eventSourceMapping,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/dynamo-lambda-subscriber.ts#L106-L117 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Dynamo.arn | public get arn() {
return this.table.arn;
} | /**
* The ARN of the DynamoDB Table.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/dynamo.ts#L523-L525 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Dynamo.name | public get name() {
return this.table.name;
} | /**
* The name of the DynamoDB Table.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/dynamo.ts#L530-L532 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Dynamo.nodes | public get nodes() {
return {
/**
* The Amazon DynamoDB Table.
*/
table: this.table,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/dynamo.ts#L537-L544 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Dynamo.subscribe | public subscribe(
subscriber: Input<string | FunctionArgs | FunctionArn>,
args?: DynamoSubscriberArgs,
) {
const sourceName = this.constructorName;
// Validate stream is enabled
if (!this.isStreamEnabled)
throw new Error(
`Cannot subscribe to "${sourceName}" because stream is not enabled.`,
);
return Dynamo._subscribe(
this.constructorName,
this.nodes.table.streamArn,
subscriber,
args,
{ provider: this.constructorOpts.provider },
);
} | /**
* Subscribe to the DynamoDB Stream of this table.
*
* :::note
* You'll first need to enable the `stream` before subscribing to it.
* :::
*
* @param subscriber The function that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* ```js title="sst.config.ts"
* table.subscribe("src/subscriber.handler");
* ```
*
* Add a filter to the subscription.
*
* ```js title="sst.config.ts"
* table.subscribe("src/subscriber.handler", {
* filters: [
* {
* dynamodb: {
* Keys: {
* CustomerName: {
* S: ["AnyCompany Industries"]
* }
* }
* }
* }
* ]
* });
* ```
*
* Customize the subscriber function.
*
* ```js title="sst.config.ts"
* table.subscribe({
* handler: "src/subscriber.handler",
* timeout: "60 seconds"
* });
* ```
*
* Or pass in the ARN of an existing Lambda function.
*
* ```js title="sst.config.ts"
* table.subscribe("arn:aws:lambda:us-east-1:123456789012:function:my-function");
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/dynamo.ts#L595-L614 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Dynamo.subscribe | public static subscribe(
streamArn: Input<string>,
subscriber: Input<string | FunctionArgs | FunctionArn>,
args?: DynamoSubscriberArgs,
) {
return output(streamArn).apply((streamArn) =>
this._subscribe(
logicalName(parseDynamoStreamArn(streamArn).tableName),
streamArn,
subscriber,
args,
),
);
} | /**
* Subscribe to the DynamoDB stream of a table that was not created in your app.
*
* @param streamArn The ARN of the DynamoDB Stream to subscribe to.
* @param subscriber The function that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* For example, let's say you have a DynamoDB stream ARN of an existing table.
*
* ```js title="sst.config.ts"
* const streamArn = "arn:aws:dynamodb:us-east-1:123456789012:table/MyTable/stream/2024-02-25T23:17:55.264";
* ```
*
* You can subscribe to it by passing in the ARN.
*
* ```js title="sst.config.ts"
* sst.aws.Dynamo.subscribe(streamArn, "src/subscriber.handler");
* ```
*
* Add a filter to the subscription.
*
* ```js title="sst.config.ts"
* sst.aws.Dynamo.subscribe(streamArn, "src/subscriber.handler", {
* filters: [
* {
* dynamodb: {
* Keys: {
* CustomerName: {
* S: ["AnyCompany Industries"]
* }
* }
* }
* }
* ]
* });
* ```
*
* Customize the subscriber function.
*
* ```js title="sst.config.ts"
* sst.aws.Dynamo.subscribe(streamArn, {
* handler: "src/subscriber.handler",
* timeout: "60 seconds"
* });
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/dynamo.ts#L664-L677 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Dynamo.get | public static get(name: string, tableName: Input<string>) {
return new Dynamo(name, {
ref: true,
table: dynamodb.Table.get(`${name}Table`, tableName),
} satisfies DynamoRef as unknown as DynamoArgs);
} | /**
* Reference an existing DynamoDB Table with the given table name. This is useful when you
* create a table in one stage and want to share it in another stage. It avoid having to
* create a new table in the other stage.
*
* :::tip
* You can use the `static get` method to share a table across stages.
* :::
*
* @param name The name of the component.
* @param tableName The name of the DynamoDB Table.
*
* @example
* Imagine you create a table in the `dev` stage. And in your personal stage `frank`,
* instead of creating a new table, you want to share the table from `dev`.
*
* ```ts title=sst.config.ts"
* const table = $app.stage === "frank"
* ? sst.aws.Dynamo.get("MyTable", "app-dev-mytable")
* : new sst.aws.Dynamo("MyTable");
* ```
*
* Here `app-dev-mytable` is the name of the DynamoDB Table created in the `dev` stage.
* You can find this by outputting the table name in the `dev` stage.
*
* ```ts title="sst.config.ts"
* return {
* table: table.name
* };
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/dynamo.ts#L741-L746 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Dynamo.getSSTLink | public getSSTLink() {
return {
properties: {
name: this.name,
},
include: [
permission({
actions: ["dynamodb:*"],
resources: [this.arn, interpolate`${this.arn}/*`],
}),
],
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/dynamo.ts#L749-L761 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Efs.id | public get id() {
return this._fileSystem.id;
} | /**
* The ID of the EFS file system.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/efs.ts#L245-L247 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Efs.accessPoint | public get accessPoint() {
return this._accessPoint.id;
} | /**
* The ID of the EFS access point.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/efs.ts#L252-L254 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Efs.nodes | public get nodes() {
return {
/**
* The Amazon EFS file system.
*/
fileSystem: this._fileSystem,
/**
* The Amazon EFS access point.
*/
accessPoint: this._accessPoint,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/efs.ts#L259-L270 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Efs.get | public static get(name: string, fileSystemID: Input<string>) {
const fileSystem = efs.FileSystem.get(`${name}FileSystem`, fileSystemID);
const accessPointId = efs
.getAccessPointsOutput({ fileSystemId: fileSystem.id })
.apply((accessPoints) => accessPoints.ids[0]);
const accessPoint = efs.AccessPoint.get(
`${name}AccessPoint`,
accessPointId,
);
return new Efs(name, {
ref: true,
fileSystem,
accessPoint,
} satisfies EfsRef as unknown as EfsArgs);
} | /**
* Reference an existing EFS file system with the given file system ID. This is useful when
* you create a EFS file system in one stage and want to share it in another. It avoids
* having to create a new EFS file system in the other stage.
*
* :::tip
* You can use the `static get` method to share EFS file systems across stages.
* :::
*
* @param name The name of the component.
* @param fileSystemID The ID of the existing EFS file system.
*
* @example
* Imagine you create a EFS file system in the `dev` stage. And in your personal stage
* `frank`, instead of creating a new file system, you want to share the same file system
* from `dev`.
*
* ```ts title="sst.config.ts"
* const efs = $app.stage === "frank"
* ? sst.aws.Efs.get("MyEfs", "app-dev-myefs")
* : new sst.aws.Efs("MyEfs", { vpc });
* ```
*
* Here `app-dev-myefs` is the ID of the file system created in the `dev` stage.
* You can find this by outputting the file system ID in the `dev` stage.
*
* ```ts title="sst.config.ts"
* return {
* id: efs.id
* };
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/efs.ts#L304-L318 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Email.sender | public get sender() {
return this._sender;
} | /**
* The sender email address or domain name.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/email.ts#L442-L444 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Email.configSet | public get configSet() {
return this.configurationSet.configurationSetName;
} | /**
* The name of the configuration set.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/email.ts#L449-L451 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Email.nodes | public get nodes() {
return {
/**
* The Amazon SES identity.
*/
identity: this.identity,
/**
* The Amazon SES configuration set.
*/
configurationSet: this.configurationSet,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/email.ts#L456-L467 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Email.getSSTLink | public getSSTLink() {
return {
properties: {
sender: this._sender,
configSet: this.configSet,
},
include: [
permission({
actions: ["ses:*"],
resources: [this.identity.arn, this.configurationSet.arn],
}),
],
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/email.ts#L470-L483 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Email.get | public static get(name: string, sender: Input<string>) {
const identity = sesv2.EmailIdentity.get(`${name}Identity`, sender);
const configSet = sesv2.ConfigurationSet.get(
`${name}Config`,
identity.configurationSetName.apply((v) => v!),
);
return new Email(name, {
ref: true,
identity,
configurationSet: configSet,
} as unknown as EmailArgs);
} | /**
* Reference an existing Email component with the given Amazon SES identity. This is useful
* when you create an SES identity in one stage and want to share it in another stage. It
* avoids having to create a new Email component in the other stage.
*
* @param name The name of the component.
* @param sender The email address or domain name of the existing SES identity.
*
* @example
* Imagine you create an Email component in the `dev` stage. And in your personal stage `frank`,
* instead of creating a new component, you want to share the one from `dev`.
*
* ```ts title="sst.config.ts"
* const email = $app.stage === "frank"
* ? sst.aws.Email.get("MyEmail", "spongebob@example.com")
* : new sst.aws.Email("MyEmail", {
* sender: "spongebob@example.com",
* });
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/email.ts#L505-L517 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Function.nodes | public get nodes() {
return {
/**
* The IAM Role the function will use.
*/
role: this.role,
/**
* The AWS Lambda function.
*/
function: this.function,
/**
* The CloudWatch Log Group the function logs are stored.
*/
logGroup: this.logGroup,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/function.ts#L2066-L2081 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Function.url | public get url() {
return this.fnUrl.apply((url) => {
if (!url)
throw new VisibleError(
`Function URL is not enabled. Enable it with "url: true".`,
);
return url.functionUrl;
});
} | /**
* The Lambda function URL if `url` is enabled.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/function.ts#L2086-L2094 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Function.name | public get name() {
return this.function.name;
} | /**
* The name of the Lambda function.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/function.ts#L2099-L2101 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Function.arn | public get arn() {
return this.function.arn;
} | /**
* The ARN of the Lambda function.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/function.ts#L2106-L2108 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Function.fromDefinition | static fromDefinition(
name: string,
definition: Input<string | FunctionArgs>,
override: Pick<FunctionArgs, "description" | "permissions">,
argsTransform?: Transform<FunctionArgs>,
opts?: ComponentResourceOptions,
) {
return output(definition).apply((definition) => {
if (typeof definition === "string") {
return new Function(
...transform(
argsTransform,
name,
{ handler: definition, ...override },
opts || {},
),
);
} else if (definition.handler) {
return new Function(
...transform(
argsTransform,
name,
{
...definition,
...override,
permissions: all([
definition.permissions,
override?.permissions,
]).apply(([permissions, overridePermissions]) => [
...(permissions ?? []),
...(overridePermissions ?? []),
]),
},
opts || {},
),
);
}
throw new Error(`Invalid function definition for the "${name}" Function`);
});
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/function.ts#L2111-L2150 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Function.getSSTLink | public getSSTLink() {
return {
properties: {
name: this.name,
url: this.fnUrl.apply((url) => url?.functionUrl ?? output(undefined)),
},
include: [
permission({
actions: ["lambda:InvokeFunction"],
resources: [this.function.arn],
}),
],
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/function.ts#L2153-L2166 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | KinesisStreamLambdaSubscriber.nodes | public get nodes() {
const self = this;
return {
/**
* The Lambda function that'll be notified.
*/
function: self.fn.apply((fn) => fn.getFunction()),
/**
* The Lambda event source mapping.
*/
eventSourceMapping: self.eventSourceMapping,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/kinesis-stream-lambda-subscriber.ts#L106-L118 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | KinesisStream.subscribe | public subscribe(
subscriber: Input<string | FunctionArgs | FunctionArn>,
args?: KinesisStreamLambdaSubscriberArgs,
) {
return KinesisStream._subscribe(
this.constructorName,
this.nodes.stream.arn,
subscriber,
args,
{ provider: this.constructorOpts.provider },
);
} | /**
* Subscribe to the Kinesis stream.
*
* @param subscriber The function that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* ```js title="sst.config.ts"
* stream.subscribe("src/subscriber.handler");
* ```
*
* Add a filter to the subscription.
*
* ```js title="sst.config.ts"
* stream.subscribe("src/subscriber.handler", {
* filters: [
* {
* data: {
* order: {
* type: ["buy"],
* },
* },
* },
* ],
* });
* ```
*
* Customize the subscriber function.
*
* ```js title="sst.config.ts"
* stream.subscribe({
* handler: "src/subscriber.handler",
* timeout: "60 seconds"
* });
* ```
*
* Or pass in the ARN of an existing Lambda function.
*
* ```js title="sst.config.ts"
* stream.subscribe("arn:aws:lambda:us-east-1:123456789012:function:my-function");
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/kinesis-stream.ts#L197-L208 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | KinesisStream.subscribe | public static subscribe(
streamArn: Input<string>,
subscriber: Input<string | FunctionArgs | FunctionArn>,
args?: KinesisStreamLambdaSubscriberArgs,
) {
return output(streamArn).apply((streamArn) =>
this._subscribe(
logicalName(parseKinesisStreamArn(streamArn).streamName),
streamArn,
subscriber,
args,
),
);
} | /**
* Subscribe to the Kinesis stream that was not created in your app.
*
* @param streamArn The ARN of the Kinesis Stream to subscribe to.
* @param subscriber The function that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* For example, let's say you have the ARN of an existing Kinesis stream.
*
* ```js title="sst.config.ts"
* const streamArn = "arn:aws:kinesis:us-east-1:123456789012:stream/MyStream";
* ```
*
* You can subscribe to it by passing in the ARN.
*
* ```js title="sst.config.ts"
* sst.aws.KinesisStream.subscribe(streamArn, "src/subscriber.handler");
* ```
*
* Add a filter to the subscription.
*
* ```js title="sst.config.ts"
* sst.aws.KinesisStream.subscribe(streamArn, "src/subscriber.handler", {
* filters: [
* {
* data: {
* order: {
* type: ["buy"],
* },
* },
* },
* ],
* });
* ```
*
* Customize the subscriber function.
*
* ```js title="sst.config.ts"
* sst.aws.KinesisStream.subscribe(streamArn, {
* handler: "src/subscriber.handler",
* timeout: "60 seconds"
* });
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/kinesis-stream.ts#L256-L269 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | KinesisStream.nodes | public get nodes() {
return {
/**
* The Amazon Kinesis Data Stream.
*/
stream: this.stream,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/kinesis-stream.ts#L314-L321 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | KinesisStream.getSSTLink | getSSTLink() {
return {
properties: {
name: this.stream.name,
},
include: [
permission({
actions: ["kinesis:*"],
resources: [this.nodes.stream.arn],
}),
],
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/kinesis-stream.ts#L324-L336 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Nextjs.url | public get url() {
return all([this.cdn?.domainUrl, this.cdn?.url, this.devUrl]).apply(
([domainUrl, url, dev]) => domainUrl ?? url ?? dev!,
);
} | /**
* The URL of the Next.js app.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated CloudFront URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/nextjs.ts#L1374-L1378 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Nextjs.nodes | public get nodes() {
return {
/**
* The AWS Lambda server function that renders the app.
*/
server: this.server,
/**
* The Amazon S3 Bucket that stores the assets.
*/
assets: this.assets,
/**
* The Amazon CloudFront CDN that serves the app.
*/
cdn: this.cdn,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/nextjs.ts#L1383-L1398 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Nextjs.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/nextjs.ts#L1401-L1407 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Nuxt.url | public get url() {
return all([this.cdn?.domainUrl, this.cdn?.url, this.devUrl]).apply(
([domainUrl, url, dev]) => domainUrl ?? url ?? dev!,
);
} | /**
* The URL of the Nuxt app.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated CloudFront URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/nuxt.ts#L510-L514 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Nuxt.nodes | public get nodes() {
return {
/**
* The AWS Lambda server function that renders the site.
*/
server: this.server,
/**
* The Amazon S3 Bucket that stores the assets.
*/
assets: this.assets,
/**
* The Amazon CloudFront CDN that serves the site.
*/
cdn: this.cdn,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/nuxt.ts#L519-L534 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Nuxt.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/nuxt.ts#L537-L543 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.clusterID | public get clusterID() {
return this.cluster.id;
} | /**
* The ID of the RDS Cluster.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres-v1.ts#L369-L371 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.clusterArn | public get clusterArn() {
return this.cluster.arn;
} | /**
* The ARN of the RDS Cluster.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres-v1.ts#L376-L378 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.secretArn | public get secretArn() {
return this.cluster.masterUserSecrets[0].secretArn;
} | /**
* The ARN of the master user secret.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres-v1.ts#L383-L385 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.username | public get username() {
return this.cluster.masterUsername;
} | /** The username of the master user. */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres-v1.ts#L388-L390 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.password | public get password() {
return this.cluster.masterPassword.apply((val) => {
if (val) return output(val);
const parsed = jsonParse(
this.secret.apply((secret) =>
secret ? secret.secretString : output("{}"),
),
) as Output<{ username: string; password: string }>;
return parsed.password;
});
} | /** The password of the master user. */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres-v1.ts#L393-L403 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.database | public get database() {
return this.cluster.databaseName;
} | /**
* The name of the database.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres-v1.ts#L408-L410 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.port | public get port() {
return this.instance.port;
} | /**
* The port of the database.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres-v1.ts#L415-L417 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.host | public get host() {
return this.instance.endpoint;
} | /**
* The host of the database.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres-v1.ts#L422-L424 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.getSSTLink | public getSSTLink() {
return {
properties: {
clusterArn: this.clusterArn,
secretArn: this.secretArn,
database: this.cluster.databaseName,
username: this.username,
password: this.password,
port: this.port,
host: this.host,
},
include: [
permission({
actions: ["secretsmanager:GetSecretValue"],
resources: [
this.cluster.masterUserSecrets[0].secretArn.apply(
(v) => v ?? "arn:aws:iam::rdsdoesnotusesecretmanager",
),
],
}),
permission({
actions: [
"rds-data:BatchExecuteStatement",
"rds-data:BeginTransaction",
"rds-data:CommitTransaction",
"rds-data:ExecuteStatement",
"rds-data:RollbackTransaction",
],
resources: [this.cluster.arn],
}),
],
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres-v1.ts#L434-L466 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.get | public static get(name: string, clusterID: Input<string>) {
const cluster = rds.Cluster.get(`${name}Cluster`, clusterID);
const instances = rds.getInstancesOutput({
filters: [{ name: "db-cluster-id", values: [clusterID] }],
});
const instance = rds.ClusterInstance.get(
`${name}Instance`,
instances.apply((instances) => {
if (instances.instanceIdentifiers.length === 0)
throw new Error(`No instance found for cluster ${clusterID}`);
return instances.instanceIdentifiers[0];
}),
);
return new Postgres(name, {
ref: true,
cluster,
instance,
} as unknown as PostgresArgs);
} | /**
* Reference an existing Postgres cluster with the given cluster name. This is useful when you
* create a Postgres cluster in one stage and want to share it in another. It avoids having to
* create a new Postgres cluster in the other stage.
*
* :::tip
* You can use the `static get` method to share Postgres clusters across stages.
* :::
*
* @param name The name of the component.
* @param clusterID The id of the existing Postgres cluster.
*
* @example
* Imagine you create a cluster in the `dev` stage. And in your personal stage `frank`,
* instead of creating a new cluster, you want to share the same cluster from `dev`.
*
* ```ts title="sst.config.ts"
* const database = $app.stage === "frank"
* ? sst.aws.Postgres.v1.get("MyDatabase", "app-dev-mydatabase")
* : new sst.aws.Postgres.v1("MyDatabase");
* ```
*
* Here `app-dev-mydatabase` is the ID of the cluster created in the `dev` stage.
* You can find this by outputting the cluster ID in the `dev` stage.
*
* ```ts title="sst.config.ts"
* return {
* cluster: database.clusterID
* };
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres-v1.ts#L499-L517 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.id | public get id() {
return this.instance.identifier;
} | /**
* The identifier of the Postgres instance.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres.ts#L522-L524 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.proxyId | public get proxyId() {
return this.proxy.apply((v) => {
if (!v)
throw new VisibleError(
`Proxy is not enabled. Enable it with "proxy: true".`,
);
return v.id;
});
} | /**
* The name of the Postgres proxy.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres.ts#L529-L537 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.username | public get username() {
return this.instance.username;
} | /** The username of the master user. */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres.ts#L540-L542 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.password | public get password() {
return this._password;
} | /** The password of the master user. */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres.ts#L545-L547 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.database | public get database() {
return this.instance.dbName;
} | /**
* The name of the database.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres.ts#L552-L554 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.port | public get port() {
return this.instance.port;
} | /**
* The port of the database.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres.ts#L559-L561 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.host | public get host() {
return all([this.instance.endpoint, this.proxy]).apply(
([endpoint, proxy]) => proxy?.endpoint ?? output(endpoint.split(":")[0]),
);
} | /**
* The host of the database.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres.ts#L566-L570 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.getSSTLink | public getSSTLink() {
return {
properties: {
database: this.database,
username: this.username,
password: this.password,
port: this.port,
host: this.host,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres.ts#L579-L589 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Postgres.get | public static get(name: string, args: PostgresGetArgs) {
const instance = rds.Instance.get(`${name}Instance`, args.id);
const proxy = args.proxyId
? rds.Proxy.get(`${name}Proxy`, args.proxyId)
: undefined;
// get secret
const secret = instance.tags.apply((tags) =>
tags?.["sst:lookup:password"]
? secretsmanager.getSecretVersionOutput({
secretId: tags["sst:lookup:password"],
})
: output(undefined),
);
const password = secret.apply((v) => {
if (!v)
throw new VisibleError(`Failed to get password for Postgres ${name}.`);
return JSON.parse(v.secretString).password as string;
});
return new Postgres(name, {
ref: true,
instance,
password,
proxy,
} as unknown as PostgresArgs);
} | /**
* Reference an existing Postgres database with the given name. This is useful when you
* create a Postgres database in one stage and want to share it in another. It avoids
* having to create a new Postgres database in the other stage.
*
* :::tip
* You can use the `static get` method to share Postgres databases across stages.
* :::
*
* @param name The name of the component.
* @param args The arguments to get the Postgres database.
*
* @example
* Imagine you create a database in the `dev` stage. And in your personal stage `frank`,
* instead of creating a new database, you want to share the same database from `dev`.
*
* ```ts title="sst.config.ts"
* const database = $app.stage === "frank"
* ? sst.aws.Postgres.get("MyDatabase", {
* id: "app-dev-mydatabase",
* proxyId: "app-dev-mydatabase-proxy",
* })
* : new sst.aws.Postgres("MyDatabase", {
* proxy: true,
* });
* ```
*
* Here `app-dev-mydatabase` is the ID of the database, and `app-dev-mydatabase-proxy`
* is the ID of the proxy created in the `dev` stage. You can find these by outputting
* the database ID and proxy ID in the `dev` stage.
*
* ```ts title="sst.config.ts"
* return {
* id: database.id,
* proxyId: database.proxyId,
* };
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/postgres.ts#L629-L655 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | QueueLambdaSubscriber.nodes | public get nodes() {
const self = this;
return {
/**
* The Lambda function that'll be notified.
*/
function: this.fn.apply((fn) => fn.getFunction()),
/**
* The Lambda event source mapping.
*/
eventSourceMapping: this.eventSourceMapping,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/queue-lambda-subscriber.ts#L114-L126 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Queue.arn | public get arn() {
return this.queue.arn;
} | /**
* The ARN of the SQS Queue.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/queue.ts#L410-L412 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Queue.url | public get url() {
return this.queue.url;
} | /**
* The SQS Queue URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/queue.ts#L417-L419 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Queue.nodes | public get nodes() {
return {
/**
* The Amazon SQS Queue.
*/
queue: this.queue,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/queue.ts#L424-L431 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Queue.subscribe | public subscribe(
subscriber: Input<string | FunctionArgs | FunctionArn>,
args?: QueueSubscriberArgs,
opts?: ComponentResourceOptions,
) {
if (this.isSubscribed)
throw new VisibleError(
`Cannot subscribe to the "${this.constructorName}" queue multiple times. An SQS Queue can only have one subscriber.`,
);
this.isSubscribed = true;
return Queue._subscribeFunction(
this.constructorName,
this.arn,
subscriber,
args,
{ ...opts, provider: this.constructorOpts.provider },
);
} | /**
* Subscribe to this queue.
*
* @param subscriber The function that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* ```js title="sst.config.ts"
* queue.subscribe("src/subscriber.handler");
* ```
*
* Add a filter to the subscription.
*
* ```js title="sst.config.ts"
* queue.subscribe("src/subscriber.handler", {
* filters: [
* {
* body: {
* RequestCode: ["BBBB"]
* }
* }
* ]
* });
* ```
*
* Customize the subscriber function.
*
* ```js title="sst.config.ts"
* queue.subscribe({
* handler: "src/subscriber.handler",
* timeout: "60 seconds"
* });
* ```
*
* Or pass in the ARN of an existing Lambda function.
*
* ```js title="sst.config.ts"
* queue.subscribe("arn:aws:lambda:us-east-1:123456789012:function:my-function");
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/queue.ts#L474-L492 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Queue.subscribe | public static subscribe(
queueArn: Input<string>,
subscriber: Input<string | FunctionArgs | FunctionArn>,
args?: QueueSubscriberArgs,
opts?: ComponentResourceOptions,
) {
return output(queueArn).apply((queueArn) =>
this._subscribeFunction(
logicalName(parseQueueArn(queueArn).queueName),
queueArn,
subscriber,
args,
opts,
),
);
} | /**
* Subscribe to an SQS Queue that was not created in your app.
*
* @param queueArn The ARN of the SQS Queue to subscribe to.
* @param subscriber The function that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* For example, let's say you have an existing SQS Queue with the following ARN.
*
* ```js title="sst.config.ts"
* const queueArn = "arn:aws:sqs:us-east-1:123456789012:MyQueue";
* ```
*
* You can subscribe to it by passing in the ARN.
*
* ```js title="sst.config.ts"
* sst.aws.Queue.subscribe(queueArn, "src/subscriber.handler");
* ```
*
* Add a filter to the subscription.
*
* ```js title="sst.config.ts"
* sst.aws.Queue.subscribe(queueArn, "src/subscriber.handler", {
* filters: [
* {
* body: {
* RequestCode: ["BBBB"]
* }
* }
* ]
* });
* ```
*
* Customize the subscriber function.
*
* ```js title="sst.config.ts"
* sst.aws.Queue.subscribe(queueArn, {
* handler: "src/subscriber.handler",
* timeout: "60 seconds"
* });
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/queue.ts#L538-L553 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Queue.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
include: [
permission({
actions: ["sqs:*"],
resources: [this.arn],
}),
],
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/queue.ts#L578-L590 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | React.url | public get url() {
return all([this.cdn?.domainUrl, this.cdn?.url, this.devUrl]).apply(
([domainUrl, url, dev]) => domainUrl ?? url ?? dev!,
);
} | /**
* The URL of the React app.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated CloudFront URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/react.ts#L644-L648 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | React.nodes | public get nodes() {
return {
/**
* The AWS Lambda server function that renders the site.
*/
server: this.server,
/**
* The Amazon S3 Bucket that stores the assets.
*/
assets: this.assets,
/**
* The Amazon CloudFront CDN that serves the app.
*/
cdn: this.cdn,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/react.ts#L653-L668 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | React.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/react.ts#L671-L677 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | RealtimeLambdaSubscriber.nodes | public get nodes() {
return {
/**
* The Lambda function that'll be notified.
*/
function: this.fn.apply((fn) => fn.getFunction()),
/**
* The Lambda permission.
*/
permission: this.permission,
/**
* The IoT Topic rule.
*/
rule: this.rule,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/realtime-lambda-subscriber.ts#L106-L121 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Realtime.endpoint | public get endpoint() {
return this.iotEndpoint;
} | /**
* The IoT endpoint.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/realtime.ts#L234-L236 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Realtime.authorizer | public get authorizer() {
return this.iotAuthorizer.name;
} | /**
* The name of the IoT authorizer.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/realtime.ts#L241-L243 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Realtime.nodes | public get nodes() {
return {
/**
* The IoT authorizer resource.
*/
authorizer: this.iotAuthorizer,
/**
* The IoT authorizer function resource.
*/
authHandler: this.authHadler,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/realtime.ts#L248-L259 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Realtime.subscribe | public subscribe(
subscriber: Input<string | FunctionArgs | FunctionArn>,
args: RealtimeSubscriberArgs,
) {
return all([subscriber, args.filter]).apply(([subscriber, filter]) => {
const suffix = logicalName(
hashStringToPrettyString(
[
filter,
typeof subscriber === "string" ? subscriber : subscriber.handler,
].join(""),
6,
),
);
return new RealtimeLambdaSubscriber(
`${this.constructorName}Subscriber${suffix}`,
{
iot: { name: this.constructorName },
subscriber,
...args,
},
{ provider: this.constructorOpts.provider },
);
});
} | /**
* Subscribe to this Realtime server.
*
* @param subscriber The function that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* ```js title="sst.config.ts"
* server.subscribe("src/subscriber.handler", {
* filter: `${$app.name}/${$app.stage}/chat/room1`
* });
* ```
*
* Customize the subscriber function.
*
* ```js title="sst.config.ts"
* server.subscribe(
* {
* handler: "src/subscriber.handler",
* timeout: "60 seconds"
* },
* {
* filter: `${$app.name}/${$app.stage}/chat/room1`
* }
* );
* ```
*
* Or pass in the ARN of an existing Lambda function.
*
* ```js title="sst.config.ts"
* server.subscribe("arn:aws:lambda:us-east-1:123456789012:function:my-function", {
* filter: `${$app.name}/${$app.stage}/chat/room1`
* });
* ```
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/realtime.ts#L297-L322 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Realtime.getSSTLink | public getSSTLink() {
return {
properties: {
endpoint: this.endpoint,
authorizer: this.authorizer,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/realtime.ts#L325-L332 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Redis.clusterID | public get clusterID() {
return this.cluster.id;
} | /**
* The ID of the Redis cluster.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/redis.ts#L255-L257 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Redis.username | public get username() {
return output("default");
} | /**
* The username to connect to the Redis cluster.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/redis.ts#L262-L264 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Redis.password | public get password() {
return this.cluster.authToken.apply((v) => v!);
} | /**
* The password to connect to the Redis cluster.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/redis.ts#L269-L271 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Redis.host | public get host() {
return this.cluster.configurationEndpointAddress;
} | /**
* The host to connect to the Redis cluster.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/redis.ts#L276-L278 | d5c4855b2618198f5e9af315c5e67d4163df165a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.