How to use the cloudform-types.Fn.Join function in cloudform-types

To help you get started, we’ve selected a few cloudform-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-amplify / amplify-cli / packages / graphql-transformer-core / src / util / splitStack.ts View on Github external
...acc,
        [name]: Fn.Ref(name),
      }),
      defaultParameterValues
    );
    // Also forward the API id of the top level API.
    // allParamValues[ResourceConstants.RESOURCES.GraphQLAPILogicalID] = Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId')
    for (const stackName of stackFileNames) {
      const dependsOnStacks = stackInfo.stackDependencyMap[stackName] || [];
      const extraParams = stackInfo.stackParameterMap[stackName] || {};
      let stackResource = new CloudFormation.Stack({
        Parameters: {
          ...allParamValues,
          ...extraParams,
        },
        TemplateURL: Fn.Join('/', [
          'https://s3.amazonaws.com',
          Fn.Ref(opts.deployment.deploymentBucketParameterName),
          Fn.Ref(opts.deployment.deploymentKeyParameterName),
          'stacks',
          stackName + '.json',
        ]),
      }).dependsOn([...defaultDependencies, ...dependsOnStacks]);
      root.Resources[stackName] = stackResource;
    }
    return root;
  }
github aws-amplify / amplify-cli / packages / graphql-transformer-core / src / util / syncUtils.ts View on Github external
export function syncLambdaIAMRole({ name, region }: { name: string; region?: string }) {
    return new IAM.Role({
      RoleName: Fn.If(
        ResourceConstants.CONDITIONS.HasEnvironmentParameter,
        Fn.Join('-', [
          name.slice(0, 26), // max of 64. 64-10-26-28 = 0
          Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'), // 26
          Fn.Ref(ResourceConstants.PARAMETERS.Env), // 10
        ]),
        Fn.Join('-', [
          // tslint:disable-next-line: no-magic-numbers
          name.slice(0, 37), // max of 64. 64-26-38 = 0
          Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'), // 26
        ])
      ),
      AssumeRolePolicyDocument: {
        Version: '2012-10-17',
        Statement: [
          {
            Effect: 'Allow',
            Principal: {
              Service: 'appsync.amazonaws.com',
            },
            Action: 'sts:AssumeRole',
          },
        ],
github aws-amplify / amplify-cli / packages / graphql-elasticsearch-transformer / src / resources.ts View on Github external
public makeDynamoDBStreamingFunction() {
    return new Lambda.Function({
      Code: {
        S3Bucket: Fn.Ref(ResourceConstants.PARAMETERS.S3DeploymentBucket),
        S3Key: Fn.Join('/', [
          Fn.Ref(ResourceConstants.PARAMETERS.S3DeploymentRootKey),
          'functions',
          Fn.Join('.', [ResourceConstants.RESOURCES.ElasticsearchStreamingLambdaFunctionLogicalID, 'zip']),
        ]),
      },
      FunctionName: this.joinWithEnv('-', [
        Fn.Ref(ResourceConstants.PARAMETERS.ElasticsearchStreamingFunctionName),
        Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
      ]),
      Handler: Fn.Ref(ResourceConstants.PARAMETERS.ElasticsearchStreamingLambdaHandlerName),
      Role: Fn.GetAtt(ResourceConstants.RESOURCES.ElasticsearchStreamingLambdaIAMRoleLogicalID, 'Arn'),
      Runtime: Fn.Ref(ResourceConstants.PARAMETERS.ElasticsearchStreamingLambdaRuntime),
      Layers: [Fn.FindInMap('LayerResourceMapping', Fn.Ref('AWS::Region'), 'layerRegion')],
      Environment: {
        Variables: {
          ES_ENDPOINT: Fn.Join('', ['https://', Fn.GetAtt(ResourceConstants.RESOURCES.ElasticsearchDomainLogicalID, 'DomainEndpoint')]),
          ES_REGION: Fn.Select(3, Fn.Split(':', Fn.GetAtt(ResourceConstants.RESOURCES.ElasticsearchDomainLogicalID, 'DomainArn'))),
          DEBUG: Fn.Ref(ResourceConstants.PARAMETERS.ElasticsearchDebugStreamingLambda),
        },
github aws-amplify / amplify-cli / packages / graphql-elasticsearch-transformer / src / resources.ts View on Github external
private joinWithEnv(separator: string, listToJoin: any[]) {
    return Fn.If(
      ResourceConstants.CONDITIONS.HasEnvironmentParameter,
      Fn.Join(separator, [...listToJoin, Fn.Ref(ResourceConstants.PARAMETERS.Env)]),
      Fn.Join(separator, listToJoin)
    );
  }
github aws-amplify / amplify-cli / packages / graphql-dynamodb-transformer / src / resources.ts View on Github external
public makeAppSyncAPI() {
    return new AppSync.GraphQLApi({
      Name: Fn.If(
        ResourceConstants.CONDITIONS.HasEnvironmentParameter,
        Fn.Join('-', [Fn.Ref(ResourceConstants.PARAMETERS.AppSyncApiName), Fn.Ref(ResourceConstants.PARAMETERS.Env)]),
        Fn.Ref(ResourceConstants.PARAMETERS.AppSyncApiName)
      ),
      AuthenticationType: 'API_KEY',
    });
  }
github aws-amplify / amplify-cli / packages / graphql-dynamodb-transformer / src / resources.ts View on Github external
public makeDataSourceOutput(resourceId: string): Output {
    return {
      Description: 'Your model DataSource name.',
      Value: Fn.GetAtt(resourceId, 'Name'),
      Export: {
        Name: Fn.Join(':', [Fn.Ref(ResourceConstants.PARAMETERS.AppSyncApiId), 'GetAtt', resourceId, 'Name']),
      },
    };
  }
github aws-amplify / amplify-cli / packages / graphql-transformer-core / src / util / syncUtils.ts View on Github external
function joinWithEnv(separator: string, listToJoin: any[]) {
    return Fn.If(
      ResourceConstants.CONDITIONS.HasEnvironmentParameter,
      Fn.Join(separator, [...listToJoin, Fn.Ref(ResourceConstants.PARAMETERS.Env)]),
      Fn.Join(separator, listToJoin)
    );
  }
  export function syncLambdaIAMRole({ name, region }: { name: string; region?: string }) {
github aws-amplify / amplify-cli / packages / graphql-elasticsearch-transformer / src / resources.ts View on Github external
private joinWithEnv(separator: string, listToJoin: any[]) {
    return Fn.If(
      ResourceConstants.CONDITIONS.HasEnvironmentParameter,
      Fn.Join(separator, [...listToJoin, Fn.Ref(ResourceConstants.PARAMETERS.Env)]),
      Fn.Join(separator, listToJoin)
    );
  }
github aws-amplify / amplify-cli / packages / graphql-elasticsearch-transformer / src / resources.ts View on Github external
public makeDynamoDBStreamingFunction() {
    return new Lambda.Function({
      Code: {
        S3Bucket: Fn.Ref(ResourceConstants.PARAMETERS.S3DeploymentBucket),
        S3Key: Fn.Join('/', [
          Fn.Ref(ResourceConstants.PARAMETERS.S3DeploymentRootKey),
          'functions',
          Fn.Join('.', [ResourceConstants.RESOURCES.ElasticsearchStreamingLambdaFunctionLogicalID, 'zip']),
        ]),
      },
      FunctionName: this.joinWithEnv('-', [
        Fn.Ref(ResourceConstants.PARAMETERS.ElasticsearchStreamingFunctionName),
        Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
      ]),
      Handler: Fn.Ref(ResourceConstants.PARAMETERS.ElasticsearchStreamingLambdaHandlerName),
      Role: Fn.GetAtt(ResourceConstants.RESOURCES.ElasticsearchStreamingLambdaIAMRoleLogicalID, 'Arn'),
      Runtime: Fn.Ref(ResourceConstants.PARAMETERS.ElasticsearchStreamingLambdaRuntime),
      Layers: [Fn.FindInMap('LayerResourceMapping', Fn.Ref('AWS::Region'), 'layerRegion')],
      Environment: {
        Variables: {
          ES_ENDPOINT: Fn.Join('', ['https://', Fn.GetAtt(ResourceConstants.RESOURCES.ElasticsearchDomainLogicalID, 'DomainEndpoint')]),