# Copyright 2019 Google LLC
#
# 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.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudPrivateCatalogProducer.V1beta1.Model.GoogleCloudPrivatecatalogproducerV1beta1Association do
  @moduledoc """
  An association tuple that pairs a `Catalog` to a resource
  that can use the `Catalog`. After association, a
  google.cloud.privatecatalog.v1beta1.Catalog becomes available to
  consumers under specified Association.resource and all of its child
  nodes.
  Users who have the `cloudprivatecatalog.targets.get` permission on any of
  the resource nodes can access the catalog and child products under the node.

  For example, suppose the cloud resource hierarchy is as follows:

  * organizations/example.com
    * folders/team
      * projects/test

  After creating an association with `organizations/example.com`, the catalog
  `catalogs/1`  is accessible from the following paths:

  * organizations/example.com
  * folders/team
  * projects/test

  Users can access them by
  google.cloud.v1beta1.PrivateCatalog.SearchCatalogs action.

  ## Attributes

  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - The creation time of the association.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. The resource name of the catalog association, in the format
      `catalogs/{catalog_id}/associations/{association_id}'.

      A unique identifier for the catalog association, which is
      generated by catalog service.
  *   `resource` (*type:* `String.t`, *default:* `nil`) - Required. The user-supplied fully qualified name of the `Resource`
      associated to the `Catalog`. It supports `Organization`, `Folder`,
      and `Project`. Values are of the form

      * `//cloudresourcemanager.googleapis.com/projects/{product_number}`
      * `//cloudresourcemanager.googleapis.com/folders/{folder_id}`
      * `//cloudresourcemanager.googleapis.com/organizations/{organization_id}`
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :createTime => DateTime.t(),
          :name => String.t(),
          :resource => String.t()
        }

  field(:createTime, as: DateTime)
  field(:name)
  field(:resource)
end

defimpl Poison.Decoder,
  for:
    GoogleApi.CloudPrivateCatalogProducer.V1beta1.Model.GoogleCloudPrivatecatalogproducerV1beta1Association do
  def decode(value, options) do
    GoogleApi.CloudPrivateCatalogProducer.V1beta1.Model.GoogleCloudPrivatecatalogproducerV1beta1Association.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for:
    GoogleApi.CloudPrivateCatalogProducer.V1beta1.Model.GoogleCloudPrivatecatalogproducerV1beta1Association do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
