# 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.GKEHub.V1.Model.ConfigManagementConfigSync do
  @moduledoc """
  Configuration for Config Sync

  ## Attributes

  *   `allowVerticalScale` (*type:* `boolean()`, *default:* `nil`) - Set to true to allow the vertical scaling. Defaults to false which disallows vertical scaling. This field is deprecated.
  *   `enabled` (*type:* `boolean()`, *default:* `nil`) - Enables the installation of ConfigSync. If set to true, ConfigSync resources will be created and the other ConfigSync fields will be applied if exist. If set to false, all other ConfigSync fields will be ignored, ConfigSync resources will be deleted. If omitted, ConfigSync resources will be managed depends on the presence of the git or oci field.
  *   `git` (*type:* `GoogleApi.GKEHub.V1.Model.ConfigManagementGitConfig.t`, *default:* `nil`) - Git repo configuration for the cluster.
  *   `metricsGcpServiceAccountEmail` (*type:* `String.t`, *default:* `nil`) - The Email of the Google Cloud Service Account (GSA) used for exporting Config Sync metrics to Cloud Monitoring and Cloud Monarch when Workload Identity is enabled. The GSA should have the Monitoring Metric Writer (roles/monitoring.metricWriter) IAM role. The Kubernetes ServiceAccount `default` in the namespace `config-management-monitoring` should be bound to the GSA. Deprecated: If Workload Identity Federation for GKE is enabled, Google Cloud Service Account is no longer needed for exporting Config Sync metrics: https://cloud.google.com/kubernetes-engine/enterprise/config-sync/docs/how-to/monitor-config-sync-cloud-monitoring#custom-monitoring.
  *   `oci` (*type:* `GoogleApi.GKEHub.V1.Model.ConfigManagementOciConfig.t`, *default:* `nil`) - OCI repo configuration for the cluster
  *   `preventDrift` (*type:* `boolean()`, *default:* `nil`) - Set to true to enable the Config Sync admission webhook to prevent drifts. If set to `false`, disables the Config Sync admission webhook and does not prevent drifts.
  *   `sourceFormat` (*type:* `String.t`, *default:* `nil`) - Specifies whether the Config Sync Repo is in "hierarchical" or "unstructured" mode.
  *   `stopSyncing` (*type:* `boolean()`, *default:* `nil`) - Set to true to stop syncing configs for a single cluster. Default to false.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :allowVerticalScale => boolean() | nil,
          :enabled => boolean() | nil,
          :git => GoogleApi.GKEHub.V1.Model.ConfigManagementGitConfig.t() | nil,
          :metricsGcpServiceAccountEmail => String.t() | nil,
          :oci => GoogleApi.GKEHub.V1.Model.ConfigManagementOciConfig.t() | nil,
          :preventDrift => boolean() | nil,
          :sourceFormat => String.t() | nil,
          :stopSyncing => boolean() | nil
        }

  field(:allowVerticalScale)
  field(:enabled)
  field(:git, as: GoogleApi.GKEHub.V1.Model.ConfigManagementGitConfig)
  field(:metricsGcpServiceAccountEmail)
  field(:oci, as: GoogleApi.GKEHub.V1.Model.ConfigManagementOciConfig)
  field(:preventDrift)
  field(:sourceFormat)
  field(:stopSyncing)
end

defimpl Poison.Decoder, for: GoogleApi.GKEHub.V1.Model.ConfigManagementConfigSync do
  def decode(value, options) do
    GoogleApi.GKEHub.V1.Model.ConfigManagementConfigSync.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.GKEHub.V1.Model.ConfigManagementConfigSync do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
