// Code generated by sidekick. DO NOT EDIT.
//
// Copyright 2026 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
//
//     https://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.

import Foundation
import GoogleCloudWkt

/// NetworkConfig reports the relative names of network & subnetwork.
public struct NetworkConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Output only. The relative name of the Google Compute Engine
  /// [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks)
  /// to which the cluster is connected. Example:
  /// projects/my-project/global/networks/my-network
  public var network: Swift.String = Swift.String()

  /// Output only. The relative name of the Google Compute Engine
  /// [subnetwork](https://cloud.google.com/compute/docs/vpc)
  /// to which the cluster is connected. Example:
  /// projects/my-project/regions/us-central1/subnetworks/my-subnet
  public var subnetwork: Swift.String = Swift.String()

  /// Whether Intra-node visibility is enabled for this cluster.
  /// This makes same node pod to pod traffic visible for VPC network.
  public var enableIntraNodeVisibility: Swift.Bool = Swift.Bool()

  /// Whether the cluster disables default in-node sNAT rules. In-node sNAT rules
  /// will be disabled when default_snat_status is disabled. When disabled is set
  /// to false, default IP masquerade rules will be applied to the nodes to
  /// prevent sNAT on cluster internal traffic.
  public var defaultSnatStatus: DefaultSnatStatus? = nil

  /// Whether L4ILB Subsetting is enabled for this cluster.
  public var enableL4IlbSubsetting: Swift.Bool = Swift.Bool()

  /// The desired datapath provider for this cluster. By default, uses the
  /// IPTables-based kube-proxy implementation.
  public var datapathProvider: DatapathProvider = DatapathProvider()

  /// The desired state of IPv6 connectivity to Google Services.
  /// By default, no private IPv6 access to or from Google Services (all access
  /// will be via IPv4)
  public var privateIpv6GoogleAccess: PrivateIPv6GoogleAccess = PrivateIPv6GoogleAccess()

  /// DNSConfig contains clusterDNS config for this cluster.
  public var dnsConfig: DNSConfig? = nil

  /// ServiceExternalIPsConfig specifies if services with externalIPs field are
  /// blocked or not.
  public var serviceExternalIpsConfig: ServiceExternalIPsConfig? = nil

  /// GatewayAPIConfig contains the desired config of Gateway API on this
  /// cluster.
  public var gatewayApiConfig: GatewayAPIConfig? = nil

  /// Whether multi-networking is enabled for this cluster.
  public var enableMultiNetworking: Swift.Bool = Swift.Bool()

  /// Network bandwidth tier configuration.
  public var networkPerformanceConfig: NetworkConfig.ClusterNetworkPerformanceConfig? = nil

  /// Whether FQDN Network Policy is enabled on this cluster.
  public var enableFqdnNetworkPolicy: Swift.Bool? = nil

  /// Specify the details of in-transit encryption.
  /// Now named inter-node transparent encryption.
  public var inTransitEncryptionConfig: InTransitEncryptionConfig? = nil

  /// Whether CiliumClusterwideNetworkPolicy is enabled on this cluster.
  public var enableCiliumClusterwideNetworkPolicy: Swift.Bool? = nil

  /// Controls whether by default nodes have private IP addresses only.
  /// It is invalid to specify both [PrivateClusterConfig.enablePrivateNodes][]
  /// and this field at the same time.
  /// To update the default setting, use
  /// [ClusterUpdate.desired_default_enable_private_nodes][google.container.v1.ClusterUpdate.desired_default_enable_private_nodes]
  public var defaultEnablePrivateNodes: Swift.Bool? = nil

  /// Optional. DataplaneV2Config specifies the DPv2 configuration.
  public var dataplaneV2Config: DataplaneV2Config? = nil

  /// Disable L4 load balancer VPC firewalls to enable firewall policies.
  public var disableL4LbFirewallReconciliation: Swift.Bool? = nil

  /// Initialize a new instance of `NetworkConfig`.
  public init() {}

  /// Use `config` to return a new instance of this object, with some fields updated.
  ///
  /// Commonly used to initialize the value, for example:
  ///
  /// ```
  /// let value = NetworkConfig().with { $0.network = ... }
  /// ```
  public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
    var copy = self
    try config(&copy)
    return copy
  }

  private enum CodingKeys: Swift.String, CodingKey {
    case network = "network"
    case subnetwork = "subnetwork"
    case enableIntraNodeVisibility = "enableIntraNodeVisibility"
    case defaultSnatStatus = "defaultSnatStatus"
    case enableL4IlbSubsetting = "enableL4ilbSubsetting"
    case datapathProvider = "datapathProvider"
    case privateIpv6GoogleAccess = "privateIpv6GoogleAccess"
    case dnsConfig = "dnsConfig"
    case serviceExternalIpsConfig = "serviceExternalIpsConfig"
    case gatewayApiConfig = "gatewayApiConfig"
    case enableMultiNetworking = "enableMultiNetworking"
    case networkPerformanceConfig = "networkPerformanceConfig"
    case enableFqdnNetworkPolicy = "enableFqdnNetworkPolicy"
    case inTransitEncryptionConfig = "inTransitEncryptionConfig"
    case enableCiliumClusterwideNetworkPolicy = "enableCiliumClusterwideNetworkPolicy"
    case defaultEnablePrivateNodes = "defaultEnablePrivateNodes"
    case dataplaneV2Config = "dataplaneV2Config"
    case disableL4LbFirewallReconciliation = "disableL4LbFirewallReconciliation"
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
    self.network = try container.decode(Swift.String.self, forKey: .network)
    self.subnetwork = try container.decode(Swift.String.self, forKey: .subnetwork)
    self.enableIntraNodeVisibility = try container.decode(
      Swift.Bool.self, forKey: .enableIntraNodeVisibility)
    self.defaultSnatStatus = try container.decodeIfPresent(
      DefaultSnatStatus.self, forKey: .defaultSnatStatus)
    self.enableL4IlbSubsetting = try container.decode(
      Swift.Bool.self, forKey: .enableL4IlbSubsetting)
    self.datapathProvider = try container.decode(DatapathProvider.self, forKey: .datapathProvider)
    self.privateIpv6GoogleAccess = try container.decode(
      PrivateIPv6GoogleAccess.self, forKey: .privateIpv6GoogleAccess)
    self.dnsConfig = try container.decodeIfPresent(DNSConfig.self, forKey: .dnsConfig)
    self.serviceExternalIpsConfig = try container.decodeIfPresent(
      ServiceExternalIPsConfig.self, forKey: .serviceExternalIpsConfig)
    self.gatewayApiConfig = try container.decodeIfPresent(
      GatewayAPIConfig.self, forKey: .gatewayApiConfig)
    self.enableMultiNetworking = try container.decode(
      Swift.Bool.self, forKey: .enableMultiNetworking)
    self.networkPerformanceConfig = try container.decodeIfPresent(
      NetworkConfig.ClusterNetworkPerformanceConfig.self, forKey: .networkPerformanceConfig)
    self.enableFqdnNetworkPolicy = try container.decodeIfPresent(
      Swift.Bool.self, forKey: .enableFqdnNetworkPolicy)
    self.inTransitEncryptionConfig = try container.decodeIfPresent(
      InTransitEncryptionConfig.self, forKey: .inTransitEncryptionConfig)
    self.enableCiliumClusterwideNetworkPolicy = try container.decodeIfPresent(
      Swift.Bool.self, forKey: .enableCiliumClusterwideNetworkPolicy)
    self.defaultEnablePrivateNodes = try container.decodeIfPresent(
      Swift.Bool.self, forKey: .defaultEnablePrivateNodes)
    self.dataplaneV2Config = try container.decodeIfPresent(
      DataplaneV2Config.self, forKey: .dataplaneV2Config)
    self.disableL4LbFirewallReconciliation = try container.decodeIfPresent(
      Swift.Bool.self, forKey: .disableL4LbFirewallReconciliation)
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.network, forKey: .network)
    try container.encode(self.subnetwork, forKey: .subnetwork)
    try container.encode(self.enableIntraNodeVisibility, forKey: .enableIntraNodeVisibility)
    try container.encode(self.defaultSnatStatus, forKey: .defaultSnatStatus)
    try container.encode(self.enableL4IlbSubsetting, forKey: .enableL4IlbSubsetting)
    try container.encode(self.datapathProvider, forKey: .datapathProvider)
    try container.encode(self.privateIpv6GoogleAccess, forKey: .privateIpv6GoogleAccess)
    try container.encode(self.dnsConfig, forKey: .dnsConfig)
    try container.encode(self.serviceExternalIpsConfig, forKey: .serviceExternalIpsConfig)
    try container.encode(self.gatewayApiConfig, forKey: .gatewayApiConfig)
    try container.encode(self.enableMultiNetworking, forKey: .enableMultiNetworking)
    try container.encode(self.networkPerformanceConfig, forKey: .networkPerformanceConfig)
    try container.encode(self.enableFqdnNetworkPolicy, forKey: .enableFqdnNetworkPolicy)
    try container.encode(self.inTransitEncryptionConfig, forKey: .inTransitEncryptionConfig)
    try container.encode(
      self.enableCiliumClusterwideNetworkPolicy, forKey: .enableCiliumClusterwideNetworkPolicy)
    try container.encode(self.defaultEnablePrivateNodes, forKey: .defaultEnablePrivateNodes)
    try container.encode(self.dataplaneV2Config, forKey: .dataplaneV2Config)
    try container.encode(
      self.disableL4LbFirewallReconciliation, forKey: .disableL4LbFirewallReconciliation)
  }

  /// Configuration of network bandwidth tiers
  public struct ClusterNetworkPerformanceConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Specifies the total network bandwidth tier for NodePools in the cluster.
    public var totalEgressBandwidthTier: NetworkConfig.ClusterNetworkPerformanceConfig.Tier? = nil

    /// Initialize a new instance of `ClusterNetworkPerformanceConfig`.
    public init() {}

    /// Use `config` to return a new instance of this object, with some fields updated.
    ///
    /// Commonly used to initialize the value, for example:
    ///
    /// ```
    /// let value = ClusterNetworkPerformanceConfig().with { $0.totalEgressBandwidthTier = ... }
    /// ```
    public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
      var copy = self
      try config(&copy)
      return copy
    }

    /// Node network tier
    public enum Tier: Codable, Equatable, Sendable {
      /// Default value
      case unspecified
      /// Higher bandwidth, actual values based on VM size.
      case tier1
      /// Encodes an unknown integer value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownIntValue(Int)
      /// Encodes an unknown string value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownStringValue(String)

      public init() {
        self = .unspecified
      }

      /// Returns the integer value associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown string value, this returns `nil`.
      public var intValue: Int? {
        switch self {
        case .unspecified: return 0
        case .tier1: return 1
        case .unknownIntValue(let v): return v
        case .unknownStringValue: return nil
        }
      }

      /// Returns the string value (or name) associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
      public var stringValue: Swift.String? {
        switch self {
        case .unspecified: return "TIER_UNSPECIFIED"
        case .tier1: return "TIER_1"
        case .unknownIntValue: return nil
        case .unknownStringValue(let v): return v
        }
      }

      /// Initialize from a string value.
      ///
      /// If the value is unknown, this initializes to [`unknownStringValue`](doc:Tier/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "TIER_UNSPECIFIED": self = .unspecified
        case "TIER_1": self = .tier1
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:Tier/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .unspecified
        case 1: self = .tier1
        default: self = .unknownIntValue(intValue)
        }
      }

      public init(from decoder: Decoder) throws {
        let container = try decoder.singleValueContainer()
        if let v = try? container.decode(Int.self) {
          self.init(intValue: v)
          return
        }
        if let s = try? container.decode(String.self) {
          if let v = Int(s) {
            self.init(intValue: v)
          } else {
            self.init(stringValue: s)
          }
          return
        }
        throw DecodingError.dataCorruptedError(
          in: container, debugDescription: "Expected enum value, must be integer or string.")
      }

      public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()
        switch self {
        case .unspecified: return try container.encode(0)
        case .tier1: return try container.encode(1)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    public static var _anyTypeUrl: Swift.String {
      return "type.googleapis.com/google.container.v1.NetworkConfig.ClusterNetworkPerformanceConfig"
    }
    public init(fromAny any: GoogleCloudWkt.`Any`) throws {
      self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
    }
    public func _pack() throws -> GoogleCloudWkt.Struct {
      return try GoogleCloudWkt._slowAnySerialize(message: self)
    }
  }

  public static var _anyTypeUrl: Swift.String {
    return "type.googleapis.com/google.container.v1.NetworkConfig"
  }
  public init(fromAny any: GoogleCloudWkt.`Any`) throws {
    self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
  }
  public func _pack() throws -> GoogleCloudWkt.Struct {
    return try GoogleCloudWkt._slowAnySerialize(message: self)
  }
}
