# 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: 'DnsZone'
description: |
  Apigee Dns Zone.
references:
  guides:
    'Creating a DnsZone': 'https://cloud.google.com/apigee/docs/api-platform/get-started/create-dns'
  api: 'https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.dnsZones/create'
docs:
base_url: 'dnsZones'
self_link: '{{org_id}}/dnsZones/{{dns_zone_id}}'
create_url: '{{org_id}}/dnsZones?dnsZoneId={{dns_zone_id}}'
delete_url: '{{org_id}}/dnsZones/{{dns_zone_id}}'
immutable: true
import_format:
  - '{{org_id}}/dnsZones/{{dns_zone_id}}'
  - '{{org_id}}/{{dns_zone_id}}'
timeouts:
  insert_minutes: 30
  update_minutes: 20
  delete_minutes: 30
autogen_async: true
async:
  actions: ['create', 'delete', 'update']
  type: 'OpAsync'
  operation:
    base_url: '{{op_id}}'
  result:
    resource_inside_response: true
custom_code:
  custom_import: 'templates/terraform/custom_import/apigee_dns_zone.go.tmpl'
examples:
  - name: 'apigee_dns_zone_basic'
    exclude_test: true
  - name: 'apigee_dns_zone_basic_test'
    primary_resource_id: 'apigee_dns_zone'
    min_version: 'beta'
    test_env_vars:
      org_id: 'ORG_ID'
      billing_account: 'BILLING_ACCT'
    exclude_docs: true
    skip_vcr: true
    external_providers: ["time"]
exclude_sweeper: true
parameters:
  - name: 'orgId'
    type: String
    description: |
      The Apigee Organization associated with the Apigee instance,
      in the format `organizations/{{org_name}}`.
    url_param_only: true
    required: true
    immutable: true
  - name: 'dnsZoneId'
    type: String
    description: |
      ID of the dns zone.
    url_param_only: true
    required: true
    immutable: true
properties:
  - name: 'name'
    type: String
    description: |
      Name of the Dns Zone in the following format:
      organizations/{organization}/dnsZones/{dnsZone}.
    output: true
  - name: 'domain'
    type: String
    description: |
      Doamin for the zone.
    required: true
  - name: 'description'
    type: String
    description: |
      Description for the zone.
    required: true
  - name: 'peeringConfig'
    type: NestedObject
    description: |
      Peering zone config
    required: true
    properties:
      - name: 'targetProjectId'
        type: String
        description: |
          The ID of the project that contains the producer VPC network.
        required: true
      - name: 'targetNetworkId'
        type: String
        description: |
          The name of the producer VPC network.
        required: true
