diff --git a/mmv1/products/developerconnect/GitRepositoryLink.yaml b/mmv1/products/developerconnect/GitRepositoryLink.yaml index 38025defcb69..d89bdfd2d97c 100644 --- a/mmv1/products/developerconnect/GitRepositoryLink.yaml +++ b/mmv1/products/developerconnect/GitRepositoryLink.yaml @@ -12,15 +12,35 @@ # limitations under the License. --- -name: GitRepositoryLink -description: A git repository link to a parent connection. -base_url: projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks +name: 'GitRepositoryLink' +description: "A git repository link to a parent connection." +docs: +id_format: 'projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}}' +base_url: 'projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks' +self_link: 'projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}}' +create_url: 'projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks?gitRepositoryLinkId={{git_repository_link_id}}' immutable: true -self_link: projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}} -create_url: projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks?gitRepositoryLinkId={{git_repository_link_id}} -id_format: projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}} import_format: - - projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}} + - 'projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}}' +timeouts: + insert_minutes: 20 + update_minutes: 20 + delete_minutes: 20 +autogen_async: true +async: + actions: ['create', 'delete', 'update'] + type: 'OpAsync' + operation: + base_url: '{{op_id}}' + path: 'name' + wait_ms: 1000 + result: + path: 'response' + resource_inside_response: true + error: + path: 'error' + message: 'message' +custom_code: examples: # These tests depend on secrets stored in a separate project, so we prefer not # to show them in the docs. @@ -32,118 +52,74 @@ examples: exclude_docs: true - name: 'developer_connect_git_repository_link_github_doc' exclude_test: true - - name: 'developer_connect_git_repository_link_github_enterprise' - primary_resource_id: 'primary' - vars: - connection_name: 'my-connection' - git_repository_link_name: 'my-repository' - exclude_docs: true - - name: 'developer_connect_git_repository_link_github_enterprise_doc' - exclude_test: true - - name: 'developer_connect_git_repository_link_gitlab' - primary_resource_id: 'my-connection' - primary_resource_name: 'fmt.Sprintf("tf-test-connection%s", context["random_suffix"])' - vars: - connection_name: 'tf-test-connection' - git_repository_link_name: 'my-repository' - exclude_docs: true - - name: 'developer_connect_git_repository_link_gitlab_doc' - exclude_test: true - - name: 'developer_connect_git_repository_link_gitlab_enterprise' - primary_resource_id: 'my-connection' - primary_resource_name: 'fmt.Sprintf("tf-test-connection%s", context["random_suffix"])' - vars: - connection_name: 'tf-test-connection' - git_repository_link_name: 'my-repository' - exclude_docs: true - - name: 'developer_connect_git_repository_link_gitlab_enterprise_doc' - exclude_test: true -autogen_async: true -async: - operation: - timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 - base_url: '{{op_id}}' - actions: - - create - - delete - - update - type: OpAsync - result: - resource_inside_response: true - error: {} - include_project: false -autogen_status: R2l0UmVwb3NpdG9yeUxpbms= parameters: - - name: location + - name: 'location' type: String - description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - immutable: true + description: + "Resource ID segment making up resource `name`. It identifies the resource + within its parent collection as described in https://google.aip.dev/122. See documentation + for resource type `developerconnect.googleapis.com/GitRepositoryLink`. " url_param_only: true required: true - - name: parent_connection - type: String - description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. immutable: true + - name: 'parent_connection' + type: String + description: + "Resource ID segment making up resource `name`. It identifies the resource + within its parent collection as described in https://google.aip.dev/122. See documentation + for resource type `developerconnect.googleapis.com/GitRepositoryLink`. " url_param_only: true required: true - - name: gitRepositoryLinkId - type: String - description: |- - Required. The ID to use for the repository, which will become the final component of - the repository's resource name. This ID should be unique in the connection. - Allows alphanumeric characters and any of -._~%!$&'()*+,;=@. immutable: true + - name: 'gitRepositoryLinkId' + type: String + description: + "Required. The ID to use for the repository, which will become the + final component of\nthe repository's resource name. This ID should be unique in + the connection.\nAllows alphanumeric characters and any of -._~%!$&'()*+,;=@. " url_param_only: true required: true + immutable: true properties: - - name: cloneUri + - name: 'name' type: String - description: Required. Git Clone URI. - required: true - - name: labels - type: KeyValueLabels - description: Optional. Labels as key value pairs - - name: annotations - type: KeyValueAnnotations - description: Optional. Allows clients to store small amounts of arbitrary data. - - name: uid - type: String - description: Output only. A system-assigned unique identifier for a the GitRepositoryLink. + description: "Identifier. Resource name of the repository, in the format\n`projects/*/locations/*/connections/*/gitRepositoryLinks/*`. " output: true - - name: name + - name: 'cloneUri' type: String - description: |- - Identifier. Resource name of the repository, in the format - `projects/*/locations/*/connections/*/gitRepositoryLinks/*`. - output: true - - name: updateTime + description: "Required. Git Clone URI. " + required: true + - name: 'createTime' type: String - description: Output only. [Output only] Update timestamp + description: "Output only. [Output only] Create timestamp " output: true - - name: deleteTime + - name: 'updateTime' type: String - description: Output only. [Output only] Delete timestamp + description: "Output only. [Output only] Update timestamp " output: true - - name: etag + - name: 'deleteTime' type: String - description: |- - Optional. This checksum is computed by the server based on the value of other - fields, and may be sent on update and delete requests to ensure the - client has an up-to-date value before proceeding. - - name: reconciling - type: Boolean - description: |- - Output only. Set to true when the connection is being set up or updated in the - background. + description: "Output only. [Output only] Delete timestamp " output: true - - name: webhookId + - name: 'labels' + type: KeyValueLabels + description: "Optional. Labels as key value pairs " + - name: 'etag' type: String - description: Output only. External ID of the webhook created for the repository. + description: + "Optional. This checksum is computed by the server based on the value + of other\nfields, and may be sent on update and delete requests to ensure the\nclient + has an up-to-date value before proceeding. " + - name: 'reconciling' + type: Boolean + description: + "Output only. Set to true when the connection is being set up or updated + in the\nbackground. " output: true - - name: createTime + - name: 'annotations' + type: KeyValueAnnotations + description: "Optional. Allows clients to store small amounts of arbitrary data. " + - name: 'uid' type: String - description: Output only. [Output only] Create timestamp + description: "Output only. A system-assigned unique identifier for a the GitRepositoryLink. " output: true diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github.tf.tmpl index b673c58bfbb9..d4cb09a4c0f0 100644 --- a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github.tf.tmpl +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github.tf.tmpl @@ -1,15 +1,15 @@ resource "google_developer_connect_git_repository_link" "{{$.PrimaryResourceId}}" { - git_repository_link_id = "{{index $.Vars "git_repository_link_name"}}" + git_repository_link_id = "{{index $.Vars "git_repository_link_name"}}" parent_connection = google_developer_connect_connection.github_conn.connection_id - clone_uri = "https://github.com/gcb-developerconnect-robot/tf-demo.git" - location = "us-central1" - annotations = {} - labels = {} + clone_uri = "https://github.com/gcb-developerconnect-robot/tf-demo.git" + location = "us-central1" + annotations = {} } - + resource "google_developer_connect_connection" "github_conn" { + location = "us-central1" - connection_id = "{{index $.Vars "connection_name"}}" + connection_id = "{{index $.Vars "connection_name"}}" disabled = false github_config { @@ -21,4 +21,3 @@ resource "google_developer_connect_connection" "github_conn" { } } } - diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_doc.tf.tmpl index 8f3b566677d5..63829f055fde 100644 --- a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_doc.tf.tmpl +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_doc.tf.tmpl @@ -41,5 +41,5 @@ resource "google_developer_connect_git_repository_link" "my-repository" { location = "us-central1" git_repository_link_id = "my-repo" parent_connection = google_developer_connect_connection.my-connection.connection_id - clone_uri = "https://github.com/myuser/myrepo.git" + remote_uri = "https://github.com/myuser/myrepo.git" } diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_enterprise.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_enterprise.tf.tmpl deleted file mode 100644 index 1633252ef757..000000000000 --- a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_enterprise.tf.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -resource "google_developer_connect_git_repository_link" "{{$.PrimaryResourceId}}" { - git_repository_link_id = "{{index $.Vars "git_repository_link_name"}}" - parent_connection = google_developer_connect_connection.github_enterprise_conn.connection_id - clone_uri = "https://ghe.proctor-staging-test.com/proctorteam/inarayanan-test.git" - location = "us-central1" - annotations = {} - labels = {} -} - -resource "google_developer_connect_connection" "github_enterprise_conn" { - - location = "us-central1" - connection_id = "{{index $.Vars "connection_name"}}" - disabled = false - - github_enterprise_config { - host_uri = "https://ghe.proctor-staging-test.com" - app_id = 864434 - private_key_secret_version = "projects/devconnect-terraform-creds/secrets/tf-test-ghe-do-not-change-ghe-private-key-f522d2/versions/latest" - webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/tf-test-ghe-do-not-change-ghe-webhook-secret-3c806f/versions/latest" - app_installation_id = 837537 - } -} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_enterprise_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_enterprise_doc.tf.tmpl deleted file mode 100644 index fbf9a62e188e..000000000000 --- a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_enterprise_doc.tf.tmpl +++ /dev/null @@ -1,68 +0,0 @@ -resource "google_secret_manager_secret" "private-key-secret" { - secret_id = "ghe-pk-secret" - - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "private-key-secret-version" { - secret = google_secret_manager_secret.private-key-secret.id - secret_data = file("private-key.pem") -} - -resource "google_secret_manager_secret" "webhook-secret-secret" { - secret_id = "ghe-token-secret" - - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "webhook-secret-secret-version" { - secret = google_secret_manager_secret.webhook-secret-secret.id - secret_data = "" -} - -data "google_iam_policy" "p4sa-secretAccessor" { - binding { - role = "roles/secretmanager.secretAccessor" - // Here, 123456789 is the Google Cloud project number for the project that contains the connection. - members = ["serviceAccount:service-123456789@gcp-sa-devconnect.iam.gserviceaccount.com"] - } -} - -resource "google_secret_manager_secret_iam_policy" "policy-pk" { - secret_id = google_secret_manager_secret.private-key-secret.secret_id - policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data -} - -resource "google_secret_manager_secret_iam_policy" "policy-whs" { - secret_id = google_secret_manager_secret.webhook-secret-secret.secret_id - policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data -} - -resource "google_developer_connect_connection" "my-connection" { - location = "us-central1" - connection_id = "my-connection" - - github_enterprise_config { - host_uri = "https://ghe.com" - private_key_secret_version = google_secret_manager_secret_version.private-key-secret-version.id - webhook_secret_secret_version = google_secret_manager_secret_version.webhook-secret-secret-version.id - app_id = 100 - app_installation_id = 123123 - } - - depends_on = [ - google_secret_manager_secret_iam_policy.policy-pk, - google_secret_manager_secret_iam_policy.policy-whs - ] -} - -resource "google_developer_connect_git_repository_link" "my-repository" { - location = "us-central1" - git_repository_link_id = "my-repo" - parent_connection = google_developer_connect_connection.my-connection.connection_id - clone_uri = "https://ghe.com/myuser/myrepo.git" -} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab.tf.tmpl deleted file mode 100644 index d82f50cdeceb..000000000000 --- a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab.tf.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -resource "google_developer_connect_git_repository_link" "{{$.PrimaryResourceId}}" { - git_repository_link_id = "{{index $.Vars "git_repository_link_name"}}" - parent_connection = google_developer_connect_connection.gitlab_conn.connection_id - clone_uri = "https://gitlab.com/devconnect-eng-team/inarayanan-test.git" - location = "us-central1" - annotations = {} - labels = {} -} - -resource "google_developer_connect_connection" "gitlab_conn" { - - location = "us-central1" - connection_id = "{{index $.Vars "connection_name"}}" - disabled = false - - gitlab_config { - webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-webhook/versions/latest" - - read_authorizer_credential { - user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-read-cred/versions/latest" - } - - authorizer_credential { - user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-auth-cred/versions/latest" - } - } -} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_doc.tf.tmpl deleted file mode 100644 index 0b56a9bfeecd..000000000000 --- a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_doc.tf.tmpl +++ /dev/null @@ -1,88 +0,0 @@ -resource "google_secret_manager_secret" "gitlab-read-cred-secret" { - secret_id = "gitlab-read-cred" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "gitlab-read-cred-secret-version" { - secret = google_secret_manager_secret.gitlab-read-cred-secret.id - secret_data = file("my-gitlab-read-cred.txt") -} - -resource "google_secret_manager_secret" "gitlab-auth-cred-secret" { - secret_id = "gitlab-auth-cred" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "gitlab-auth-cred-secret-version" { - secret = google_secret_manager_secret.gitlab-auth-cred-secret.id - secret_data = file("my-gitlab-auth-cred.txt") -} - -resource "google_secret_manager_secret" "gitlab-webhook-secret-secret" { - secret_id = "gitlab-webhook-secret" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "gitlab-webhook-secret-secret-version" { - secret = google_secret_manager_secret.gitlab-webhook-secret-secret.id - secret_data = file("my-gitlab-webhook-secret.txt") - -data "google_iam_policy" "p4sa-secretAccessor" { - binding { - role = "roles/secretmanager.secretAccessor" - // Here, 123456789 is the Google Cloud project number for the project that contains the connection. - members = ["serviceAccount:service-123456789@gcp-sa-devconnect.iam.gserviceaccount.com"] - } -} - -resource "google_secret_manager_secret_iam_policy" "policy-rc" { - secret_id = google_secret_manager_secret.gitlab-read-cred-secret.secret_id - policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data -} - -resource "google_secret_manager_secret_iam_policy" "policy-ac" { - secret_id = google_secret_manager_secret.gitlab-auth-cred-secret.secret_id - policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data -} - -resource "google_secret_manager_secret_iam_policy" "policy-wh" { - secret_id = google_secret_manager_secret.gitlab-webhook-secret-secret.secret_id - policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data -} - -resource "google_developer_connect_connection" "my-connection" { - - location = "us-central1" - connection_id = "my-connection" - - gitlab_config { - webhook_secret_secret_version = google_secret_manager_secret_version.gitlab-webhook-secret-secret-version.id - - read_authorizer_credential { - user_token_secret_version = google_secret_manager_secret_version.gitlab-read-cred-secret-version.id - } - - authorizer_credential { - user_token_secret_version = google_secret_manager_secret_version.gitlab-auth-cred-secret-version.id - } - } - - depends_on = [ - google_secret_manager_secret_iam_policy.policy-rc, - google_secret_manager_secret_iam_policy.policy-ac, - google_secret_manager_secret_iam_policy.policy-wh - ] -} - -resource "google_developer_connect_git_repository_link" "my-repository" { - location = "us-central1" - git_repository_link_id = "my-repo" - parent_connection = google_developer_connect_connection.my-connection.connection_id - clone_uri = "https://gitlab.com/myuser/myrepo.git" -} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_enterprise.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_enterprise.tf.tmpl deleted file mode 100644 index 567c08694359..000000000000 --- a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_enterprise.tf.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_developer_connect_git_repository_link" "{{$.PrimaryResourceId}}" { - git_repository_link_id = "{{index $.Vars "git_repository_link_name"}}" - parent_connection = google_developer_connect_connection.gitlab_enterprise_conn.connection_id - clone_uri = "https://gle-us-central1.gcb-test.com/test-group/inarayanan-test.git" - location = "us-central1" - annotations = {} - labels = {} -} - -resource "google_developer_connect_connection" "gitlab_enterprise_conn" { - - location = "us-central1" - connection_id = "{{index $.Vars "connection_name"}}" - disabled = false - - gitlab_enterprise_config { - host_uri = "https://gle-us-central1.gcb-test.com" - - webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-webhook/versions/latest" - - read_authorizer_credential { - user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-read-cred/versions/latest" - } - - authorizer_credential { - user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-auth-cred/versions/latest" - } - } -} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_enterprise_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_enterprise_doc.tf.tmpl deleted file mode 100644 index 5e61679d339f..000000000000 --- a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_enterprise_doc.tf.tmpl +++ /dev/null @@ -1,90 +0,0 @@ -resource "google_secret_manager_secret" "gitlab-read-cred-secret" { - secret_id = "gitlab-read-cred" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "gitlab-read-cred-secret-version" { - secret = google_secret_manager_secret.gitlab-read-cred-secret.id - secret_data = file("my-gitlab-read-cred.txt") -} - -resource "google_secret_manager_secret" "gitlab-auth-cred-secret" { - secret_id = "gitlab-auth-cred" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "gitlab-auth-cred-secret-version" { - secret = google_secret_manager_secret.gitlab-auth-cred-secret.id - secret_data = file("my-gitlab-auth-cred.txt") -} - -resource "google_secret_manager_secret" "gitlab-webhook-secret-secret" { - secret_id = "gitlab-webhook-secret" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "gitlab-webhook-secret-secret-version" { - secret = google_secret_manager_secret.gitlab-webhook-secret-secret.id - secret_data = file("my-gitlab-webhook-secret.txt") - -data "google_iam_policy" "p4sa-secretAccessor" { - binding { - role = "roles/secretmanager.secretAccessor" - // Here, 123456789 is the Google Cloud project number for the project that contains the connection. - members = ["serviceAccount:service-123456789@gcp-sa-devconnect.iam.gserviceaccount.com"] - } -} - -resource "google_secret_manager_secret_iam_policy" "policy-rc" { - secret_id = google_secret_manager_secret.gitlab-read-cred-secret.secret_id - policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data -} - -resource "google_secret_manager_secret_iam_policy" "policy-ac" { - secret_id = google_secret_manager_secret.gitlab-auth-cred-secret.secret_id - policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data -} - -resource "google_secret_manager_secret_iam_policy" "policy-wh" { - secret_id = google_secret_manager_secret.gitlab-webhook-secret-secret.secret_id - policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data -} - -resource "google_developer_connect_connection" "my-connection" { - - location = "us-central1" - connection_id = "my-connection" - - gitlab_enterprise_config { - host_uri = "https://gle.com" - - webhook_secret_secret_version = google_secret_manager_secret_version.gitlab-webhook-secret-secret-version.id - - read_authorizer_credential { - user_token_secret_version = google_secret_manager_secret_version.gitlab-read-cred-secret-version.id - } - - authorizer_credential { - user_token_secret_version = google_secret_manager_secret_version.gitlab-auth-cred-secret-version.id - } - } - - depends_on = [ - google_secret_manager_secret_iam_policy.policy-rc, - google_secret_manager_secret_iam_policy.policy-ac, - google_secret_manager_secret_iam_policy.policy-wh - ] -} - -resource "google_developer_connect_git_repository_link" "my-repository" { - location = "us-central1" - git_repository_link_id = "my-repo" - parent_connection = google_developer_connect_connection.my-connection.connection_id - clone_uri = "https://gle.com/myuser/myrepo.git" -}