bucket#

State module for managing Buckets.

async idem_gcp.states.gcp.storage.bucket.present(hub, ctx, name: str, resource_id: str = None, project: str = None, predefined_acl: str = None, predefined_default_object_acl: str = None, user_project: str = None, billing: BillingProperties = None, cors: List[CorsProperties] = None, custom_placement_config: CustomPlacementConfigProperties = None, default_event_based_hold: bool = None, encryption: EncryptionProperties = None, iam_configuration: IamConfigurationProperties = None, labels: Dict[str, Any] = None, lifecycle: LifecycleProperties = None, autoclass: AutoclassProperties = None, location: str = None, logging: LoggingProperties = None, retention_policy: RetentionPolicyProperties = None, rpo: str = None, storage_class: str = None, versioning: VersioningProperties = None, website: WebsiteProperties = None, metageneration: str = None, if_metageneration_match: str = None, acl: List[BucketAccessControl] = None, default_object_acl: List[ObjectAccessControl] = None) Dict[str, Any][source]#

Create or update a storage bucket resource.

Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.

Parameters:
  • name (str) – An Idem name of the resource.

  • resource_id (str, Optional) – An identifier of the resource in the provider. Defaults to None.

  • project (str) – A valid API project identifier.

  • predefined_acl (str, Optional) – Apply a predefined set of access controls to this bucket. Defaults to None.

  • predefined_default_object_acl (str, Optional) – Apply a predefined set of default object access controls to this bucket. Defaults to None.

  • user_project (str, Optional) – The project to be billed for this request. Required for Requester Pays buckets. Defaults to None.

  • billing (Dict[str, Any], Optional) –

    The bucket’s billing configuration. Defaults to None.

    • requester_pays(bool, Optional):

      When set to true, Requester Pays is enabled for this bucket.

  • cors (List[Dict[str, Any]], Optional) –

    The bucket’s Cross-Origin Resource Sharing (CORS) configuration. Defaults to None.

    • max_age_seconds(int, Optional):

      The value, in seconds, to return in the Access-Control-Max-Age header used in preflight responses.

    • method(List[str], Optional):

      The list of HTTP methods on which to include CORS response headers, (GET, OPTIONS, POST, etc) Note: “*” is permitted in the list of methods, and means “any method”.

    • origin(List[str], Optional):

      The list of Origins eligible to receive CORS response headers. Note: “*” is permitted in the list of origins, and means “any Origin”.

    • response_header(List[str], Optional):

      The list of HTTP headers other than the simple response headers to give permission for the user-agent to share across domains.

  • custom_placement_config (Dict[str, Any], Optional) –

    The bucket’s custom placement configuration for Custom Dual Regions. Defaults to None.

    • data_locations(List[str], Optional):

      The list of regional locations in which data is placed.

  • default_event_based_hold (bool, Optional) – The default value for event-based hold on newly created objects in this bucket. Event-based hold is a way to retain objects indefinitely until an event occurs, signified by the hold’s release. After being released, such objects will be subject to bucket-level retention (if any). One sample use case of this flag is for banks to hold loan documents for at least 3 years after loan is paid in full. Here, bucket-level retention is 3 years and the event is loan being paid in full. In this example, these objects will be held intact for any number of years until the event has occurred (event-based hold on the object is released) and then 3 more years after that. That means retention duration of the objects begins from the moment event-based hold transitioned from true to false. Objects under event-based hold cannot be deleted, overwritten or archived until the hold is removed. Defaults to None.

  • encryption (Dict[str, Any], Optional) –

    Encryption configuration for a bucket. Defaults to None.

    • default_kms_key_name(str, Optional):

      A Cloud KMS key that will be used to encrypt objects inserted into this bucket, if no encryption method is specified.

  • iam_configuration (Dict[str, Any], Optional) –

    The bucket’s IAM configuration. Defaults to None.

    • bucket_policy_only(Dict[str, Any], Optional):

      The bucket’s uniform bucket-level access configuration. The feature was formerly known as Bucket Policy Only. For backward compatibility, this field will be populated with identical information as the uniformBucketLevelAccess field. We recommend using the uniformBucketLevelAccess field to enable and disable the feature.

      • enabled(bool, Optional):

        If set, access is controlled only by bucket-level or above IAM policies.

      • locked_time(str, Optional):

        The deadline for changing iamConfiguration.bucketPolicyOnly.enabled from true to false in RFC 3339 format. iamConfiguration.bucketPolicyOnly.enabled may be changed from true to false until the locked time, after which the field is immutable.

    • uniform_bucket_level_access(Dict[str, Any], Optional):

      The bucket’s uniform bucket-level access configuration.

      • enabled(bool, Optional):

        If set, access is controlled only by bucket-level or above IAM policies.

      • locked_time(str, Optional):

        The deadline for changing iamConfiguration.uniformBucketLevelAccess.enabled from true to false in RFC 3339 format. iamConfiguration.uniformBucketLevelAccess.enabled may be changed from true to false until the locked time, after which the field is immutable.

    • public_access_prevention(str, Optional):

      The bucket’s Public Access Prevention configuration. Currently, ‘inherited’ and ‘enforced’ are supported.

  • labels (Dict[str, Any], Optional) – User-provided labels, in key/value pairs. Defaults to None.

  • lifecycle (Dict[str, Any], Optional) –

    The bucket’s lifecycle configuration. See lifecycle management for more information. Defaults to None.

    • rule(List[Dict[str, Any]], Optional):

      A lifecycle management rule, which is made of an action to take and the condition(s) under which the action will be taken.

      • action(Dict[str, Any], Optional):

        The action to take.

        • storage_class(str, Optional):

          Target storage class. Required iff the type of the action is SetStorageClass.

        • type(str, Optional):

          Type of the action. Currently, only Delete, SetStorageClass, and AbortIncompleteMultipartUpload are supported.

      • condition(Dict[str, Any], Optional):

        The condition(s) under which the action will be taken.

        • age(int, Optional):

          Age of an object (in days). This condition is satisfied when an object reaches the specified age.

        • created_before(str, Optional):

          A date in RFC 3339 format with only the date part (for instance, “2013-01-15”). This condition is satisfied when an object is created before midnight of the specified date in UTC.

        • custom_time_before(str, Optional):

          A date in RFC 3339 format with only the date part (for instance, “2013-01-15”). This condition is satisfied when the custom time on an object is before this date in UTC.

        • days_since_custom_time(int, Optional):

          Number of days elapsed since the user-specified timestamp set on an object. The condition is satisfied if the days elapsed is at least this number. If no custom timestamp is specified on an object, the condition does not apply.

        • days_since_noncurrent_time(int, Optional):

          Number of days elapsed since the noncurrent timestamp of an object. The condition is satisfied if the days elapsed is at least this number. This condition is relevant only for versioned objects. The value of the field must be a nonnegative integer. If it’s zero, the object version will become eligible for Lifecycle action as soon as it becomes noncurrent.

        • is_live(bool, Optional):

          Relevant only for versioned objects. If the value is true, this condition matches live objects; if the value is false, it matches archived objects.

        • matches_pattern(str, Optional):

          A regular expression that satisfies the RE2 syntax. This condition is satisfied when the name of the object matches the RE2 pattern. Note: This feature is currently in the “Early Access” launch stage and is only available to a whitelisted set of users; that means that this feature may be changed in backward-incompatible ways and that it is not guaranteed to be released.

        • matches_prefix(List[str], Optional):

          List of object name prefixes. This condition will be satisfied when at least one of the prefixes exactly matches the beginning of the object name.

        • matches_suffix(List[str], Optional):

          List of object name suffixes. This condition will be satisfied when at least one of the suffixes exactly matches the end of the object name.

        • matches_storage_class(List[str], Optional):

          Objects having any of the storage classes specified by this condition will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, ARCHIVE, STANDARD, and DURABLE_REDUCED_AVAILABILITY.

        • noncurrent_time_before(str, Optional):

          A date in RFC 3339 format with only the date part (for instance, “2013-01-15”). This condition is satisfied when the noncurrent time on an object is before this date in UTC. This condition is relevant only for versioned objects.

        • num_newer_versions(int, Optional):

          Relevant only for versioned objects. If the value is N, this condition is satisfied when there are at least N versions (including the live version) newer than this version of the object.

  • autoclass (Dict[str, Any], Optional) –

    The bucket’s Autoclass configuration. Defaults to None.

    • enabled(bool, Optional):

      Whether or not Autoclass is enabled on this bucket

    • toggle_time(str, Optional):

      A date and time in RFC 3339 format representing the instant at which “enabled” was last toggled.

  • location (str, Optional) – The location of the bucket. Object data for objects in the bucket resides in physical storage within this region. Defaults to US. See the developer’s guide for the authoritative list. Defaults to None.

  • logging (Dict[str, Any], Optional) –

    The bucket’s logging configuration, which defines the destination bucket and optional name prefix for the current bucket’s logs. Defaults to None.

    • log_bucket(str, Optional):

      The destination bucket where the current bucket’s logs should be placed.

    • log_object_prefix(str, Optional):

      A prefix for log object names.

  • retention_policy (Dict[str, Any], Optional) –

    The bucket’s retention policy. The retention policy enforces a minimum retention time for all objects contained in the bucket, based on their creation time. Any attempt to overwrite or delete objects younger than the retention period will result in a PERMISSION_DENIED error. An unlocked retention policy can be modified or removed from the bucket via a storage.buckets.update operation. A locked retention policy cannot be removed or shortened in duration for the lifetime of the bucket. Attempting to remove or decrease period of a locked retention policy will result in a PERMISSION_DENIED error. Defaults to None.

    • is_locked(bool, Optional):

      Locks the retention policy. Once locked, an object retention policy cannot be modified.

    • retention_period(str, Optional):

      The duration in seconds that objects need to be retained. Retention duration must be greater than zero and less than 100 years. Note that enforcement of retention periods less than a day is not guaranteed. Such periods should only be used for testing purposes.

  • rpo (str, Optional) – The Recovery Point Objective (RPO) of this bucket. Set to ASYNC_TURBO to turn on Turbo Replication on a bucket. Defaults to None.

  • storage_class (str, Optional) – The bucket’s default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, ARCHIVE, and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the bucket is created, it will default to STANDARD. For more information, see storage classes. Defaults to None.

  • versioning (Dict[str, Any], Optional) –

    The bucket’s versioning configuration. Defaults to None.

    • enabled(bool, Optional):

      While set to true, versioning is fully enabled for this bucket.

  • website (Dict[str, Any], Optional) –

    The bucket’s website configuration, controlling how the service behaves when accessing bucket contents as a web site. See the Static Website Examples for more information. Defaults to None.

    • main_page_suffix(str, Optional):

      If the requested object path is missing, the service will ensure the path has a trailing ‘/’, append this suffix, and attempt to retrieve the resulting object. This allows the creation of index.html objects to represent directory pages.

    • not_found_page(str, Optional):

      If the requested object path is missing, and any mainPageSuffix object is missing, if applicable, the service will return the named object from this bucket as the content for a 404 Not Found result.

  • metageneration (str, Optional) – The metadata generation of this bucket. Read-only property

  • if_metageneration_match (str, Optional) – Makes the operation conditional on whether bucket’s current metageneration matches the given value. Currently used only when locking retention policy

  • acl (list[Dict[str, Any]], Optional) –

    Access controls on the bucket. Defaults to None.

    • bucket(str, Optional):

      [OutputOnly] The name of the bucket.

    • domain(str, Optional):

      [OutputOnly] The domain associated with the entity, if any.

    • email(str, Optional):

      [OutputOnly] The email address associated with the entity, if any.

    • entity(str, Optional):

      The entity holding the permission, in one of the following forms: - user-userId - user-email - group-groupId - group-email - domain-domain - project-team-projectId - allUsers - allAuthenticatedUsers Examples: - The user liz@example.com would be user-liz@example.com. - The group example@googlegroups.com would be group-example@googlegroups.com. - To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com.

    • entity_id(str, Optional):

      [OutputOnly] The ID for the entity, if any.

    • etag(str, Optional):

      [OutputOnly] HTTP 1.1 Entity tag for the access-control entry.

    • id(str, Optional):

      [OutputOnly] The ID of the access-control entry.

    • kind(str, Optional):

      [OutputOnly] The kind of item this is. For bucket access control entries, this is always storage#bucketAccessControl.

    • project_team(Dict[str, Any], Optional):

      [OutputOnly] The project team associated with the entity, if any.

      • project_number(str, Optional):

        [OutputOnly] The project number.

      • team(str, Optional):

        [OutputOnly] The team.

    • role(str, Optional):

      The access permission for the entity.

    • self_link(str, Optional):

      [OutputOnly] The link to this access-control entry.

  • default_object_acl (list[Dict[str, Any]], Optional) –

    Default access controls to apply to new objects when no ACL is provided. Defaults to None.

    • domain(str, Optional):

      [OutputOnly] The domain associated with the entity, if any.

    • email(str, Optional):

      [OutputOnly] The email address associated with the entity, if any.

    • entity(str, Optional):

      The entity holding the permission, in one of the following forms: - user-userId - user-email - group-groupId - group-email - domain-domain - project-team-projectId - allUsers - allAuthenticatedUsers Examples: - The user liz@example.com would be user-liz@example.com. - The group example@googlegroups.com would be group-example@googlegroups.com. - To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com.

    • entity_id(str, Optional):

      [OutputOnly] The ID for the entity, if any.

    • etag(str, Optional):

      [OutputOnly] HTTP 1.1 Entity tag for the access-control entry.

    • kind(str, Optional):

      [OutputOnly] The kind of item this is. For object access control entries, this is always storage#objectAccessControl.

    • project_team(Dict[str, Any], Optional):

      [OutputOnly] The project team associated with the entity, if any.

      • project_number(str, Optional):

        [OutputOnly] The project number.

      • team(str, Optional):

        [OutputOnly] The team.

    • role(str, Optional):

      The access permission for the entity.

Returns:

Dict[str, Any]

Examples

resource_is_present:
  gcp.storage.bucket.present:
    - name: value
    - project: value
async idem_gcp.states.gcp.storage.bucket.absent(hub, ctx, name: str, resource_id: str = None, user_project: str = None)[source]#

Permanently deletes an empty bucket.

Parameters:
  • name (str) – The name of the resource

  • resource_id (str, Optional) – The resource_id of the resource

  • user_project (str, Optional) – The project to be billed for this request. Required for Requester Pays buckets.

Returns:

Dict[str, Any]

Examples


resource_is_absent:

gcp.storage.bucket.absent

async idem_gcp.states.gcp.storage.bucket.describe(hub, ctx) Dict[str, Dict[str, Any]][source]#

Describe the resource in a way that can be recreated/managed with the corresponding “present” function.

Retrieves a list of buckets.

Returns:

Dict[str, Any]

Examples

$ idem describe gcp.storage.bucket
idem_gcp.states.gcp.storage.bucket.is_pending(hub, ret: dict, state: str = None, **pending_kwargs) bool[source]#

Default implemented for each module.