# Copyright 2025 Google Inc.
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
name: GoogleChannelConfig
legacy_long_form_project: true
base_url: projects/{{project}}/locations/{{location}}
self_link: projects/{{project}}/locations/{{location}}/googleChannelConfig
# This is a singleton resource that is already created, so create
# is really an update, and therefore should be PATCHed. We also
# hardcode the update mask.
create_verb: PATCH
create_url: projects/{{project}}/locations/{{location}}/googleChannelConfig?updateMask=cryptoKeyName
update_verb: PATCH
update_url: projects/{{project}}/locations/{{location}}/googleChannelConfig
update_mask: true
# This is a singleton resource that cannot be deleted, so skip delete.
exclude_delete: true
import_format:
  - 'projects/{{project}}/locations/{{location}}/googleChannelConfig'
  - '{{project}}/{{location}}'
  - '{{location}}'
references:
  guides:
    'Official Documentation': 'https://cloud.google.com/eventarc/docs/use-cmek#enable-cmek-google-channel'
  api: https://cloud.google.com/eventarc/docs/reference/rest/v1/projects.locations
description: |
 The Eventarc GoogleChannelConfig resource
examples:
  - name: eventarc_google_channel_config_with_cmek
    primary_resource_id: primary
    test_env_vars:
      project_name: 'PROJECT_NAME'
    # All tests are handwritten to ensure they don't run in parallel.
    exclude_test: true
parameters:
  - name: location
    type: String
    description: The location for the resource
    url_param_only: true
    required: true
    immutable: true
properties:
  - name: name
    type: String
    description: Required. The resource name of the config. Must be in the format of, `projects/{project}/locations/{location}/googleChannelConfig`.
    required: true
    immutable: true
    diff_suppress_func: tpgresource.CompareSelfLinkOrResourceName
  - name: updateTime
    type: String
    description: Output only. The last-modified time.
    output: true
  - name: cryptoKeyName
    type: String
    diff_suppress_func: tpgresource.CompareSelfLinkOrResourceName
    description: Optional. Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt their event data. It must match the pattern `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
