From 311c850493566de7c5a782476f8d63e32fe2cebd Mon Sep 17 00:00:00 2001 From: Samir Anand Date: Thu, 30 Nov 2023 16:34:54 +0530 Subject: [PATCH 1/6] Automatically generated by magic modules for service: artifactregistry and resource: Projects__locations__repository. This commit includes the following changes: - Singular Resource - Plural Resource - Documentation updates - Terraform configuration - Integration tests Signed-off-by: Samir Anand --- .../configuration/mm-attributes.yml | 16 ++ ...tregistry_project_location_repositories.md | 43 +++++ ...actregistry_project_location_repository.md | 165 ++++++++++++++++++ ...jectlocationrepository_cleanup_policies.rb | 34 ++++ ...projectlocationrepository_docker_config.rb | 34 ++++ .../projectlocationrepository_labels.rb | 34 ++++ .../projectlocationrepository_maven_config.rb | 37 ++++ ...tionrepository_remote_repository_config.rb | 65 +++++++ ...remote_repository_config_apt_repository.rb | 35 ++++ ...config_apt_repository_public_repository.rb | 37 ++++ ...ote_repository_config_docker_repository.rb | 34 ++++ ...mote_repository_config_maven_repository.rb | 34 ++++ ...remote_repository_config_npm_repository.rb | 34 ++++ ...ote_repository_config_python_repository.rb | 34 ++++ ..._repository_config_upstream_credentials.rb | 35 ++++ ...edentials_username_password_credentials.rb | 37 ++++ ...remote_repository_config_yum_repository.rb | 35 ++++ ...config_yum_repository_public_repository.rb | 37 ++++ ...ionrepository_virtual_repository_config.rb | 35 ++++ ...ual_repository_config_upstream_policies.rb | 48 +++++ ...tregistry_project_location_repositories.rb | 109 ++++++++++++ ...actregistry_project_location_repository.rb | 102 +++++++++++ ...tregistry_project_location_repositories.rb | 30 ++++ ...actregistry_project_location_repository.rb | 35 ++++ 24 files changed, 1139 insertions(+) create mode 100644 docs/resources/google_artifactregistry_project_location_repositories.md create mode 100644 docs/resources/google_artifactregistry_project_location_repository.md create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_cleanup_policies.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_docker_config.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_labels.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_maven_config.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_apt_repository.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_apt_repository_public_repository.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_docker_repository.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_maven_repository.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_npm_repository.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_python_repository.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_upstream_credentials.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_upstream_credentials_username_password_credentials.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_yum_repository.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_yum_repository_public_repository.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_virtual_repository_config.rb create mode 100644 libraries/google/artifactregistry/property/projectlocationrepository_virtual_repository_config_upstream_policies.rb create mode 100644 libraries/google_artifactregistry_project_location_repositories.rb create mode 100644 libraries/google_artifactregistry_project_location_repository.rb create mode 100644 test/integration/verify/controls/google_artifactregistry_project_location_repositories.rb create mode 100644 test/integration/verify/controls/google_artifactregistry_project_location_repository.rb diff --git a/build/inspec/test/integration/configuration/mm-attributes.yml b/build/inspec/test/integration/configuration/mm-attributes.yml index eab23d3ea..8846c65a2 100644 --- a/build/inspec/test/integration/configuration/mm-attributes.yml +++ b/build/inspec/test/integration/configuration/mm-attributes.yml @@ -882,4 +882,20 @@ tensorboard_experiment_run_time_series_resource: value_type : "value_valuetype" project_location_image_version: + parent : "value_parent" +vpn_gateway: + project : "value_project" + region : "value_region" + vpn_gateway : "value_vpngateway" + kind : "value_kind" + id : "value_id" + creation_timestamp : "value_creationtimestamp" + name : "value_name" + description : "value_description" + network : "value_network" + self_link : "value_selflink" + label_fingerprint : "value_labelfingerprint" + stack_type : "value_stacktype" +project_location_repository: + name : "value_name" parent : "value_parent" \ No newline at end of file diff --git a/docs/resources/google_artifactregistry_project_location_repositories.md b/docs/resources/google_artifactregistry_project_location_repositories.md new file mode 100644 index 000000000..43d89c0e2 --- /dev/null +++ b/docs/resources/google_artifactregistry_project_location_repositories.md @@ -0,0 +1,43 @@ +--- +title: About the google_artifactregistry_project_location_repositories resource +platform: gcp +--- + +## Syntax +A `google_artifactregistry_project_location_repositories` is used to test a Google ProjectLocationRepository resource + +## Examples +``` + describe google_artifactregistry_project_location_repositories(parent: ' value_parent') do + it { should exist } + end +``` + +## Properties +Properties that can be accessed from the `google_artifactregistry_project_location_repositories` resource: + +See [google_artifactregistry_project_location_repository.md](google_artifactregistry_project_location_repository.md) for more detailed information + * `maven_configs`: an array of `google_artifactregistry_project_location_repository` maven_config + * `docker_configs`: an array of `google_artifactregistry_project_location_repository` docker_config + * `virtual_repository_configs`: an array of `google_artifactregistry_project_location_repository` virtual_repository_config + * `remote_repository_configs`: an array of `google_artifactregistry_project_location_repository` remote_repository_config + * `names`: an array of `google_artifactregistry_project_location_repository` name + * `formats`: an array of `google_artifactregistry_project_location_repository` format + * `descriptions`: an array of `google_artifactregistry_project_location_repository` description + * `labels`: an array of `google_artifactregistry_project_location_repository` labels + * `create_times`: an array of `google_artifactregistry_project_location_repository` create_time + * `update_times`: an array of `google_artifactregistry_project_location_repository` update_time + * `kms_key_names`: an array of `google_artifactregistry_project_location_repository` kms_key_name + * `modes`: an array of `google_artifactregistry_project_location_repository` mode + * `cleanup_policies`: an array of `google_artifactregistry_project_location_repository` cleanup_policies + * `size_bytes`: an array of `google_artifactregistry_project_location_repository` size_bytes + * `satisfies_pzs`: an array of `google_artifactregistry_project_location_repository` satisfies_pzs + * `cleanup_policy_dry_runs`: an array of `google_artifactregistry_project_location_repository` cleanup_policy_dry_run + +## Filter Criteria +This resource supports all of the above properties as filter criteria, which can be used +with `where` as a block or a method. + +## GCP Permissions + +Ensure the [Artifact Registry API](https://console.cloud.google.com/apis/library/artifactregistry.googleapis.com/) is enabled for the current project. diff --git a/docs/resources/google_artifactregistry_project_location_repository.md b/docs/resources/google_artifactregistry_project_location_repository.md new file mode 100644 index 000000000..c0165c04c --- /dev/null +++ b/docs/resources/google_artifactregistry_project_location_repository.md @@ -0,0 +1,165 @@ +--- +title: About the google_artifactregistry_project_location_repository resource +platform: gcp +--- + +## Syntax +A `google_artifactregistry_project_location_repository` is used to test a Google ProjectLocationRepository resource + +## Examples +``` +describe google_artifactregistry_project_location_repository(name: ' value_name') do + it { should exist } + +end + +describe google_artifactregistry_project_location_repository(name: "does_not_exit") do + it { should_not exist } +end +``` + +## Properties +Properties that can be accessed from the `google_artifactregistry_project_location_repository` resource: + + + * `maven_config`: MavenRepositoryConfig is maven related repository details. Provides additional configuration details for repositories of the maven format type. + + * `allow_snapshot_overwrites`: The repository with this flag will allow publishing the same snapshot versions. + + * `version_policy`: Version policy defines the versions that the registry will accept. + Possible values: + * VERSION_POLICY_UNSPECIFIED + * RELEASE + * SNAPSHOT + + * `docker_config`: DockerRepositoryConfig is docker related repository details. Provides additional configuration details for repositories of the docker format type. + + * `immutable_tags`: The repository which enabled this flag prevents all tags from being modified, moved or deleted. This does not prevent tags from being created. + + * `virtual_repository_config`: Virtual repository configuration. + + * `upstream_policies`: Policies that configure the upstream artifacts distributed by the Virtual Repository. Upstream policies cannot be set on a standard repository. + + * `id`: The user-provided ID of the upstream policy. + + * `repository`: A reference to the repository resource, for example: `projects/p1/locations/us-central1/repositories/repo1`. + + * `priority`: Entries with a greater priority value take precedence in the pull order. + + * `remote_repository_config`: Remote repository configuration. + + * `docker_repository`: Configuration for a Docker remote repository. + + * `public_repository`: One of the publicly available Docker repositories supported by Artifact Registry. + Possible values: + * PUBLIC_REPOSITORY_UNSPECIFIED + * DOCKER_HUB + + * `maven_repository`: Configuration for a Maven remote repository. + + * `public_repository`: One of the publicly available Maven repositories supported by Artifact Registry. + Possible values: + * PUBLIC_REPOSITORY_UNSPECIFIED + * MAVEN_CENTRAL + + * `npm_repository`: Configuration for a Npm remote repository. + + * `public_repository`: One of the publicly available Npm repositories supported by Artifact Registry. + Possible values: + * PUBLIC_REPOSITORY_UNSPECIFIED + * NPMJS + + * `python_repository`: Configuration for a Python remote repository. + + * `public_repository`: One of the publicly available Python repositories supported by Artifact Registry. + Possible values: + * PUBLIC_REPOSITORY_UNSPECIFIED + * PYPI + + * `apt_repository`: Configuration for an Apt remote repository. + + * `public_repository`: Publicly available Apt repositories constructed from a common repository base and a custom repository path. + + * `repository_base`: A common public repository base for Apt. + Possible values: + * REPOSITORY_BASE_UNSPECIFIED + * DEBIAN + * UBUNTU + * DEBIAN_SNAPSHOT + + * `repository_path`: A custom field to define a path to a specific repository from the base. + + * `yum_repository`: Configuration for a Yum remote repository. + + * `public_repository`: Publicly available Yum repositories constructed from a common repository base and a custom repository path. + + * `repository_base`: A common public repository base for Yum. + Possible values: + * REPOSITORY_BASE_UNSPECIFIED + * CENTOS + * CENTOS_DEBUG + * CENTOS_VAULT + * CENTOS_STREAM + * ROCKY + * EPEL + + * `repository_path`: A custom field to define a path to a specific repository from the base. + + * `description`: The description of the remote source. + + * `upstream_credentials`: The credentials to access the remote repository. + + * `username_password_credentials`: Username and password credentials. + + * `username`: The username to access the remote repository. + + * `password_secret_version`: The Secret Manager key version that holds the password to access the remote repository. Must be in the format of `projects/{project}/secrets/{secret}/versions/{version}`. + + * `name`: The name of the repository, for example: `projects/p1/locations/us-central1/repositories/repo1`. + + * `format`: Optional. The format of packages that are stored in the repository. + Possible values: + * FORMAT_UNSPECIFIED + * DOCKER + * MAVEN + * NPM + * APT + * YUM + * GOOGET + * PYTHON + * KFP + * GO + + * `description`: The user-provided description of the repository. + + * `labels`: Labels with user-defined metadata. This field may contain up to 64 entries. Label keys and values may be no longer than 63 characters. Label keys must begin with a lowercase letter and may only contain lowercase letters, numeric characters, underscores, and dashes. + + * `additional_properties`: + + * `create_time`: Output only. The time when the repository was created. + + * `update_time`: Output only. The time when the repository was last updated. + + * `kms_key_name`: The Cloud KMS resource name of the customer managed encryption key that's used to encrypt the contents of the Repository. Has the form: `projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key`. This value may not be changed after the Repository has been created. + + * `mode`: Optional. The mode of the repository. + Possible values: + * MODE_UNSPECIFIED + * STANDARD_REPOSITORY + * VIRTUAL_REPOSITORY + * REMOTE_REPOSITORY + + * `cleanup_policies`: Optional. Cleanup policies for this repository. Cleanup policies indicate when certain package versions can be automatically deleted. Map keys are policy IDs supplied by users during policy creation. They must unique within a repository and be under 128 characters in length. + + * `additional_properties`: Artifact policy configuration for repository cleanup policies. + + * `size_bytes`: Output only. The size, in bytes, of all artifact storage in this repository. Repositories that are generally available or in public preview use this to calculate storage costs. + + * `satisfies_pzs`: Output only. If set, the repository satisfies physical zone separation. + + * `cleanup_policy_dry_run`: Optional. If true, the cleanup pipeline is prevented from deleting versions in this repository. + + +## GCP Permissions + +Ensure the [Artifact Registry API](https://console.cloud.google.com/apis/library/artifactregistry.googleapis.com/) is enabled for the current project. diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_cleanup_policies.rb b/libraries/google/artifactregistry/property/projectlocationrepository_cleanup_policies.rb new file mode 100644 index 000000000..5da86b6f9 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_cleanup_policies.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryCleanupPolicies + attr_reader :additional_properties + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @additional_properties = args['additionalProperties'] + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryCleanupPolicies" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_docker_config.rb b/libraries/google/artifactregistry/property/projectlocationrepository_docker_config.rb new file mode 100644 index 000000000..4786b0060 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_docker_config.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryDockerConfig + attr_reader :immutable_tags + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @immutable_tags = args['immutableTags'] + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryDockerConfig" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_labels.rb b/libraries/google/artifactregistry/property/projectlocationrepository_labels.rb new file mode 100644 index 000000000..4aa2864e0 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_labels.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryLabels + attr_reader :additional_properties + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @additional_properties = args['additionalProperties'] + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryLabels" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_maven_config.rb b/libraries/google/artifactregistry/property/projectlocationrepository_maven_config.rb new file mode 100644 index 000000000..4044b6e84 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_maven_config.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryMavenConfig + attr_reader :allow_snapshot_overwrites + + attr_reader :version_policy + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @allow_snapshot_overwrites = args['allowSnapshotOverwrites'] + @version_policy = args['versionPolicy'] + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryMavenConfig" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config.rb b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config.rb new file mode 100644 index 000000000..e71850413 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_apt_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_apt_repository_public_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_docker_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_maven_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_npm_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_python_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_upstream_credentials' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_upstream_credentials_username_password_credentials' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_yum_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_yum_repository_public_repository' +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryRemoteRepositoryConfig + attr_reader :docker_repository + + attr_reader :maven_repository + + attr_reader :npm_repository + + attr_reader :python_repository + + attr_reader :apt_repository + + attr_reader :yum_repository + + attr_reader :description + + attr_reader :upstream_credentials + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @docker_repository = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfigDockerRepository.new(args['dockerRepository'], to_s) + @maven_repository = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfigMavenRepository.new(args['mavenRepository'], to_s) + @npm_repository = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfigNpmRepository.new(args['npmRepository'], to_s) + @python_repository = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfigPythonRepository.new(args['pythonRepository'], to_s) + @apt_repository = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfigAptRepository.new(args['aptRepository'], to_s) + @yum_repository = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfigYumRepository.new(args['yumRepository'], to_s) + @description = args['description'] + @upstream_credentials = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfigUpstreamCredentials.new(args['upstreamCredentials'], to_s) + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryRemoteRepositoryConfig" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_apt_repository.rb b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_apt_repository.rb new file mode 100644 index 000000000..7ec93c9e8 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_apt_repository.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_apt_repository_public_repository' +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryRemoteRepositoryConfigAptRepository + attr_reader :public_repository + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @public_repository = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfigAptRepositoryPublicRepository.new(args['publicRepository'], to_s) + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryRemoteRepositoryConfigAptRepository" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_apt_repository_public_repository.rb b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_apt_repository_public_repository.rb new file mode 100644 index 000000000..ada74e082 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_apt_repository_public_repository.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryRemoteRepositoryConfigAptRepositoryPublicRepository + attr_reader :repository_base + + attr_reader :repository_path + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @repository_base = args['repositoryBase'] + @repository_path = args['repositoryPath'] + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryRemoteRepositoryConfigAptRepositoryPublicRepository" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_docker_repository.rb b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_docker_repository.rb new file mode 100644 index 000000000..b2b1b71e2 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_docker_repository.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryRemoteRepositoryConfigDockerRepository + attr_reader :public_repository + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @public_repository = args['publicRepository'] + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryRemoteRepositoryConfigDockerRepository" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_maven_repository.rb b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_maven_repository.rb new file mode 100644 index 000000000..6164f71ae --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_maven_repository.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryRemoteRepositoryConfigMavenRepository + attr_reader :public_repository + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @public_repository = args['publicRepository'] + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryRemoteRepositoryConfigMavenRepository" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_npm_repository.rb b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_npm_repository.rb new file mode 100644 index 000000000..c3d3c8a47 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_npm_repository.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryRemoteRepositoryConfigNpmRepository + attr_reader :public_repository + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @public_repository = args['publicRepository'] + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryRemoteRepositoryConfigNpmRepository" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_python_repository.rb b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_python_repository.rb new file mode 100644 index 000000000..7653e1f70 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_python_repository.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryRemoteRepositoryConfigPythonRepository + attr_reader :public_repository + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @public_repository = args['publicRepository'] + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryRemoteRepositoryConfigPythonRepository" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_upstream_credentials.rb b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_upstream_credentials.rb new file mode 100644 index 000000000..4933f4063 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_upstream_credentials.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_upstream_credentials_username_password_credentials' +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryRemoteRepositoryConfigUpstreamCredentials + attr_reader :username_password_credentials + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @username_password_credentials = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfigUpstreamCredentialsUsernamePasswordCredentials.new(args['usernamePasswordCredentials'], to_s) + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryRemoteRepositoryConfigUpstreamCredentials" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_upstream_credentials_username_password_credentials.rb b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_upstream_credentials_username_password_credentials.rb new file mode 100644 index 000000000..7fbf6dfea --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_upstream_credentials_username_password_credentials.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryRemoteRepositoryConfigUpstreamCredentialsUsernamePasswordCredentials + attr_reader :username + + attr_reader :password_secret_version + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @username = args['username'] + @password_secret_version = args['passwordSecretVersion'] + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryRemoteRepositoryConfigUpstreamCredentialsUsernamePasswordCredentials" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_yum_repository.rb b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_yum_repository.rb new file mode 100644 index 000000000..d3edc0e89 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_yum_repository.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_yum_repository_public_repository' +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryRemoteRepositoryConfigYumRepository + attr_reader :public_repository + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @public_repository = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfigYumRepositoryPublicRepository.new(args['publicRepository'], to_s) + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryRemoteRepositoryConfigYumRepository" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_yum_repository_public_repository.rb b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_yum_repository_public_repository.rb new file mode 100644 index 000000000..f92864b49 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_remote_repository_config_yum_repository_public_repository.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryRemoteRepositoryConfigYumRepositoryPublicRepository + attr_reader :repository_base + + attr_reader :repository_path + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @repository_base = args['repositoryBase'] + @repository_path = args['repositoryPath'] + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryRemoteRepositoryConfigYumRepositoryPublicRepository" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_virtual_repository_config.rb b/libraries/google/artifactregistry/property/projectlocationrepository_virtual_repository_config.rb new file mode 100644 index 000000000..0cd605ec5 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_virtual_repository_config.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'google/artifactregistry/property/projectlocationrepository_virtual_repository_config_upstream_policies' +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryVirtualRepositoryConfig + attr_reader :upstream_policies + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @upstream_policies = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryVirtualRepositoryConfigUpstreamPoliciesArray.parse(args['upstreamPolicies'], to_s) + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryVirtualRepositoryConfig" + end + end + end + end +end diff --git a/libraries/google/artifactregistry/property/projectlocationrepository_virtual_repository_config_upstream_policies.rb b/libraries/google/artifactregistry/property/projectlocationrepository_virtual_repository_config_upstream_policies.rb new file mode 100644 index 000000000..51f38d0c3 --- /dev/null +++ b/libraries/google/artifactregistry/property/projectlocationrepository_virtual_repository_config_upstream_policies.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +module GoogleInSpec + module Artifactregistry + module Property + class ProjectLocationRepositoryVirtualRepositoryConfigUpstreamPolicies + attr_reader :id + + attr_reader :repository + + attr_reader :priority + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @id = args['id'] + @repository = args['repository'] + @priority = args['priority'] + end + + def to_s + "#{@parent_identifier} ProjectLocationRepositoryVirtualRepositoryConfigUpstreamPolicies" + end + end + + class ProjectLocationRepositoryVirtualRepositoryConfigUpstreamPoliciesArray + def self.parse(value, parent_identifier) + return if value.nil? + return ProjectLocationRepositoryVirtualRepositoryConfigUpstreamPolicies.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| ProjectLocationRepositoryVirtualRepositoryConfigUpstreamPolicies.new(v, parent_identifier) } + end + end + end + end +end diff --git a/libraries/google_artifactregistry_project_location_repositories.rb b/libraries/google_artifactregistry_project_location_repositories.rb new file mode 100644 index 000000000..0b1c4c15c --- /dev/null +++ b/libraries/google_artifactregistry_project_location_repositories.rb @@ -0,0 +1,109 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'gcp_backend' +class ArtifactregistryProjectLocationRepositorys < GcpResourceBase + name 'google_artifactregistry_project_location_repositories' + desc 'ProjectLocationRepository plural resource' + supports platform: 'gcp' + + attr_reader :table + + filter_table_config = FilterTable.create + + filter_table_config.add(:maven_configs, field: :maven_config) + filter_table_config.add(:docker_configs, field: :docker_config) + filter_table_config.add(:virtual_repository_configs, field: :virtual_repository_config) + filter_table_config.add(:remote_repository_configs, field: :remote_repository_config) + filter_table_config.add(:names, field: :name) + filter_table_config.add(:formats, field: :format) + filter_table_config.add(:descriptions, field: :description) + filter_table_config.add(:labels, field: :labels) + filter_table_config.add(:create_times, field: :create_time) + filter_table_config.add(:update_times, field: :update_time) + filter_table_config.add(:kms_key_names, field: :kms_key_name) + filter_table_config.add(:modes, field: :mode) + filter_table_config.add(:cleanup_policies, field: :cleanup_policies) + filter_table_config.add(:size_bytes, field: :size_bytes) + filter_table_config.add(:satisfies_pzs, field: :satisfies_pzs) + filter_table_config.add(:cleanup_policy_dry_runs, field: :cleanup_policy_dry_run) + + filter_table_config.connect(self, :table) + + def initialize(params = {}) + super(params.merge({ use_http_transport: true })) + @params = params + @table = fetch_wrapped_resource('projectLocationRepositories') + end + + def fetch_wrapped_resource(wrap_path) + # fetch_resource returns an array of responses (to handle pagination) + result = @connection.fetch_all(product_url, resource_base_url, @params, 'Get') + return if result.nil? + + # Conversion of string -> object hash to symbol -> object hash that InSpec needs + converted = [] + result.each do |response| + next if response.nil? || !response.key?(wrap_path) + response[wrap_path].each do |hash| + hash_with_symbols = {} + hash.each_key do |key| + name, value = transform(key, hash) + hash_with_symbols[name] = value + end + converted.push(hash_with_symbols) + end + end + + converted + end + + def transform(key, value) + return transformers[key].call(value) if transformers.key?(key) + + [key.to_sym, value] + end + + def transformers + { + 'mavenConfig' => ->(obj) { return :maven_config, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryMavenConfig.new(obj['mavenConfig'], to_s) }, + 'dockerConfig' => ->(obj) { return :docker_config, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryDockerConfig.new(obj['dockerConfig'], to_s) }, + 'virtualRepositoryConfig' => ->(obj) { return :virtual_repository_config, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryVirtualRepositoryConfig.new(obj['virtualRepositoryConfig'], to_s) }, + 'remoteRepositoryConfig' => ->(obj) { return :remote_repository_config, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfig.new(obj['remoteRepositoryConfig'], to_s) }, + 'name' => ->(obj) { return :name, obj['name'] }, + 'format' => ->(obj) { return :format, obj['format'] }, + 'description' => ->(obj) { return :description, obj['description'] }, + 'labels' => ->(obj) { return :labels, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryLabels.new(obj['labels'], to_s) }, + 'createTime' => ->(obj) { return :create_time, obj['createTime'] }, + 'updateTime' => ->(obj) { return :update_time, obj['updateTime'] }, + 'kmsKeyName' => ->(obj) { return :kms_key_name, obj['kmsKeyName'] }, + 'mode' => ->(obj) { return :mode, obj['mode'] }, + 'cleanupPolicies' => ->(obj) { return :cleanup_policies, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryCleanupPolicies.new(obj['cleanupPolicies'], to_s) }, + 'sizeBytes' => ->(obj) { return :size_bytes, obj['sizeBytes'] }, + 'satisfiesPzs' => ->(obj) { return :satisfies_pzs, obj['satisfiesPzs'] }, + 'cleanupPolicyDryRun' => ->(obj) { return :cleanup_policy_dry_run, obj['cleanupPolicyDryRun'] }, + } + end + + private + + def product_url(_ = nil) + 'https://artifactregistry.googleapis.com/v1beta1/' + end + + def resource_base_url + 'v1beta1/{{parent}}/repositories' + end +end diff --git a/libraries/google_artifactregistry_project_location_repository.rb b/libraries/google_artifactregistry_project_location_repository.rb new file mode 100644 index 000000000..060973f94 --- /dev/null +++ b/libraries/google_artifactregistry_project_location_repository.rb @@ -0,0 +1,102 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- +require 'gcp_backend' +require 'google/artifactregistry/property/projectlocationrepository_cleanup_policies' +require 'google/artifactregistry/property/projectlocationrepository_docker_config' +require 'google/artifactregistry/property/projectlocationrepository_labels' +require 'google/artifactregistry/property/projectlocationrepository_maven_config' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_apt_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_apt_repository_public_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_docker_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_maven_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_npm_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_python_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_upstream_credentials' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_upstream_credentials_username_password_credentials' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_yum_repository' +require 'google/artifactregistry/property/projectlocationrepository_remote_repository_config_yum_repository_public_repository' +require 'google/artifactregistry/property/projectlocationrepository_virtual_repository_config' +require 'google/artifactregistry/property/projectlocationrepository_virtual_repository_config_upstream_policies' + +# A provider to manage Artifact Registry resources. +class ArtifactregistryProjectLocationRepository < GcpResourceBase + name 'google_artifactregistry_project_location_repository' + desc 'ProjectLocationRepository' + supports platform: 'gcp' + + attr_reader :params + attr_reader :maven_config + attr_reader :docker_config + attr_reader :virtual_repository_config + attr_reader :remote_repository_config + attr_reader :name + attr_reader :format + attr_reader :description + attr_reader :labels + attr_reader :create_time + attr_reader :update_time + attr_reader :kms_key_name + attr_reader :mode + attr_reader :cleanup_policies + attr_reader :size_bytes + attr_reader :satisfies_pzs + attr_reader :cleanup_policy_dry_run + + def initialize(params) + super(params.merge({ use_http_transport: true })) + @params = params + @fetched = @connection.fetch(product_url(params[:beta]), resource_base_url, params, 'Get') + parse unless @fetched.nil? + end + + def parse + @maven_config = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryMavenConfig.new(@fetched['mavenConfig'], to_s) + @docker_config = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryDockerConfig.new(@fetched['dockerConfig'], to_s) + @virtual_repository_config = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryVirtualRepositoryConfig.new(@fetched['virtualRepositoryConfig'], to_s) + @remote_repository_config = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfig.new(@fetched['remoteRepositoryConfig'], to_s) + @name = @fetched['name'] + @format = @fetched['format'] + @description = @fetched['description'] + @labels = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryLabels.new(@fetched['labels'], to_s) + @create_time = @fetched['createTime'] + @update_time = @fetched['updateTime'] + @kms_key_name = @fetched['kmsKeyName'] + @mode = @fetched['mode'] + @cleanup_policies = GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryCleanupPolicies.new(@fetched['cleanupPolicies'], to_s) + @size_bytes = @fetched['sizeBytes'] + @satisfies_pzs = @fetched['satisfiesPzs'] + @cleanup_policy_dry_run = @fetched['cleanupPolicyDryRun'] + end + + def exists? + !@fetched.nil? + end + + def to_s + "ProjectLocationRepository #{@params[:name]}" + end + + private + + def product_url(_ = nil) + 'https://artifactregistry.googleapis.com/v1beta1/' + end + + def resource_base_url + 'v1beta1/{{name}}' + end +end diff --git a/test/integration/verify/controls/google_artifactregistry_project_location_repositories.rb b/test/integration/verify/controls/google_artifactregistry_project_location_repositories.rb new file mode 100644 index 000000000..c28d93efe --- /dev/null +++ b/test/integration/verify/controls/google_artifactregistry_project_location_repositories.rb @@ -0,0 +1,30 @@ +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- + +title 'Test GCP google_artifactregistry_project_location_repositories resource.' + +gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.') + + project_location_repository = input('project_location_repository', value: { + "name": "value_name", + "parent": "value_parent" +}, description: 'project_location_repository description') +control 'google_artifactregistry_project_location_repositories-1.0' do + impact 1.0 + title 'google_artifactregistry_project_location_repositories resource test' + + describe google_artifactregistry_project_location_repositories(parent: project_location_repository['parent']) do + it { should exist } + end +end diff --git a/test/integration/verify/controls/google_artifactregistry_project_location_repository.rb b/test/integration/verify/controls/google_artifactregistry_project_location_repository.rb new file mode 100644 index 000000000..1402c937b --- /dev/null +++ b/test/integration/verify/controls/google_artifactregistry_project_location_repository.rb @@ -0,0 +1,35 @@ +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in README.md and +# CONTRIBUTING.md located at the root of this package. +# +# ---------------------------------------------------------------------------- + +title 'Test GCP google_artifactregistry_project_location_repository resource.' + +gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.') + + project_location_repository = input('project_location_repository', value: { + "name": "value_name", + "parent": "value_parent" +}, description: 'project_location_repository description') +control 'google_artifactregistry_project_location_repository-1.0' do + impact 1.0 + title 'google_artifactregistry_project_location_repository resource test' + + describe google_artifactregistry_project_location_repository(name: project_location_repository['name']) do + it { should exist } + + end + + describe google_artifactregistry_project_location_repository(name: "does_not_exit") do + it { should_not exist } + end +end From ca0b04bcdbfcd0c71e5b0cbc92758c4a9e6052b7 Mon Sep 17 00:00:00 2001 From: Nik08 Date: Tue, 5 Dec 2023 17:57:56 +0530 Subject: [PATCH 2/6] Fix resource_base_url and wrap_path for google artifactregistry project location repository resources Signed-off-by: Nik08 --- .../google_artifactregistry_project_location_repositories.rb | 4 ++-- .../google_artifactregistry_project_location_repository.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/google_artifactregistry_project_location_repositories.rb b/libraries/google_artifactregistry_project_location_repositories.rb index 0b1c4c15c..9814e8860 100644 --- a/libraries/google_artifactregistry_project_location_repositories.rb +++ b/libraries/google_artifactregistry_project_location_repositories.rb @@ -45,7 +45,7 @@ class ArtifactregistryProjectLocationRepositorys < GcpResourceBase def initialize(params = {}) super(params.merge({ use_http_transport: true })) @params = params - @table = fetch_wrapped_resource('projectLocationRepositories') + @table = fetch_wrapped_resource('repositories') end def fetch_wrapped_resource(wrap_path) @@ -104,6 +104,6 @@ def product_url(_ = nil) end def resource_base_url - 'v1beta1/{{parent}}/repositories' + '{{parent}}/repositories' end end diff --git a/libraries/google_artifactregistry_project_location_repository.rb b/libraries/google_artifactregistry_project_location_repository.rb index 060973f94..cff85e08d 100644 --- a/libraries/google_artifactregistry_project_location_repository.rb +++ b/libraries/google_artifactregistry_project_location_repository.rb @@ -97,6 +97,6 @@ def product_url(_ = nil) end def resource_base_url - 'v1beta1/{{name}}' + '{{name}}' end end From aafe98633948041d9c6e66b9c837c1adcf8c28de Mon Sep 17 00:00:00 2001 From: Nik08 Date: Wed, 6 Dec 2023 15:10:06 +0530 Subject: [PATCH 3/6] Updated test cases with actual values of name and parent of artifact registry repositories Signed-off-by: Nik08 --- ...rtifactregistry_project_location_repositories.rb | 13 +++++++------ ..._artifactregistry_project_location_repository.rb | 8 ++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/test/integration/verify/controls/google_artifactregistry_project_location_repositories.rb b/test/integration/verify/controls/google_artifactregistry_project_location_repositories.rb index c28d93efe..921b7290c 100644 --- a/test/integration/verify/controls/google_artifactregistry_project_location_repositories.rb +++ b/test/integration/verify/controls/google_artifactregistry_project_location_repositories.rb @@ -15,16 +15,17 @@ title 'Test GCP google_artifactregistry_project_location_repositories resource.' gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.') +gcp_location = input(:gcp_location, value: 'gcp_location', description: 'The GCP project identifier.') - project_location_repository = input('project_location_repository', value: { - "name": "value_name", - "parent": "value_parent" +project_location_repository = input('project_location_repository', value: { + "name": "projects/#{gcp_project_id}/locations/#{gcp_location}/repositories/test-repository", + "parent": "projects/#{gcp_project_id}/locations/#{gcp_location}" }, description: 'project_location_repository description') control 'google_artifactregistry_project_location_repositories-1.0' do impact 1.0 title 'google_artifactregistry_project_location_repositories resource test' - describe google_artifactregistry_project_location_repositories(parent: project_location_repository['parent']) do - it { should exist } - end + describe google_artifactregistry_project_location_repositories(parent: project_location_repository['parent']) do + it { should exist } + end end diff --git a/test/integration/verify/controls/google_artifactregistry_project_location_repository.rb b/test/integration/verify/controls/google_artifactregistry_project_location_repository.rb index 1402c937b..f4b60b98d 100644 --- a/test/integration/verify/controls/google_artifactregistry_project_location_repository.rb +++ b/test/integration/verify/controls/google_artifactregistry_project_location_repository.rb @@ -15,10 +15,11 @@ title 'Test GCP google_artifactregistry_project_location_repository resource.' gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.') +gcp_location = input(:gcp_location, value: 'gcp_location', description: 'The GCP project identifier.') - project_location_repository = input('project_location_repository', value: { - "name": "value_name", - "parent": "value_parent" +project_location_repository = input('project_location_repository', value: { + "name": "projects/#{gcp_project_id}/locations/#{gcp_location}/repositories/test-repository", + "parent": "projects/#{gcp_project_id}/locations/#{gcp_location}" }, description: 'project_location_repository description') control 'google_artifactregistry_project_location_repository-1.0' do impact 1.0 @@ -26,7 +27,6 @@ describe google_artifactregistry_project_location_repository(name: project_location_repository['name']) do it { should exist } - end describe google_artifactregistry_project_location_repository(name: "does_not_exit") do From 28d2d941d11fcd0573b1c206dcc73fe8322480ab Mon Sep 17 00:00:00 2001 From: Nik08 Date: Wed, 6 Dec 2023 15:19:15 +0530 Subject: [PATCH 4/6] Updated resource documentation list with new resources - google_artifactregistry_project_location_repository & google_artifactregistry_project_location_repositories Signed-off-by: Nik08 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e9dde7920..1c4194f66 100644 --- a/README.md +++ b/README.md @@ -373,6 +373,7 @@ The following resources are available in the InSpec GCP Profile | [google_vertex_ai_tensorboard_experiment_run](docs/resources/google_vertex_ai_tensorboard_experiment_run.md) | [google_vertex_ai_tensorboard_experiment_runs](docs/resources/google_vertex_ai_tensorboard_experiment_runs.md) | | [google_vertex_ai_tensorboard_experiment_run_time_series_resource](docs/resources/google_vertex_ai_tensorboard_experiment_run_time_series_resource.md) | [google_vertex_ai_tensorboard_experiment_run_time_series_resources](docs/resources/google_vertex_ai_tensorboard_experiment_run_time_series_resources.md) | | [google_vertex_ai_training_pipeline](docs/resources/google_vertex_ai_training_pipeline.md) | [google_vertex_ai_training_pipelines](docs/resources/google_vertex_ai_training_pipelines.md) | +| [google_artifactregistry_project_location_repository](docs/resources/google_artifactregistry_project_location_repository.md) | [google_artifactregistry_project_location_repositories](docs/resources/google_artifactregistry_project_location_repositories.md) | ## Examples From 47683a7d566966667c61cb0df72452be5736b8bb Mon Sep 17 00:00:00 2001 From: Nik08 Date: Wed, 6 Dec 2023 17:28:23 +0530 Subject: [PATCH 5/6] Terraform changes for integration testing Signed-off-by: Nik08 --- .../test/integration/configuration/mm-attributes.yml | 5 +---- test/integration/build/gcp-mm.tf | 11 +++++++++++ test/integration/configuration/mm-attributes.yml | 8 ++++++++ ..._artifactregistry_project_location_repositories.rb | 2 +- ...le_artifactregistry_project_location_repository.rb | 2 +- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/build/inspec/test/integration/configuration/mm-attributes.yml b/build/inspec/test/integration/configuration/mm-attributes.yml index 8846c65a2..ee0783a9e 100644 --- a/build/inspec/test/integration/configuration/mm-attributes.yml +++ b/build/inspec/test/integration/configuration/mm-attributes.yml @@ -895,7 +895,4 @@ vpn_gateway: network : "value_network" self_link : "value_selflink" label_fingerprint : "value_labelfingerprint" - stack_type : "value_stacktype" -project_location_repository: - name : "value_name" - parent : "value_parent" \ No newline at end of file + stack_type : "value_stacktype" \ No newline at end of file diff --git a/test/integration/build/gcp-mm.tf b/test/integration/build/gcp-mm.tf index 748179b4c..641213bbe 100644 --- a/test/integration/build/gcp-mm.tf +++ b/test/integration/build/gcp-mm.tf @@ -216,6 +216,10 @@ variable "scheduler_job" { type = any } +variable "project_location_repository" { + type = any +} + resource "google_compute_ssl_policy" "custom-ssl-policy" { name = var.ssl_policy["name"] @@ -1552,3 +1556,10 @@ resource "google_vertex_ai_index" "index" { } index_update_method = "STREAM_UPDATE" } + +resource "google_artifact_registry_repository" "example" { + project = var.project_location_repository.project_id + repository_id = var.project_location_repository.display_name + location = var.project_location_repository.location + format = var.project_location_repository.format +} diff --git a/test/integration/configuration/mm-attributes.yml b/test/integration/configuration/mm-attributes.yml index db5c85cba..a491ac1a8 100644 --- a/test/integration/configuration/mm-attributes.yml +++ b/test/integration/configuration/mm-attributes.yml @@ -557,3 +557,11 @@ dlp: name: "dlp-template-inspec" location: "europe-west2" type: "Infotype" + +project_location_repository: + name : "projects/ppradhan/locations/us-central1/repositories/test-repository-1" + parent : "projects/ppradhan/locations/us-central1" + display_name: "test-repository-1" + location: "us-central1" + format: "DOCKER" + project_id: "ppradhan" diff --git a/test/integration/verify/controls/google_artifactregistry_project_location_repositories.rb b/test/integration/verify/controls/google_artifactregistry_project_location_repositories.rb index 921b7290c..baf5d71fd 100644 --- a/test/integration/verify/controls/google_artifactregistry_project_location_repositories.rb +++ b/test/integration/verify/controls/google_artifactregistry_project_location_repositories.rb @@ -18,7 +18,7 @@ gcp_location = input(:gcp_location, value: 'gcp_location', description: 'The GCP project identifier.') project_location_repository = input('project_location_repository', value: { - "name": "projects/#{gcp_project_id}/locations/#{gcp_location}/repositories/test-repository", + "name": "projects/#{gcp_project_id}/locations/#{gcp_location}/repositories/test-repository-1", "parent": "projects/#{gcp_project_id}/locations/#{gcp_location}" }, description: 'project_location_repository description') control 'google_artifactregistry_project_location_repositories-1.0' do diff --git a/test/integration/verify/controls/google_artifactregistry_project_location_repository.rb b/test/integration/verify/controls/google_artifactregistry_project_location_repository.rb index f4b60b98d..b3e6956c6 100644 --- a/test/integration/verify/controls/google_artifactregistry_project_location_repository.rb +++ b/test/integration/verify/controls/google_artifactregistry_project_location_repository.rb @@ -18,7 +18,7 @@ gcp_location = input(:gcp_location, value: 'gcp_location', description: 'The GCP project identifier.') project_location_repository = input('project_location_repository', value: { - "name": "projects/#{gcp_project_id}/locations/#{gcp_location}/repositories/test-repository", + "name": "projects/#{gcp_project_id}/locations/#{gcp_location}/repositories/test-repository-1", "parent": "projects/#{gcp_project_id}/locations/#{gcp_location}" }, description: 'project_location_repository description') control 'google_artifactregistry_project_location_repository-1.0' do From 55cf945bb3594b794ef83a730e5b7d483961153b Mon Sep 17 00:00:00 2001 From: Nik08 Date: Fri, 8 Dec 2023 13:49:30 +0530 Subject: [PATCH 6/6] Linting fix Signed-off-by: Nik08 --- ...tregistry_project_location_repositories.rb | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/libraries/google_artifactregistry_project_location_repositories.rb b/libraries/google_artifactregistry_project_location_repositories.rb index 9814e8860..80cdd679f 100644 --- a/libraries/google_artifactregistry_project_location_repositories.rb +++ b/libraries/google_artifactregistry_project_location_repositories.rb @@ -78,22 +78,22 @@ def transform(key, value) def transformers { - 'mavenConfig' => ->(obj) { return :maven_config, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryMavenConfig.new(obj['mavenConfig'], to_s) }, - 'dockerConfig' => ->(obj) { return :docker_config, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryDockerConfig.new(obj['dockerConfig'], to_s) }, - 'virtualRepositoryConfig' => ->(obj) { return :virtual_repository_config, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryVirtualRepositoryConfig.new(obj['virtualRepositoryConfig'], to_s) }, - 'remoteRepositoryConfig' => ->(obj) { return :remote_repository_config, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfig.new(obj['remoteRepositoryConfig'], to_s) }, - 'name' => ->(obj) { return :name, obj['name'] }, - 'format' => ->(obj) { return :format, obj['format'] }, - 'description' => ->(obj) { return :description, obj['description'] }, - 'labels' => ->(obj) { return :labels, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryLabels.new(obj['labels'], to_s) }, - 'createTime' => ->(obj) { return :create_time, obj['createTime'] }, - 'updateTime' => ->(obj) { return :update_time, obj['updateTime'] }, - 'kmsKeyName' => ->(obj) { return :kms_key_name, obj['kmsKeyName'] }, - 'mode' => ->(obj) { return :mode, obj['mode'] }, - 'cleanupPolicies' => ->(obj) { return :cleanup_policies, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryCleanupPolicies.new(obj['cleanupPolicies'], to_s) }, - 'sizeBytes' => ->(obj) { return :size_bytes, obj['sizeBytes'] }, - 'satisfiesPzs' => ->(obj) { return :satisfies_pzs, obj['satisfiesPzs'] }, - 'cleanupPolicyDryRun' => ->(obj) { return :cleanup_policy_dry_run, obj['cleanupPolicyDryRun'] }, + 'mavenConfig' => ->(obj) { [:maven_config, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryMavenConfig.new(obj['mavenConfig'], to_s)] }, + 'dockerConfig' => ->(obj) { [:docker_config, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryDockerConfig.new(obj['dockerConfig'], to_s)] }, + 'virtualRepositoryConfig' => ->(obj) { [:virtual_repository_config, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryVirtualRepositoryConfig.new(obj['virtualRepositoryConfig'], to_s)] }, + 'remoteRepositoryConfig' => ->(obj) { [:remote_repository_config, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryRemoteRepositoryConfig.new(obj['remoteRepositoryConfig'], to_s)] }, + 'name' => ->(obj) { [:name, obj['name']] }, + 'format' => ->(obj) { [:format, obj['format']] }, + 'description' => ->(obj) { [:description, obj['description']] }, + 'labels' => ->(obj) { [:labels, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryLabels.new(obj['labels'], to_s)] }, + 'createTime' => ->(obj) { [:create_time, obj['createTime']] }, + 'updateTime' => ->(obj) { [:update_time, obj['updateTime']] }, + 'kmsKeyName' => ->(obj) { [:kms_key_name, obj['kmsKeyName']] }, + 'mode' => ->(obj) { [:mode, obj['mode']] }, + 'cleanupPolicies' => ->(obj) { [:cleanup_policies, GoogleInSpec::Artifactregistry::Property::ProjectLocationRepositoryCleanupPolicies.new(obj['cleanupPolicies'], to_s)] }, + 'sizeBytes' => ->(obj) { [:size_bytes, obj['sizeBytes']] }, + 'satisfiesPzs' => ->(obj) { [:satisfies_pzs, obj['satisfiesPzs']] }, + 'cleanupPolicyDryRun' => ->(obj) { [:cleanup_policy_dry_run, obj['cleanupPolicyDryRun']] }, } end