//===----------------------------------------------------------------------===// // Copyright © 2025-2026 Apple Inc. and the container project authors. // // 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. //===----------------------------------------------------------------------===// // DO NOT EDIT. // swift-format-ignore-file // swiftlint:disable all // // Generated by the gRPC Swift generator plugin for the protocol buffer compiler. // Source: Builder.proto // // For information on using the generated types, please see the documentation: // https://github.com/grpc/grpc-swift import GRPCCore import GRPCProtobuf // MARK: - com.apple.container.build.v1.Builder /// Namespace containing generated types for the "com.apple.container.build.v1.Builder" service. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) public enum Com_Apple_Container_Build_V1_Builder: Sendable { /// Service descriptor for the "com.apple.container.build.v1.Builder" service. public static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "com.apple.container.build.v1.Builder") /// Namespace for method metadata. public enum Method: Sendable { /// Namespace for "CreateBuild" metadata. public enum CreateBuild: Sendable { /// Request type for "CreateBuild". public typealias Input = Com_Apple_Container_Build_V1_CreateBuildRequest /// Response type for "CreateBuild". public typealias Output = Com_Apple_Container_Build_V1_CreateBuildResponse /// Descriptor for "CreateBuild". public static let descriptor = GRPCCore.MethodDescriptor( service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "com.apple.container.build.v1.Builder"), method: "CreateBuild", type: .unary ) } /// Namespace for "PerformBuild" metadata. public enum PerformBuild: Sendable { /// Request type for "PerformBuild". public typealias Input = Com_Apple_Container_Build_V1_ClientStream /// Response type for "PerformBuild". public typealias Output = Com_Apple_Container_Build_V1_ServerStream /// Descriptor for "PerformBuild". public static let descriptor = GRPCCore.MethodDescriptor( service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "com.apple.container.build.v1.Builder"), method: "PerformBuild", type: .bidirectionalStreaming ) } /// Namespace for "Info" metadata. public enum Info: Sendable { /// Request type for "Info". public typealias Input = Com_Apple_Container_Build_V1_InfoRequest /// Response type for "Info". public typealias Output = Com_Apple_Container_Build_V1_InfoResponse /// Descriptor for "Info". public static let descriptor = GRPCCore.MethodDescriptor( service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "com.apple.container.build.v1.Builder"), method: "Info", type: .unary ) } /// Descriptors for all methods in the "com.apple.container.build.v1.Builder" service. public static let descriptors: [GRPCCore.MethodDescriptor] = [ CreateBuild.descriptor, PerformBuild.descriptor, Info.descriptor ] } } @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension GRPCCore.ServiceDescriptor { /// Service descriptor for the "com.apple.container.build.v1.Builder" service. public static let com_apple_container_build_v1_Builder = GRPCCore.ServiceDescriptor(fullyQualifiedService: "com.apple.container.build.v1.Builder") } // MARK: com.apple.container.build.v1.Builder (server) @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Com_Apple_Container_Build_V1_Builder { /// Streaming variant of the service protocol for the "com.apple.container.build.v1.Builder" service. /// /// This protocol is the lowest-level of the service protocols generated for this service /// giving you the most flexibility over the implementation of your service. This comes at /// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in /// terms of a request stream and response stream. Where only a single request or response /// message is expected, you are responsible for enforcing this invariant is maintained. /// /// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol`` /// or ``SimpleServiceProtocol`` instead. /// /// > Source IDL Documentation: /// > /// > Builder service implements APIs for performing an image build with /// > Container image builder agent. /// > /// > To perform a build: /// > /// > 1. CreateBuild to create a new build /// > 2. StartBuild to start the build execution where client and server /// > both have a stream for exchanging data during the build. /// > /// > The client may send: /// > a) signal packet to signal to the build process (e.g. SIGINT) /// > /// > b) command packet for executing a command in the build file on the /// > server /// > NOTE: the server will need to switch on the command to determine the /// > type of command to execute (e.g. RUN, ENV, etc.) /// > /// > c) transfer build data either to or from the server /// > - INTO direction is for sending build data to the server at specific /// > location (e.g. COPY) /// > - OUTOF direction is for copying build data from the server to be /// > used in subsequent build stages /// > /// > d) transfer image content data either to or from the server /// > - INTO direction is for sending inherited image content data to the /// > server's local content store /// > - OUTOF direction is for copying successfully built OCI image from /// > the server to the client /// > /// > The server may send: /// > a) stdio packet for the build progress /// > /// > b) build error indicating unsuccessful build /// > /// > c) command complete packet indicating a command has finished executing /// > /// > d) handle transfer build data either to or from the client /// > /// > e) handle transfer image content data either to or from the client /// > /// > /// > NOTE: The build data and image content data transfer is ALWAYS initiated /// > by the client. /// > /// > Sequence for transferring from the client to the server: /// > 1. client send a BuildTransfer/ImageTransfer request with ID, direction /// > of 'INTO', /// > destination path, and first chunk of data /// > 2. server starts to receive the data and stream to a temporary file /// > 3. client continues to send all chunks of data until last chunk, which /// > client will /// > send with 'complete' set to true /// > 4. server continues to receive until the last chunk with 'complete' set /// > to true, /// > server will finish writing the last chunk and un-archive the /// > temporary file to the destination path /// > 5. server completes the transfer by sending a last /// > BuildTransfer/ImageTransfer with /// > 'complete' set to true /// > 6. client waits for the last BuildTransfer/ImageTransfer with 'complete' /// > set to true /// > before proceeding with the rest of the commands /// > /// > Sequence for transferring from the server to the client: /// > 1. client send a BuildTransfer/ImageTransfer request with ID, direction /// > of 'OUTOF', /// > source path, and empty data /// > 2. server archives the data at source path, and starts to send chunks to /// > the client /// > 3. server continues to send all chunks until last chunk, which server /// > will send with /// > 'complete' set to true /// > 4. client starts to receive the data and stream to a temporary file /// > 5. client continues to receive until the last chunk with 'complete' set /// > to true, /// > client will finish writing last chunk and un-archive the temporary /// > file to the destination path /// > 6. client MAY choose to send one last BuildTransfer/ImageTransfer with /// > 'complete' /// > set to true, but NOT required. /// > /// > /// > NOTE: the client should close the send stream once it has finished /// > receiving the build output or abandon the current build due to error. /// > Server should keep the stream open until it receives the EOF that client /// > has closed the stream, which the server should then close its send stream. public protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService { /// Handle the "CreateBuild" method. /// /// > Source IDL Documentation: /// > /// > Create a build request. /// /// - Parameters: /// - request: A streaming request of `Com_Apple_Container_Build_V1_CreateBuildRequest` messages. /// - context: Context providing information about the RPC. /// - Throws: Any error which occurred during the processing of the request. Thrown errors /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted /// to an internal error. /// - Returns: A streaming response of `Com_Apple_Container_Build_V1_CreateBuildResponse` messages. func createBuild( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse /// Handle the "PerformBuild" method. /// /// > Source IDL Documentation: /// > /// > Perform the build. /// > Executes the entire build sequence with attaching input/output /// > to handling data exchange with the server during the build. /// /// - Parameters: /// - request: A streaming request of `Com_Apple_Container_Build_V1_ClientStream` messages. /// - context: Context providing information about the RPC. /// - Throws: Any error which occurred during the processing of the request. Thrown errors /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted /// to an internal error. /// - Returns: A streaming response of `Com_Apple_Container_Build_V1_ServerStream` messages. func performBuild( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse /// Handle the "Info" method. /// /// - Parameters: /// - request: A streaming request of `Com_Apple_Container_Build_V1_InfoRequest` messages. /// - context: Context providing information about the RPC. /// - Throws: Any error which occurred during the processing of the request. Thrown errors /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted /// to an internal error. /// - Returns: A streaming response of `Com_Apple_Container_Build_V1_InfoResponse` messages. func info( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse } /// Service protocol for the "com.apple.container.build.v1.Builder" service. /// /// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than /// the ``SimpleServiceProtocol``, it provides access to request and response metadata and /// trailing response metadata. If you don't need these then consider using /// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then /// use ``StreamingServiceProtocol``. /// /// > Source IDL Documentation: /// > /// > Builder service implements APIs for performing an image build with /// > Container image builder agent. /// > /// > To perform a build: /// > /// > 1. CreateBuild to create a new build /// > 2. StartBuild to start the build execution where client and server /// > both have a stream for exchanging data during the build. /// > /// > The client may send: /// > a) signal packet to signal to the build process (e.g. SIGINT) /// > /// > b) command packet for executing a command in the build file on the /// > server /// > NOTE: the server will need to switch on the command to determine the /// > type of command to execute (e.g. RUN, ENV, etc.) /// > /// > c) transfer build data either to or from the server /// > - INTO direction is for sending build data to the server at specific /// > location (e.g. COPY) /// > - OUTOF direction is for copying build data from the server to be /// > used in subsequent build stages /// > /// > d) transfer image content data either to or from the server /// > - INTO direction is for sending inherited image content data to the /// > server's local content store /// > - OUTOF direction is for copying successfully built OCI image from /// > the server to the client /// > /// > The server may send: /// > a) stdio packet for the build progress /// > /// > b) build error indicating unsuccessful build /// > /// > c) command complete packet indicating a command has finished executing /// > /// > d) handle transfer build data either to or from the client /// > /// > e) handle transfer image content data either to or from the client /// > /// > /// > NOTE: The build data and image content data transfer is ALWAYS initiated /// > by the client. /// > /// > Sequence for transferring from the client to the server: /// > 1. client send a BuildTransfer/ImageTransfer request with ID, direction /// > of 'INTO', /// > destination path, and first chunk of data /// > 2. server starts to receive the data and stream to a temporary file /// > 3. client continues to send all chunks of data until last chunk, which /// > client will /// > send with 'complete' set to true /// > 4. server continues to receive until the last chunk with 'complete' set /// > to true, /// > server will finish writing the last chunk and un-archive the /// > temporary file to the destination path /// > 5. server completes the transfer by sending a last /// > BuildTransfer/ImageTransfer with /// > 'complete' set to true /// > 6. client waits for the last BuildTransfer/ImageTransfer with 'complete' /// > set to true /// > before proceeding with the rest of the commands /// > /// > Sequence for transferring from the server to the client: /// > 1. client send a BuildTransfer/ImageTransfer request with ID, direction /// > of 'OUTOF', /// > source path, and empty data /// > 2. server archives the data at source path, and starts to send chunks to /// > the client /// > 3. server continues to send all chunks until last chunk, which server /// > will send with /// > 'complete' set to true /// > 4. client starts to receive the data and stream to a temporary file /// > 5. client continues to receive until the last chunk with 'complete' set /// > to true, /// > client will finish writing last chunk and un-archive the temporary /// > file to the destination path /// > 6. client MAY choose to send one last BuildTransfer/ImageTransfer with /// > 'complete' /// > set to true, but NOT required. /// > /// > /// > NOTE: the client should close the send stream once it has finished /// > receiving the build output or abandon the current build due to error. /// > Server should keep the stream open until it receives the EOF that client /// > has closed the stream, which the server should then close its send stream. public protocol ServiceProtocol: Com_Apple_Container_Build_V1_Builder.StreamingServiceProtocol { /// Handle the "CreateBuild" method. /// /// > Source IDL Documentation: /// > /// > Create a build request. /// /// - Parameters: /// - request: A request containing a single `Com_Apple_Container_Build_V1_CreateBuildRequest` message. /// - context: Context providing information about the RPC. /// - Throws: Any error which occurred during the processing of the request. Thrown errors /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted /// to an internal error. /// - Returns: A response containing a single `Com_Apple_Container_Build_V1_CreateBuildResponse` message. func createBuild( request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.ServerResponse /// Handle the "PerformBuild" method. /// /// > Source IDL Documentation: /// > /// > Perform the build. /// > Executes the entire build sequence with attaching input/output /// > to handling data exchange with the server during the build. /// /// - Parameters: /// - request: A streaming request of `Com_Apple_Container_Build_V1_ClientStream` messages. /// - context: Context providing information about the RPC. /// - Throws: Any error which occurred during the processing of the request. Thrown errors /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted /// to an internal error. /// - Returns: A streaming response of `Com_Apple_Container_Build_V1_ServerStream` messages. func performBuild( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse /// Handle the "Info" method. /// /// - Parameters: /// - request: A request containing a single `Com_Apple_Container_Build_V1_InfoRequest` message. /// - context: Context providing information about the RPC. /// - Throws: Any error which occurred during the processing of the request. Thrown errors /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted /// to an internal error. /// - Returns: A response containing a single `Com_Apple_Container_Build_V1_InfoResponse` message. func info( request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.ServerResponse } /// Simple service protocol for the "com.apple.container.build.v1.Builder" service. /// /// This is the highest level protocol for the service. The API is the easiest to use but /// doesn't provide access to request or response metadata. If you need access to these /// then use ``ServiceProtocol`` instead. /// /// > Source IDL Documentation: /// > /// > Builder service implements APIs for performing an image build with /// > Container image builder agent. /// > /// > To perform a build: /// > /// > 1. CreateBuild to create a new build /// > 2. StartBuild to start the build execution where client and server /// > both have a stream for exchanging data during the build. /// > /// > The client may send: /// > a) signal packet to signal to the build process (e.g. SIGINT) /// > /// > b) command packet for executing a command in the build file on the /// > server /// > NOTE: the server will need to switch on the command to determine the /// > type of command to execute (e.g. RUN, ENV, etc.) /// > /// > c) transfer build data either to or from the server /// > - INTO direction is for sending build data to the server at specific /// > location (e.g. COPY) /// > - OUTOF direction is for copying build data from the server to be /// > used in subsequent build stages /// > /// > d) transfer image content data either to or from the server /// > - INTO direction is for sending inherited image content data to the /// > server's local content store /// > - OUTOF direction is for copying successfully built OCI image from /// > the server to the client /// > /// > The server may send: /// > a) stdio packet for the build progress /// > /// > b) build error indicating unsuccessful build /// > /// > c) command complete packet indicating a command has finished executing /// > /// > d) handle transfer build data either to or from the client /// > /// > e) handle transfer image content data either to or from the client /// > /// > /// > NOTE: The build data and image content data transfer is ALWAYS initiated /// > by the client. /// > /// > Sequence for transferring from the client to the server: /// > 1. client send a BuildTransfer/ImageTransfer request with ID, direction /// > of 'INTO', /// > destination path, and first chunk of data /// > 2. server starts to receive the data and stream to a temporary file /// > 3. client continues to send all chunks of data until last chunk, which /// > client will /// > send with 'complete' set to true /// > 4. server continues to receive until the last chunk with 'complete' set /// > to true, /// > server will finish writing the last chunk and un-archive the /// > temporary file to the destination path /// > 5. server completes the transfer by sending a last /// > BuildTransfer/ImageTransfer with /// > 'complete' set to true /// > 6. client waits for the last BuildTransfer/ImageTransfer with 'complete' /// > set to true /// > before proceeding with the rest of the commands /// > /// > Sequence for transferring from the server to the client: /// > 1. client send a BuildTransfer/ImageTransfer request with ID, direction /// > of 'OUTOF', /// > source path, and empty data /// > 2. server archives the data at source path, and starts to send chunks to /// > the client /// > 3. server continues to send all chunks until last chunk, which server /// > will send with /// > 'complete' set to true /// > 4. client starts to receive the data and stream to a temporary file /// > 5. client continues to receive until the last chunk with 'complete' set /// > to true, /// > client will finish writing last chunk and un-archive the temporary /// > file to the destination path /// > 6. client MAY choose to send one last BuildTransfer/ImageTransfer with /// > 'complete' /// > set to true, but NOT required. /// > /// > /// > NOTE: the client should close the send stream once it has finished /// > receiving the build output or abandon the current build due to error. /// > Server should keep the stream open until it receives the EOF that client /// > has closed the stream, which the server should then close its send stream. public protocol SimpleServiceProtocol: Com_Apple_Container_Build_V1_Builder.ServiceProtocol { /// Handle the "CreateBuild" method. /// /// > Source IDL Documentation: /// > /// > Create a build request. /// /// - Parameters: /// - request: A `Com_Apple_Container_Build_V1_CreateBuildRequest` message. /// - context: Context providing information about the RPC. /// - Throws: Any error which occurred during the processing of the request. Thrown errors /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted /// to an internal error. /// - Returns: A `Com_Apple_Container_Build_V1_CreateBuildResponse` to respond with. func createBuild( request: Com_Apple_Container_Build_V1_CreateBuildRequest, context: GRPCCore.ServerContext ) async throws -> Com_Apple_Container_Build_V1_CreateBuildResponse /// Handle the "PerformBuild" method. /// /// > Source IDL Documentation: /// > /// > Perform the build. /// > Executes the entire build sequence with attaching input/output /// > to handling data exchange with the server during the build. /// /// - Parameters: /// - request: A stream of `Com_Apple_Container_Build_V1_ClientStream` messages. /// - response: A response stream of `Com_Apple_Container_Build_V1_ServerStream` messages. /// - context: Context providing information about the RPC. /// - Throws: Any error which occurred during the processing of the request. Thrown errors /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted /// to an internal error. func performBuild( request: GRPCCore.RPCAsyncSequence, response: GRPCCore.RPCWriter, context: GRPCCore.ServerContext ) async throws /// Handle the "Info" method. /// /// - Parameters: /// - request: A `Com_Apple_Container_Build_V1_InfoRequest` message. /// - context: Context providing information about the RPC. /// - Throws: Any error which occurred during the processing of the request. Thrown errors /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted /// to an internal error. /// - Returns: A `Com_Apple_Container_Build_V1_InfoResponse` to respond with. func info( request: Com_Apple_Container_Build_V1_InfoRequest, context: GRPCCore.ServerContext ) async throws -> Com_Apple_Container_Build_V1_InfoResponse } } // Default implementation of 'registerMethods(with:)'. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Com_Apple_Container_Build_V1_Builder.StreamingServiceProtocol { public func registerMethods(with router: inout GRPCCore.RPCRouter) where Transport: GRPCCore.ServerTransport { router.registerHandler( forMethod: Com_Apple_Container_Build_V1_Builder.Method.CreateBuild.descriptor, deserializer: GRPCProtobuf.ProtobufDeserializer(), serializer: GRPCProtobuf.ProtobufSerializer(), handler: { request, context in try await self.createBuild( request: request, context: context ) } ) router.registerHandler( forMethod: Com_Apple_Container_Build_V1_Builder.Method.PerformBuild.descriptor, deserializer: GRPCProtobuf.ProtobufDeserializer(), serializer: GRPCProtobuf.ProtobufSerializer(), handler: { request, context in try await self.performBuild( request: request, context: context ) } ) router.registerHandler( forMethod: Com_Apple_Container_Build_V1_Builder.Method.Info.descriptor, deserializer: GRPCProtobuf.ProtobufDeserializer(), serializer: GRPCProtobuf.ProtobufSerializer(), handler: { request, context in try await self.info( request: request, context: context ) } ) } } // Default implementation of streaming methods from 'StreamingServiceProtocol'. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Com_Apple_Container_Build_V1_Builder.ServiceProtocol { public func createBuild( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.createBuild( request: GRPCCore.ServerRequest(stream: request), context: context ) return GRPCCore.StreamingServerResponse(single: response) } public func info( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.info( request: GRPCCore.ServerRequest(stream: request), context: context ) return GRPCCore.StreamingServerResponse(single: response) } } // Default implementation of methods from 'ServiceProtocol'. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Com_Apple_Container_Build_V1_Builder.SimpleServiceProtocol { public func createBuild( request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.ServerResponse { return GRPCCore.ServerResponse( message: try await self.createBuild( request: request.message, context: context ), metadata: [:] ) } public func performBuild( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse { return GRPCCore.StreamingServerResponse( metadata: [:], producer: { writer in try await self.performBuild( request: request.messages, response: writer, context: context ) return [:] } ) } public func info( request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.ServerResponse { return GRPCCore.ServerResponse( message: try await self.info( request: request.message, context: context ), metadata: [:] ) } } // MARK: com.apple.container.build.v1.Builder (client) @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Com_Apple_Container_Build_V1_Builder { /// Generated client protocol for the "com.apple.container.build.v1.Builder" service. /// /// You don't need to implement this protocol directly, use the generated /// implementation, ``Client``. /// /// > Source IDL Documentation: /// > /// > Builder service implements APIs for performing an image build with /// > Container image builder agent. /// > /// > To perform a build: /// > /// > 1. CreateBuild to create a new build /// > 2. StartBuild to start the build execution where client and server /// > both have a stream for exchanging data during the build. /// > /// > The client may send: /// > a) signal packet to signal to the build process (e.g. SIGINT) /// > /// > b) command packet for executing a command in the build file on the /// > server /// > NOTE: the server will need to switch on the command to determine the /// > type of command to execute (e.g. RUN, ENV, etc.) /// > /// > c) transfer build data either to or from the server /// > - INTO direction is for sending build data to the server at specific /// > location (e.g. COPY) /// > - OUTOF direction is for copying build data from the server to be /// > used in subsequent build stages /// > /// > d) transfer image content data either to or from the server /// > - INTO direction is for sending inherited image content data to the /// > server's local content store /// > - OUTOF direction is for copying successfully built OCI image from /// > the server to the client /// > /// > The server may send: /// > a) stdio packet for the build progress /// > /// > b) build error indicating unsuccessful build /// > /// > c) command complete packet indicating a command has finished executing /// > /// > d) handle transfer build data either to or from the client /// > /// > e) handle transfer image content data either to or from the client /// > /// > /// > NOTE: The build data and image content data transfer is ALWAYS initiated /// > by the client. /// > /// > Sequence for transferring from the client to the server: /// > 1. client send a BuildTransfer/ImageTransfer request with ID, direction /// > of 'INTO', /// > destination path, and first chunk of data /// > 2. server starts to receive the data and stream to a temporary file /// > 3. client continues to send all chunks of data until last chunk, which /// > client will /// > send with 'complete' set to true /// > 4. server continues to receive until the last chunk with 'complete' set /// > to true, /// > server will finish writing the last chunk and un-archive the /// > temporary file to the destination path /// > 5. server completes the transfer by sending a last /// > BuildTransfer/ImageTransfer with /// > 'complete' set to true /// > 6. client waits for the last BuildTransfer/ImageTransfer with 'complete' /// > set to true /// > before proceeding with the rest of the commands /// > /// > Sequence for transferring from the server to the client: /// > 1. client send a BuildTransfer/ImageTransfer request with ID, direction /// > of 'OUTOF', /// > source path, and empty data /// > 2. server archives the data at source path, and starts to send chunks to /// > the client /// > 3. server continues to send all chunks until last chunk, which server /// > will send with /// > 'complete' set to true /// > 4. client starts to receive the data and stream to a temporary file /// > 5. client continues to receive until the last chunk with 'complete' set /// > to true, /// > client will finish writing last chunk and un-archive the temporary /// > file to the destination path /// > 6. client MAY choose to send one last BuildTransfer/ImageTransfer with /// > 'complete' /// > set to true, but NOT required. /// > /// > /// > NOTE: the client should close the send stream once it has finished /// > receiving the build output or abandon the current build due to error. /// > Server should keep the stream open until it receives the EOF that client /// > has closed the stream, which the server should then close its send stream. public protocol ClientProtocol: Sendable { /// Call the "CreateBuild" method. /// /// > Source IDL Documentation: /// > /// > Create a build request. /// /// - Parameters: /// - request: A request containing a single `Com_Apple_Container_Build_V1_CreateBuildRequest` message. /// - serializer: A serializer for `Com_Apple_Container_Build_V1_CreateBuildRequest` messages. /// - deserializer: A deserializer for `Com_Apple_Container_Build_V1_CreateBuildResponse` messages. /// - options: Options to apply to this RPC. /// - handleResponse: A closure which handles the response, the result of which is /// returned to the caller. Returning from the closure will cancel the RPC if it /// hasn't already finished. /// - Returns: The result of `handleResponse`. func createBuild( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable /// Call the "PerformBuild" method. /// /// > Source IDL Documentation: /// > /// > Perform the build. /// > Executes the entire build sequence with attaching input/output /// > to handling data exchange with the server during the build. /// /// - Parameters: /// - request: A streaming request producing `Com_Apple_Container_Build_V1_ClientStream` messages. /// - serializer: A serializer for `Com_Apple_Container_Build_V1_ClientStream` messages. /// - deserializer: A deserializer for `Com_Apple_Container_Build_V1_ServerStream` messages. /// - options: Options to apply to this RPC. /// - handleResponse: A closure which handles the response, the result of which is /// returned to the caller. Returning from the closure will cancel the RPC if it /// hasn't already finished. /// - Returns: The result of `handleResponse`. func performBuild( request: GRPCCore.StreamingClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable /// Call the "Info" method. /// /// - Parameters: /// - request: A request containing a single `Com_Apple_Container_Build_V1_InfoRequest` message. /// - serializer: A serializer for `Com_Apple_Container_Build_V1_InfoRequest` messages. /// - deserializer: A deserializer for `Com_Apple_Container_Build_V1_InfoResponse` messages. /// - options: Options to apply to this RPC. /// - handleResponse: A closure which handles the response, the result of which is /// returned to the caller. Returning from the closure will cancel the RPC if it /// hasn't already finished. /// - Returns: The result of `handleResponse`. func info( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable } /// Generated client for the "com.apple.container.build.v1.Builder" service. /// /// The ``Client`` provides an implementation of ``ClientProtocol`` which wraps /// a `GRPCCore.GRPCCClient`. The underlying `GRPCClient` provides the long-lived /// means of communication with the remote peer. /// /// > Source IDL Documentation: /// > /// > Builder service implements APIs for performing an image build with /// > Container image builder agent. /// > /// > To perform a build: /// > /// > 1. CreateBuild to create a new build /// > 2. StartBuild to start the build execution where client and server /// > both have a stream for exchanging data during the build. /// > /// > The client may send: /// > a) signal packet to signal to the build process (e.g. SIGINT) /// > /// > b) command packet for executing a command in the build file on the /// > server /// > NOTE: the server will need to switch on the command to determine the /// > type of command to execute (e.g. RUN, ENV, etc.) /// > /// > c) transfer build data either to or from the server /// > - INTO direction is for sending build data to the server at specific /// > location (e.g. COPY) /// > - OUTOF direction is for copying build data from the server to be /// > used in subsequent build stages /// > /// > d) transfer image content data either to or from the server /// > - INTO direction is for sending inherited image content data to the /// > server's local content store /// > - OUTOF direction is for copying successfully built OCI image from /// > the server to the client /// > /// > The server may send: /// > a) stdio packet for the build progress /// > /// > b) build error indicating unsuccessful build /// > /// > c) command complete packet indicating a command has finished executing /// > /// > d) handle transfer build data either to or from the client /// > /// > e) handle transfer image content data either to or from the client /// > /// > /// > NOTE: The build data and image content data transfer is ALWAYS initiated /// > by the client. /// > /// > Sequence for transferring from the client to the server: /// > 1. client send a BuildTransfer/ImageTransfer request with ID, direction /// > of 'INTO', /// > destination path, and first chunk of data /// > 2. server starts to receive the data and stream to a temporary file /// > 3. client continues to send all chunks of data until last chunk, which /// > client will /// > send with 'complete' set to true /// > 4. server continues to receive until the last chunk with 'complete' set /// > to true, /// > server will finish writing the last chunk and un-archive the /// > temporary file to the destination path /// > 5. server completes the transfer by sending a last /// > BuildTransfer/ImageTransfer with /// > 'complete' set to true /// > 6. client waits for the last BuildTransfer/ImageTransfer with 'complete' /// > set to true /// > before proceeding with the rest of the commands /// > /// > Sequence for transferring from the server to the client: /// > 1. client send a BuildTransfer/ImageTransfer request with ID, direction /// > of 'OUTOF', /// > source path, and empty data /// > 2. server archives the data at source path, and starts to send chunks to /// > the client /// > 3. server continues to send all chunks until last chunk, which server /// > will send with /// > 'complete' set to true /// > 4. client starts to receive the data and stream to a temporary file /// > 5. client continues to receive until the last chunk with 'complete' set /// > to true, /// > client will finish writing last chunk and un-archive the temporary /// > file to the destination path /// > 6. client MAY choose to send one last BuildTransfer/ImageTransfer with /// > 'complete' /// > set to true, but NOT required. /// > /// > /// > NOTE: the client should close the send stream once it has finished /// > receiving the build output or abandon the current build due to error. /// > Server should keep the stream open until it receives the EOF that client /// > has closed the stream, which the server should then close its send stream. public struct Client: ClientProtocol where Transport: GRPCCore.ClientTransport { private let client: GRPCCore.GRPCClient /// Creates a new client wrapping the provided `GRPCCore.GRPCClient`. /// /// - Parameters: /// - client: A `GRPCCore.GRPCClient` providing a communication channel to the service. public init(wrapping client: GRPCCore.GRPCClient) { self.client = client } /// Call the "CreateBuild" method. /// /// > Source IDL Documentation: /// > /// > Create a build request. /// /// - Parameters: /// - request: A request containing a single `Com_Apple_Container_Build_V1_CreateBuildRequest` message. /// - serializer: A serializer for `Com_Apple_Container_Build_V1_CreateBuildRequest` messages. /// - deserializer: A deserializer for `Com_Apple_Container_Build_V1_CreateBuildResponse` messages. /// - options: Options to apply to this RPC. /// - handleResponse: A closure which handles the response, the result of which is /// returned to the caller. Returning from the closure will cancel the RPC if it /// hasn't already finished. /// - Returns: The result of `handleResponse`. public func createBuild( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { response in try response.message } ) async throws -> Result where Result: Sendable { try await self.client.unary( request: request, descriptor: Com_Apple_Container_Build_V1_Builder.Method.CreateBuild.descriptor, serializer: serializer, deserializer: deserializer, options: options, onResponse: handleResponse ) } /// Call the "PerformBuild" method. /// /// > Source IDL Documentation: /// > /// > Perform the build. /// > Executes the entire build sequence with attaching input/output /// > to handling data exchange with the server during the build. /// /// - Parameters: /// - request: A streaming request producing `Com_Apple_Container_Build_V1_ClientStream` messages. /// - serializer: A serializer for `Com_Apple_Container_Build_V1_ClientStream` messages. /// - deserializer: A deserializer for `Com_Apple_Container_Build_V1_ServerStream` messages. /// - options: Options to apply to this RPC. /// - handleResponse: A closure which handles the response, the result of which is /// returned to the caller. Returning from the closure will cancel the RPC if it /// hasn't already finished. /// - Returns: The result of `handleResponse`. public func performBuild( request: GRPCCore.StreamingClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable { try await self.client.bidirectionalStreaming( request: request, descriptor: Com_Apple_Container_Build_V1_Builder.Method.PerformBuild.descriptor, serializer: serializer, deserializer: deserializer, options: options, onResponse: handleResponse ) } /// Call the "Info" method. /// /// - Parameters: /// - request: A request containing a single `Com_Apple_Container_Build_V1_InfoRequest` message. /// - serializer: A serializer for `Com_Apple_Container_Build_V1_InfoRequest` messages. /// - deserializer: A deserializer for `Com_Apple_Container_Build_V1_InfoResponse` messages. /// - options: Options to apply to this RPC. /// - handleResponse: A closure which handles the response, the result of which is /// returned to the caller. Returning from the closure will cancel the RPC if it /// hasn't already finished. /// - Returns: The result of `handleResponse`. public func info( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { response in try response.message } ) async throws -> Result where Result: Sendable { try await self.client.unary( request: request, descriptor: Com_Apple_Container_Build_V1_Builder.Method.Info.descriptor, serializer: serializer, deserializer: deserializer, options: options, onResponse: handleResponse ) } } } // Helpers providing default arguments to 'ClientProtocol' methods. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Com_Apple_Container_Build_V1_Builder.ClientProtocol { /// Call the "CreateBuild" method. /// /// > Source IDL Documentation: /// > /// > Create a build request. /// /// - Parameters: /// - request: A request containing a single `Com_Apple_Container_Build_V1_CreateBuildRequest` message. /// - options: Options to apply to this RPC. /// - handleResponse: A closure which handles the response, the result of which is /// returned to the caller. Returning from the closure will cancel the RPC if it /// hasn't already finished. /// - Returns: The result of `handleResponse`. public func createBuild( request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { response in try response.message } ) async throws -> Result where Result: Sendable { try await self.createBuild( request: request, serializer: GRPCProtobuf.ProtobufSerializer(), deserializer: GRPCProtobuf.ProtobufDeserializer(), options: options, onResponse: handleResponse ) } /// Call the "PerformBuild" method. /// /// > Source IDL Documentation: /// > /// > Perform the build. /// > Executes the entire build sequence with attaching input/output /// > to handling data exchange with the server during the build. /// /// - Parameters: /// - request: A streaming request producing `Com_Apple_Container_Build_V1_ClientStream` messages. /// - options: Options to apply to this RPC. /// - handleResponse: A closure which handles the response, the result of which is /// returned to the caller. Returning from the closure will cancel the RPC if it /// hasn't already finished. /// - Returns: The result of `handleResponse`. public func performBuild( request: GRPCCore.StreamingClientRequest, options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable { try await self.performBuild( request: request, serializer: GRPCProtobuf.ProtobufSerializer(), deserializer: GRPCProtobuf.ProtobufDeserializer(), options: options, onResponse: handleResponse ) } /// Call the "Info" method. /// /// - Parameters: /// - request: A request containing a single `Com_Apple_Container_Build_V1_InfoRequest` message. /// - options: Options to apply to this RPC. /// - handleResponse: A closure which handles the response, the result of which is /// returned to the caller. Returning from the closure will cancel the RPC if it /// hasn't already finished. /// - Returns: The result of `handleResponse`. public func info( request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { response in try response.message } ) async throws -> Result where Result: Sendable { try await self.info( request: request, serializer: GRPCProtobuf.ProtobufSerializer(), deserializer: GRPCProtobuf.ProtobufDeserializer(), options: options, onResponse: handleResponse ) } } // Helpers providing sugared APIs for 'ClientProtocol' methods. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Com_Apple_Container_Build_V1_Builder.ClientProtocol { /// Call the "CreateBuild" method. /// /// > Source IDL Documentation: /// > /// > Create a build request. /// /// - Parameters: /// - message: request message to send. /// - metadata: Additional metadata to send, defaults to empty. /// - options: Options to apply to this RPC, defaults to `.defaults`. /// - handleResponse: A closure which handles the response, the result of which is /// returned to the caller. Returning from the closure will cancel the RPC if it /// hasn't already finished. /// - Returns: The result of `handleResponse`. public func createBuild( _ message: Com_Apple_Container_Build_V1_CreateBuildRequest, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { response in try response.message } ) async throws -> Result where Result: Sendable { let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) return try await self.createBuild( request: request, options: options, onResponse: handleResponse ) } /// Call the "PerformBuild" method. /// /// > Source IDL Documentation: /// > /// > Perform the build. /// > Executes the entire build sequence with attaching input/output /// > to handling data exchange with the server during the build. /// /// - Parameters: /// - metadata: Additional metadata to send, defaults to empty. /// - options: Options to apply to this RPC, defaults to `.defaults`. /// - producer: A closure producing request messages to send to the server. The request /// stream is closed when the closure returns. /// - handleResponse: A closure which handles the response, the result of which is /// returned to the caller. Returning from the closure will cancel the RPC if it /// hasn't already finished. /// - Returns: The result of `handleResponse`. public func performBuild( metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, requestProducer producer: @Sendable @escaping (GRPCCore.RPCWriter) async throws -> Void, onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable { let request = GRPCCore.StreamingClientRequest( metadata: metadata, producer: producer ) return try await self.performBuild( request: request, options: options, onResponse: handleResponse ) } /// Call the "Info" method. /// /// - Parameters: /// - message: request message to send. /// - metadata: Additional metadata to send, defaults to empty. /// - options: Options to apply to this RPC, defaults to `.defaults`. /// - handleResponse: A closure which handles the response, the result of which is /// returned to the caller. Returning from the closure will cancel the RPC if it /// hasn't already finished. /// - Returns: The result of `handleResponse`. public func info( _ message: Com_Apple_Container_Build_V1_InfoRequest, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { response in try response.message } ) async throws -> Result where Result: Sendable { let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) return try await self.info( request: request, options: options, onResponse: handleResponse ) } }