// 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.

#if InterconnectAttachments
  import Foundation
  import GoogleCloudWkt

  /// L2 Interconnect Attachment related configuration.
  public struct InterconnectAttachmentL2Forwarding: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Optional. A map of VLAN tags to appliances and optional inner mapping
    /// rules. If VLANs are not explicitly mapped to any appliance, the
    /// defaultApplianceIpAddress is used.
    ///
    /// Each VLAN tag can be a single number or a range of numbers in the range
    /// of 1 to 4094, e.g., "1" or "4001-4094". Non-empty and non-overlapping
    /// VLAN tag ranges are enforced, and violating operations will be rejected.
    ///
    /// The VLAN tags in the Ethernet header must use an ethertype value of
    /// 0x88A8 or 0x8100.
    public var applianceMappings:
      [Swift.String: InterconnectAttachmentL2ForwardingApplianceMapping] = [:]

    /// Optional. A single IPv4 or IPv6 address used as the default destination
    /// IP when there is no VLAN mapping result found.
    ///
    /// Unset field (null-value) indicates the unmatched packet should be
    /// dropped.
    public var defaultApplianceIpAddress: Swift.String? = nil

    /// Optional. It represents the structure of a Geneve (Generic Network
    /// Virtualization Encapsulation) header, as defined in RFC8926. It encapsulates packets from various
    /// protocols (e.g., Ethernet, IPv4, IPv6) for use in network virtualization
    /// environments.
    public var geneveHeader: InterconnectAttachmentL2ForwardingGeneveHeader? = nil

    /// Required. Resource URL of the network to which this attachment belongs.
    public var network: Swift.String? = nil

    /// Required. A single IPv4 or IPv6 address. This address will be used as the
    /// source IP address for packets sent to the appliances, and must be used as
    /// the destination IP address for packets that should be sent out through
    /// this attachment.
    public var tunnelEndpointIpAddress: Swift.String? = nil

    /// Initialize a new instance of `InterconnectAttachmentL2Forwarding`.
    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 = InterconnectAttachmentL2Forwarding().with { $0.applianceMappings = ... }
    /// ```
    public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
      var copy = self
      try config(&copy)
      return copy
    }

    public static var _anyTypeUrl: Swift.String {
      return "type.googleapis.com/google.cloud.compute.v1.InterconnectAttachmentL2Forwarding"
    }
    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)
    }
  }
#endif
