# Copyright 2024 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: 'Sitemap'
description: |
  Sitemap is a file where you provide information about the pages, videos, and
  other files on your site, and the relationships between them.
references:
  guides:
  api: 'https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.dataStores.siteSearchEngine.sitemaps'
docs:
base_url: 'projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}/siteSearchEngine/sitemaps:fetch'
self_link: 'projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}/siteSearchEngine/sitemaps:fetch'
id_format: '{{name}}'
create_url: 'projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}/siteSearchEngine/sitemaps'
delete_url: '{{name}}'
immutable: true
import_format:
  - '{{name}}'
timeouts:
  insert_minutes: 60
  delete_minutes: 60
autogen_async: false
async:
  actions: ['create', 'delete']
  type: 'OpAsync'
  operation:
    base_url: '{{op_id}}'
    timeouts:
      insert_minutes: 60
      delete_minutes: 60
  result:
    resource_inside_response: true
custom_code:
  custom_import: 'templates/terraform/custom_import/discoveryengine_sitemap_set_id.go.tmpl'
  post_read: 'templates/terraform/post_read/discoveryengine_sitemap_post_read.go.tmpl'
  test_check_destroy: 'templates/terraform/custom_check_destroy/discoveryengine_sitemap.go.tmpl'
examples:
  - name: 'discoveryengine_sitemap_basic'
    primary_resource_id: 'basic'
    vars:
      data_store_id: 'data-store-id'
    ignore_read_extra:
      - 'project'
parameters:
  - name: 'location'
    type: String
    description: |
      The geographic location where the data store should reside. The value can
      only be one of "global", "us" and "eu".
    url_param_only: true
    required: true
    immutable: true
  - name: 'dataStoreId'
    type: String
    description: |
      The unique id of the data store.
    url_param_only: true
    required: true
    immutable: true
  - name: 'sitemapId'
    type: String
    description: |
      The unique id of the sitemap.
    url_param_only: true
    immutable: true
    output: true
properties:
  - name: 'name'
    type: String
    description: |
      The unique full resource name of the sitemap. Values are of the format
      `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}/siteSearchEngine/sitemaps/{sitemap_id}`.
      This field must be a UTF-8 encoded string with a length limit of 1024
      characters.
    output: true
  - name: 'uri'
    type: String
    description: |
      Public URI for the sitemap, e.g. "www.example.com/sitemap.xml".
  - name: 'createTime'
    type: Time
    description: |
      Timestamp when the sitemap was created.
    output: true
