How to use the cloudform-types.Refs.NoValue 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-key-transformer / src / KeyTransformer.ts View on Github external
// This is an LSI.
                // Add the new secondary index and update the table's attribute definitions.
                tableResource.Properties.LocalSecondaryIndexes = append(
                    tableResource.Properties.LocalSecondaryIndexes,
                    new LocalSecondaryIndex(baseIndexProperties)
                )
            } else {
                // This is a GSI.
                // Add the new secondary index and update the table's attribute definitions.
                tableResource.Properties.GlobalSecondaryIndexes = append(
                    tableResource.Properties.GlobalSecondaryIndexes,
                    new GlobalSecondaryIndex({
                        ...baseIndexProperties,
                        ProvisionedThroughput: Fn.If(
                            ResourceConstants.CONDITIONS.ShouldUsePayPerRequestBilling,
                            Refs.NoValue,
                            {
                                ReadCapacityUnits: Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBModelTableReadIOPS),
                                WriteCapacityUnits: Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBModelTableWriteIOPS)
                            }
                        ) as any,
                    })
                )
            }
            const existingAttrDefSet = new Set(tableResource.Properties.AttributeDefinitions.map(ad => ad.AttributeName));
            for (const attr of attrDefs) {
                if (!existingAttrDefSet.has(attr.AttributeName)) {
                    tableResource.Properties.AttributeDefinitions.push(attr);
                }
            }
        }
    }
github aws-amplify / amplify-cli / packages / graphql-connection-transformer / src / resources.ts View on Github external
// If the GSI does not exist yet then add it.
        const existingGSI = gsis.find(gsi => gsi.IndexName === connectionGSIName)
        if (!existingGSI) {
            const keySchema = [new KeySchema({ AttributeName: connectionAttributeName, KeyType: 'HASH' })]
            if (sortField) {
                keySchema.push(new KeySchema({ AttributeName: sortField.name, KeyType: 'RANGE' }))
            }
            gsis.push(new GlobalSecondaryIndex({
                IndexName: connectionGSIName,
                KeySchema: keySchema,
                Projection: new Projection({
                    ProjectionType: 'ALL'
                }),
                ProvisionedThroughput: Fn.If(
                    ResourceConstants.CONDITIONS.ShouldUsePayPerRequestBilling,
                    Refs.NoValue,
                    {
                        ReadCapacityUnits: Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBModelTableReadIOPS),
                        WriteCapacityUnits: Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBModelTableWriteIOPS)
                    }
                ) as any,
            }))
        }

        // If the attribute definition does not exist yet, add it.
        const attributeDefinitions = table.Properties.AttributeDefinitions as AttributeDefinition[]
        const existingAttribute = attributeDefinitions.find(attr => attr.AttributeName === connectionAttributeName)
        if (!existingAttribute) {
            attributeDefinitions.push(new AttributeDefinition({
                AttributeName: connectionAttributeName,
                AttributeType: 'S'
            }))
github aws-amplify / amplify-cli / packages / graphql-dynamodb-transformer / src / resources.ts View on Github external
},
            {
              AttributeName: rangeKey,
              AttributeType: 'S',
            },
          ]
        : [{ AttributeName: hashKey, AttributeType: 'S' }];
    return new DynamoDB.Table({
      TableName: this.dynamoDBTableName(typeName),
      KeySchema: keySchema,
      AttributeDefinitions: attributeDefinitions,
      StreamSpecification: {
        StreamViewType: 'NEW_AND_OLD_IMAGES',
      },
      BillingMode: Fn.If(ResourceConstants.CONDITIONS.ShouldUsePayPerRequestBilling, 'PAY_PER_REQUEST', Refs.NoValue),
      ProvisionedThroughput: Fn.If(ResourceConstants.CONDITIONS.ShouldUsePayPerRequestBilling, Refs.NoValue, {
        ReadCapacityUnits: Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBModelTableReadIOPS),
        WriteCapacityUnits: Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBModelTableWriteIOPS),
      }) as any,
      SSESpecification: {
        SSEEnabled: Fn.If(ResourceConstants.CONDITIONS.ShouldUseServerSideEncryption, true, false),
      },
      PointInTimeRecoverySpecification: Fn.If(
        ResourceConstants.CONDITIONS.ShouldUsePointInTimeRecovery,
        {
          PointInTimeRecoveryEnabled: true,
        },
        Refs.NoValue
      ) as any,
      ...(isSyncEnabled && {
        TimeToLiveSpecification: SyncUtils.syncTTLConfig(),
      }),
github aws-amplify / amplify-cli / packages / graphql-dynamodb-transformer / src / resources.ts View on Github external
AttributeType: 'S',
            },
            {
              AttributeName: rangeKey,
              AttributeType: 'S',
            },
          ]
        : [{ AttributeName: hashKey, AttributeType: 'S' }];
    return new DynamoDB.Table({
      TableName: this.dynamoDBTableName(typeName),
      KeySchema: keySchema,
      AttributeDefinitions: attributeDefinitions,
      StreamSpecification: {
        StreamViewType: 'NEW_AND_OLD_IMAGES',
      },
      BillingMode: Fn.If(ResourceConstants.CONDITIONS.ShouldUsePayPerRequestBilling, 'PAY_PER_REQUEST', Refs.NoValue),
      ProvisionedThroughput: Fn.If(ResourceConstants.CONDITIONS.ShouldUsePayPerRequestBilling, Refs.NoValue, {
        ReadCapacityUnits: Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBModelTableReadIOPS),
        WriteCapacityUnits: Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBModelTableWriteIOPS),
      }) as any,
      SSESpecification: {
        SSEEnabled: Fn.If(ResourceConstants.CONDITIONS.ShouldUseServerSideEncryption, true, false),
      },
      PointInTimeRecoverySpecification: Fn.If(
        ResourceConstants.CONDITIONS.ShouldUsePointInTimeRecovery,
        {
          PointInTimeRecoveryEnabled: true,
        },
        Refs.NoValue
      ) as any,
      ...(isSyncEnabled && {
        TimeToLiveSpecification: SyncUtils.syncTTLConfig(),
github aws-amplify / amplify-cli / packages / graphql-elasticsearch-transformer / src / resources.ts View on Github external
private domainName() {
        return Fn.If(
            ResourceConstants.CONDITIONS.HasEnvironmentParameter,
            Refs.NoValue,
            Fn.Join(
                '-',
                [
                    'd',
                    Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId')
                ]
            )
        )
    }
github aws-amplify / amplify-cli / packages / graphql-elasticsearch-transformer / src / resources.ts View on Github external
private domainName() {
    return Fn.If(
      ResourceConstants.CONDITIONS.HasEnvironmentParameter,
      Refs.NoValue,
      Fn.Join('-', ['d', Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId')])
    );
  }