.. _s3_block:

``s3`` Block
~~~~~~~~~~~~

Holds settings related to s3 deployments

``path``
********

Path to upload assets to in a specified s3 bucket. Only works for S3 pipelines not using shared/master bucket setup. Refer to `s3_bucket_master` for more information. 

    | *Type*: string
    | *Default*: ``"/"``

``bucket_acl``
**************

General ACL to apply to S3 bucket

    | *Type*: string
    | *Default*: ``"private"``
    | *Options*:

       - ``"public"``
       - ``"private"``

``bucket_name``
**************

Allows an S3 bucket name to be specified vs generated by pipeline

    | *Type*: string
    | *Default*: ``""``

``bucket_policy``
*****************

The S3 bucket policy in json format to apply to created S3 bucket. Must be a valid S3 bucket policy; use the AWS policy generator/simulator to test your policy.
(https://awspolicygen.s3.amazonaws.com/policygen.html)

    | *Type*: json
    | *Default*: ``"{}"``

``content_metadata``
********************

S3 object metadata based on path. The "path" field should have NO leading or trailing slashes.

    | *Type*: object
    | *Default*: ``None``
    | *Example config*:

      .. code-block:: json

          [
              {
                  "path": "assets/compressed",
                  "content-encoding": "br"
              },
              { 
                  "path": "assets/gzip",
                  "content-encoding": "gzip"
              }
          ]

``shared_bucket_master``
************************

Setups up an S3 bucket as a shared target so other Spinnaker pipelines can upload to it. i


    | *Type*: boolean
    | *Default*: ``false``
    | *Example*:
       
       An example of this is having one s3 bucket for a given website. This website has a commercial and business webpage that are two unique deployment pipelines. Each of the unique apps would specify the `shared_bucket_target` to the Spinnaker application name of the `shared_bucket_master` pipeline. It is common to have a bare source repository for a master bucket with just Foremast pipeline and application configuration files.

``shared_bucket_target``
************************

Shared bucket to deploy to. Refer to `shared_bucket_master` for use case and example.

    | *Type*: string
    | *Default*: ``None``

``cors``
********

S3 CORS configuration block

``cors`` *Keys*
^^^^^^^^^^^^^^^

``enabled`` : Enables/Disables CORS configuration

    | *Type*: boolean
    | *Default*: ``false``

``cors_rules`` :

A list of CORS rules including lists of headers, methods, origins, exposed headers, and max age.
For more details refer to: http://boto3.readthedocs.io/en/latest/reference/services/s3.html#S3.Client.put_bucket_cors

    | *Type*: object
    | *Default*: ``None``
    | *Example config*:

      .. code-block:: json

          [
              {
                  "cors_headers": [],
                  "cors_methods": [],
                  "cors_origins": [],
                  "cors_expose_headers": [],
                  "cors_max_age": 600
              },
              { 
                  "cors_headers": [],
                  "cors_methods": [],
                  "cors_origins": [],
                  "cors_expose_headers": [],
                  "cors_max_age": 600
              }
          ]

``encryption``
**************

S3 Encryption configuration block

``encryption`` *Keys*
^^^^^^^^^^^^^^^^^^^^^

``enabled`` : Enables/Disables S3 Encryption configuration

    | *Type*: boolean
    | *Default*: ``false``

``encryption_rules`` :

A list of S3 encryption rules. As of today only one rule is supported: `ApplyServerSideEncryptionByDefault`. Built in 
support for additional rules if this changes. Support for both AES256 or custom KMS (`aws:kms`) `SSEAlgorithm`. For `aws:kms`,
specify a custom `KMSMasterKeyID`; this is not needed for `AES256` and should not be specified.
For more details refer to: http://boto3.readthedocs.io/en/latest/reference/services/s3.html#S3.Client.put_bucket_encryption

    | *Type*: object
    | *Default*: ``None``
    | *Example config*:

      .. code-block:: json

          [
              {
                  "ApplyServerSideEncryptionByDefault": {
                    'SSEAlgorithm': 'AES256'|'aws:kms',
                    'KMSMasterKeyID': 'string'
                  }
              }
          ]

``lifecycle``
*************

S3 Lifecycle configuration block

``lifecycle`` *Keys*
^^^^^^^^^^^^^^^^^^^^

``enabled`` : Enables/Disables S3 Lifecycle configuration

    | *Type*: boolean
    | *Default*: ``false``

``lifecycle_rules`` :

A list of S3 lifecycle rules, if a lifecycle exists it replaces it.
For more details refer to: http://boto3.readthedocs.io/en/latest/reference/services/s3.html#S3.Client.put_bucket_lifecycle_configuration

    | *Type*: array
    | *Default*: ``[{}]``
    | *Example config*:

      .. code-block:: json

          [
            {
                'Expiration': {
                    'Date': datetime(2015, 1, 1),
                    'Days': 123,
                    'ExpiredObjectDeleteMarker': True|False
                },
                'ID': 'string',
                'Prefix': 'string',
                'Filter': {
                    'Prefix': 'string',
                    'Tag': {
                        'Key': 'string',
                        'Value': 'string'
                    },
                    'And': {
                        'Prefix': 'string',
                        'Tags': [
                            {
                                'Key': 'string',
                                'Value': 'string'
                            },
                        ]
                    }
                },
                'Status': 'Enabled'|'Disabled',
                'Transitions': [
                    {
                        'Date': datetime(2015, 1, 1),
                        'Days': 123,
                        'StorageClass': 'GLACIER'|'STANDARD_IA'|'ONEZONE_IA'
                    },
                ],
                'NoncurrentVersionTransitions': [
                    {
                        'NoncurrentDays': 123,
                        'StorageClass': 'GLACIER'|'STANDARD_IA'|'ONEZONE_IA'
                    },
                ],
                'NoncurrentVersionExpiration': {
                    'NoncurrentDays': 123
                },
                'AbortIncompleteMultipartUpload': {
                    'DaysAfterInitiation': 123
                }
            }
          ]

``logging``
***********

S3 access logging configuration block

``logging`` *Keys*
^^^^^^^^^^^^^^^^^^

``enabled`` : Enables/Disables S3 logging configuration

    | *Type*: boolean
    | *Default*: ``false``

``logging_grants`` :

Specify permissions for who can view and modify the logging parameters. To set the logging status of a bucket, you must be the bucket owner.
For more details refer to: http://boto3.readthedocs.io/en/latest/reference/services/s3.html#S3.Client.put_bucket_logging

    | *Type*: object
    | *Default*: ``None``
    | *Example config*:

      .. code-block:: json

          [
              {
                  'Grantee': {
                      'DisplayName': 'string',
                      'EmailAddress': 'string',
                      'ID': 'string',
                      'Type': 'CanonicalUser'|'AmazonCustomerByEmail'|'Group',
                      'URI': 'string'
                  },
                  'Permission': 'FULL_CONTROL'|'READ'|'WRITE'
              }
          ]

``logging_bucket`` : Specifies the bucket where you want Amazon S3 to store server access logs.

    | *Type*: string
    | *Default*: ``""``

``logging_bucket_prefix`` : This element lets you specify a prefix for the keys that the log files will be stored under.

    | *Type*: string
    | *Default*: ``{{ app }}/``

``notification``
*************

S3 Notification configuration block

``notification`` *Keys*
^^^^^^^^^^^^^^^^^^^^

``enabled`` : Enables/Disables S3 Notification configuration

    | *Type*: boolean
    | *Default*: ``false``

``topic_configurations`` :

A list of S3 SNS topic notification rules, if an SNS notification configuration exists it replaces it.
For more details refer to: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.put_bucket_notification_configuration

    | *Type*: array
    | *Default*: ``[{}]``
    | *Example config*:

      .. code-block:: json
          [
            {
                'Id': 'string',
                'TopicArn': 'string',
                'Events': [
                    's3:ReducedRedundancyLostObject'|'s3:ObjectCreated:*'|'s3:ObjectCreated:Put'|'s3:ObjectCreated:Post'|'s3:ObjectCreated:Copy'|'s3:ObjectCreated:CompleteMultipartUpload'|'s3:ObjectRemoved:*'|'s3:ObjectRemoved:Delete'|'s3:ObjectRemoved:DeleteMarkerCreated'|'s3:ObjectRestore:Post'|'s3:ObjectRestore:Completed',
                ],
                'Filter': {
                    'Key': {
                        'FilterRules': [
                            {
                                'Name': 'prefix'|'suffix',
                                'Value': 'string'
                            },
                        ]
                    }
                }
            }
          ]

``queue_configurations`` :

A list of S3 SQS notification rules, if an SQS notification configuration exists it replaces it.
For more details refer to: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.put_bucket_notification_configuration

    | *Type*: array
    | *Default*: ``[{}]``
    | *Example config*:

      .. code-block:: json
          [
            {
                'Id': 'string',
                'QueueArn': 'string',
                'Events': [
                    's3:ReducedRedundancyLostObject'|'s3:ObjectCreated:*'|'s3:ObjectCreated:Put'|'s3:ObjectCreated:Post'|'s3:ObjectCreated:Copy'|'s3:ObjectCreated:CompleteMultipartUpload'|'s3:ObjectRemoved:*'|'s3:ObjectRemoved:Delete'|'s3:ObjectRemoved:DeleteMarkerCreated'|'s3:ObjectRestore:Post'|'s3:ObjectRestore:Completed',
                ],
                'Filter': {
                    'Key': {
                        'FilterRules': [
                            {
                                'Name': 'prefix'|'suffix',
                                'Value': 'string'
                            },
                        ]
                    }
                }
            },
          ]

``lambda_configurations`` :

A list of S3 Lambda notification rules, if an Lambda notification configuration exists it replaces it.
For more details refer to: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.put_bucket_notification_configuration

    | *Type*: array
    | *Default*: ``[{}]``
    | *Example config*:

      .. code-block:: json
          [
            {
                'Id': 'string',
                'LambdaFunctionArn': 'string',
                'Events': [
                    's3:ReducedRedundancyLostObject'|'s3:ObjectCreated:*'|'s3:ObjectCreated:Put'|'s3:ObjectCreated:Post'|'s3:ObjectCreated:Copy'|'s3:ObjectCreated:CompleteMultipartUpload'|'s3:ObjectRemoved:*'|'s3:ObjectRemoved:Delete'|'s3:ObjectRemoved:DeleteMarkerCreated'|'s3:ObjectRestore:Post'|'s3:ObjectRestore:Completed',
                ],
                'Filter': {
                    'Key': {
                        'FilterRules': [
                            {
                                'Name': 'prefix'|'suffix',
                                'Value': 'string'
                            },
                        ]
                    }
                }
            },
          ]

``tagging``
***********

S3 tagging configuration block

``tagging`` *Keys*
^^^^^^^^^^^^^^^^^^

``tags`` : This element lets you specify a prefix for the keys that the log files will be stored under.

    | *Type*: object
    | *Default*: ``{}``
    | *Example config*:
    
      .. code-block:: json

          {
              "key": "value",
              "key1": "value1"
          }

``versioning``
**************

S3 versioning configuration block

``versioning`` *Keys*
^^^^^^^^^^^^^^^^^^^^^

``enabled`` : Enables/Disables S3 versioning configuration

    | *Type*: boolean
    | *Default*: ``false``

``mfa_delete`` : Specifies whether MFA delete is enabled in the bucket versioning configuration. 

    | *Type*: string
    | *Default*: ``Disabled``

``website``
***********

S3 Website configuration block

``website`` *Keys*
^^^^^^^^^^^^^^^^^^

``enabled`` : Enables/Disables an S3 bucket from being website enabled

    | *Type*: boolean
    | *Default*: ``true``

``index_suffix`` : Default index page

    | *Type*: string
    | *Default*: ``"index.html"``

``error_document`` : Default error page

    | *Type*: string
    | *Default*: ``"404.html"``
