// 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 GlobalNetworkEndpointGroups || NetworkEndpointGroups || RegionNetworkEndpointGroups
  import Foundation
  import GoogleCloudWkt

  /// Configuration for a Cloud Run network endpoint group (NEG).
  /// The service must be provided explicitly or in the URL mask.
  /// The tag is optional, may be provided explicitly or in the URL
  /// mask.
  ///
  /// Note: Cloud Run service must be in the same project and located in the same
  /// region as the Serverless NEG.
  public struct NetworkEndpointGroupCloudRun: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Cloud Run service is the main resource of Cloud Run.
    ///
    /// The service must be 1-63 characters long, and comply withRFC1035.
    ///
    /// Example value: "run-service".
    public var service: Swift.String? = nil

    /// Optional Cloud Run tag represents the "named-revision" to provide additional
    /// fine-grained traffic routing information.
    ///
    /// The tag must be 1-63 characters long, and comply withRFC1035.
    ///
    /// Example value: "revision-0010".
    public var tag: Swift.String? = nil

    /// An URL
    /// mask is one of the main components of the Cloud Function.
    ///
    /// A template to parse <service> and<tag> fields from a request URL. URL mask allows for
    /// routing to multiple Run services without having to create multiple
    /// network endpoint groups and backend services.
    ///
    /// For example, request URLs foo1.domain.com/bar1 andfoo1.domain.com/bar2 can be backed by the same Serverless
    /// Network Endpoint Group (NEG) with URL mask<tag>.domain.com/<service>. The URL mask will
    /// parse them to { service="bar1", tag="foo1" } and {
    /// service="bar2", tag="foo2" } respectively.
    public var urlMask: Swift.String? = nil

    /// Initialize a new instance of `NetworkEndpointGroupCloudRun`.
    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 = NetworkEndpointGroupCloudRun().with { $0.service = ... }
    /// ```
    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.NetworkEndpointGroupCloudRun"
    }
    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
