blob: 1af4ab5cdbf46c49ca0c74c90b96b8e2c3b08ecb [file] [log] [blame]
//
// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the protocol buffer compiler.
// Source: org/apache/beam/model/pipeline/v1/beam_runner_api.proto
//
//
// Copyright 2018, gRPC Authors All rights reserved.
//
// 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.
//
import GRPC
import NIO
import NIOConcurrencyHelpers
import SwiftProtobuf
/// Usage: instantiate `Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClient`, then call methods of this protocol to make API calls.
internal protocol Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientProtocol: GRPCClient {
var serviceName: String { get }
var interceptors: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientInterceptorFactoryProtocol? { get }
func events(
_ request: Org_Apache_Beam_Model_Pipeline_V1_EventsRequest,
callOptions: CallOptions?,
handler: @escaping (Org_Apache_Beam_Model_Pipeline_V1_TestStreamPayload.Event) -> Void
) -> ServerStreamingCall<Org_Apache_Beam_Model_Pipeline_V1_EventsRequest, Org_Apache_Beam_Model_Pipeline_V1_TestStreamPayload.Event>
}
extension Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientProtocol {
internal var serviceName: String {
return "org.apache.beam.model.pipeline.v1.TestStreamService"
}
/// A TestStream will request for events using this RPC.
///
/// - Parameters:
/// - request: Request to send to Events.
/// - callOptions: Call options.
/// - handler: A closure called when each response is received from the server.
/// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
internal func events(
_ request: Org_Apache_Beam_Model_Pipeline_V1_EventsRequest,
callOptions: CallOptions? = nil,
handler: @escaping (Org_Apache_Beam_Model_Pipeline_V1_TestStreamPayload.Event) -> Void
) -> ServerStreamingCall<Org_Apache_Beam_Model_Pipeline_V1_EventsRequest, Org_Apache_Beam_Model_Pipeline_V1_TestStreamPayload.Event> {
return self.makeServerStreamingCall(
path: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientMetadata.Methods.events.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeEventsInterceptors() ?? [],
handler: handler
)
}
}
@available(*, deprecated)
extension Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClient: @unchecked Sendable {}
@available(*, deprecated, renamed: "Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceNIOClient")
internal final class Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClient: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientProtocol {
private let lock = Lock()
private var _defaultCallOptions: CallOptions
private var _interceptors: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientInterceptorFactoryProtocol?
internal let channel: GRPCChannel
internal var defaultCallOptions: CallOptions {
get { self.lock.withLock { return self._defaultCallOptions } }
set { self.lock.withLockVoid { self._defaultCallOptions = newValue } }
}
internal var interceptors: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientInterceptorFactoryProtocol? {
get { self.lock.withLock { return self._interceptors } }
set { self.lock.withLockVoid { self._interceptors = newValue } }
}
/// Creates a client for the org.apache.beam.model.pipeline.v1.TestStreamService service.
///
/// - Parameters:
/// - channel: `GRPCChannel` to the service host.
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
/// - interceptors: A factory providing interceptors for each RPC.
internal init(
channel: GRPCChannel,
defaultCallOptions: CallOptions = CallOptions(),
interceptors: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientInterceptorFactoryProtocol? = nil
) {
self.channel = channel
self._defaultCallOptions = defaultCallOptions
self._interceptors = interceptors
}
}
internal struct Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceNIOClient: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientProtocol {
internal var channel: GRPCChannel
internal var defaultCallOptions: CallOptions
internal var interceptors: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientInterceptorFactoryProtocol?
/// Creates a client for the org.apache.beam.model.pipeline.v1.TestStreamService service.
///
/// - Parameters:
/// - channel: `GRPCChannel` to the service host.
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
/// - interceptors: A factory providing interceptors for each RPC.
internal init(
channel: GRPCChannel,
defaultCallOptions: CallOptions = CallOptions(),
interceptors: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientInterceptorFactoryProtocol? = nil
) {
self.channel = channel
self.defaultCallOptions = defaultCallOptions
self.interceptors = interceptors
}
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
internal protocol Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceAsyncClientProtocol: GRPCClient {
static var serviceDescriptor: GRPCServiceDescriptor { get }
var interceptors: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientInterceptorFactoryProtocol? { get }
func makeEventsCall(
_ request: Org_Apache_Beam_Model_Pipeline_V1_EventsRequest,
callOptions: CallOptions?
) -> GRPCAsyncServerStreamingCall<Org_Apache_Beam_Model_Pipeline_V1_EventsRequest, Org_Apache_Beam_Model_Pipeline_V1_TestStreamPayload.Event>
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceAsyncClientProtocol {
internal static var serviceDescriptor: GRPCServiceDescriptor {
return Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientMetadata.serviceDescriptor
}
internal var interceptors: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientInterceptorFactoryProtocol? {
return nil
}
internal func makeEventsCall(
_ request: Org_Apache_Beam_Model_Pipeline_V1_EventsRequest,
callOptions: CallOptions? = nil
) -> GRPCAsyncServerStreamingCall<Org_Apache_Beam_Model_Pipeline_V1_EventsRequest, Org_Apache_Beam_Model_Pipeline_V1_TestStreamPayload.Event> {
return self.makeAsyncServerStreamingCall(
path: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientMetadata.Methods.events.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeEventsInterceptors() ?? []
)
}
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceAsyncClientProtocol {
internal func events(
_ request: Org_Apache_Beam_Model_Pipeline_V1_EventsRequest,
callOptions: CallOptions? = nil
) -> GRPCAsyncResponseStream<Org_Apache_Beam_Model_Pipeline_V1_TestStreamPayload.Event> {
return self.performAsyncServerStreamingCall(
path: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientMetadata.Methods.events.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeEventsInterceptors() ?? []
)
}
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
internal struct Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceAsyncClient: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceAsyncClientProtocol {
internal var channel: GRPCChannel
internal var defaultCallOptions: CallOptions
internal var interceptors: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientInterceptorFactoryProtocol?
internal init(
channel: GRPCChannel,
defaultCallOptions: CallOptions = CallOptions(),
interceptors: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientInterceptorFactoryProtocol? = nil
) {
self.channel = channel
self.defaultCallOptions = defaultCallOptions
self.interceptors = interceptors
}
}
internal protocol Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientInterceptorFactoryProtocol: Sendable {
/// - Returns: Interceptors to use when invoking 'events'.
func makeEventsInterceptors() -> [ClientInterceptor<Org_Apache_Beam_Model_Pipeline_V1_EventsRequest, Org_Apache_Beam_Model_Pipeline_V1_TestStreamPayload.Event>]
}
internal enum Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientMetadata {
internal static let serviceDescriptor = GRPCServiceDescriptor(
name: "TestStreamService",
fullName: "org.apache.beam.model.pipeline.v1.TestStreamService",
methods: [
Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceClientMetadata.Methods.events,
]
)
internal enum Methods {
internal static let events = GRPCMethodDescriptor(
name: "Events",
path: "/org.apache.beam.model.pipeline.v1.TestStreamService/Events",
type: GRPCCallType.serverStreaming
)
}
}
/// To build a server, implement a class that conforms to this protocol.
internal protocol Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceProvider: CallHandlerProvider {
var interceptors: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceServerInterceptorFactoryProtocol? { get }
/// A TestStream will request for events using this RPC.
func events(request: Org_Apache_Beam_Model_Pipeline_V1_EventsRequest, context: StreamingResponseCallContext<Org_Apache_Beam_Model_Pipeline_V1_TestStreamPayload.Event>) -> EventLoopFuture<GRPCStatus>
}
extension Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceProvider {
internal var serviceName: Substring {
return Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceServerMetadata.serviceDescriptor.fullName[...]
}
/// Determines, calls and returns the appropriate request handler, depending on the request's method.
/// Returns nil for methods not handled by this service.
internal func handle(
method name: Substring,
context: CallHandlerContext
) -> GRPCServerHandlerProtocol? {
switch name {
case "Events":
return ServerStreamingServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Org_Apache_Beam_Model_Pipeline_V1_EventsRequest>(),
responseSerializer: ProtobufSerializer<Org_Apache_Beam_Model_Pipeline_V1_TestStreamPayload.Event>(),
interceptors: self.interceptors?.makeEventsInterceptors() ?? [],
userFunction: self.events(request:context:)
)
default:
return nil
}
}
}
/// To implement a server, implement an object which conforms to this protocol.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
internal protocol Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceAsyncProvider: CallHandlerProvider, Sendable {
static var serviceDescriptor: GRPCServiceDescriptor { get }
var interceptors: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceServerInterceptorFactoryProtocol? { get }
/// A TestStream will request for events using this RPC.
func events(
request: Org_Apache_Beam_Model_Pipeline_V1_EventsRequest,
responseStream: GRPCAsyncResponseStreamWriter<Org_Apache_Beam_Model_Pipeline_V1_TestStreamPayload.Event>,
context: GRPCAsyncServerCallContext
) async throws
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceAsyncProvider {
internal static var serviceDescriptor: GRPCServiceDescriptor {
return Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceServerMetadata.serviceDescriptor
}
internal var serviceName: Substring {
return Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceServerMetadata.serviceDescriptor.fullName[...]
}
internal var interceptors: Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceServerInterceptorFactoryProtocol? {
return nil
}
internal func handle(
method name: Substring,
context: CallHandlerContext
) -> GRPCServerHandlerProtocol? {
switch name {
case "Events":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Org_Apache_Beam_Model_Pipeline_V1_EventsRequest>(),
responseSerializer: ProtobufSerializer<Org_Apache_Beam_Model_Pipeline_V1_TestStreamPayload.Event>(),
interceptors: self.interceptors?.makeEventsInterceptors() ?? [],
wrapping: { try await self.events(request: $0, responseStream: $1, context: $2) }
)
default:
return nil
}
}
}
internal protocol Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceServerInterceptorFactoryProtocol: Sendable {
/// - Returns: Interceptors to use when handling 'events'.
/// Defaults to calling `self.makeInterceptors()`.
func makeEventsInterceptors() -> [ServerInterceptor<Org_Apache_Beam_Model_Pipeline_V1_EventsRequest, Org_Apache_Beam_Model_Pipeline_V1_TestStreamPayload.Event>]
}
internal enum Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceServerMetadata {
internal static let serviceDescriptor = GRPCServiceDescriptor(
name: "TestStreamService",
fullName: "org.apache.beam.model.pipeline.v1.TestStreamService",
methods: [
Org_Apache_Beam_Model_Pipeline_V1_TestStreamServiceServerMetadata.Methods.events,
]
)
internal enum Methods {
internal static let events = GRPCMethodDescriptor(
name: "Events",
path: "/org.apache.beam.model.pipeline.v1.TestStreamService/Events",
type: GRPCCallType.serverStreaming
)
}
}