// 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
#if canImport(FoundationNetworking)
  import FoundationNetworking
#endif
import GoogleCloudLocation
import GoogleCloudWkt
import GoogleLongRunning
import GoogleRpc
import GoogleCloudGax

/// Service describing handlers for resources.
///
/// @Snippet(path: "SecurityPostureQuickstart")
public class SecurityPostureClient: Clients.SecurityPostureProtocol {
  let inner: any Clients.SecurityPostureStub
  let pollingErrorPolicy: GoogleCloudGax.PollingErrorPolicy
  let pollingBackoffPolicy: GoogleCloudGax.BackoffPolicy

  /// Creates a new `SecurityPostureClient` instance.
  public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
    var inner: any Clients.SecurityPostureStub = try Clients.SecurityPostureTransport(options)
    inner = Clients.SecurityPostureRetry(inner, options: options)
    if let logger = options.logger {
      inner = Clients.SecurityPostureLogging(inner, logger: logger)
    }
    self.inner = inner
    self.pollingErrorPolicy = options.pollingErrorPolicy
    self.pollingBackoffPolicy = options.pollingBackoffPolicy
  }

  /// (-- This option restricts the visibility of the API to only projects that
  /// will
  /// (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service.
  /// (-- option (google.api.api_visibility).restriction =
  /// "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization
  /// and location. In case a posture has multiple revisions, the latest revision
  /// as per UpdateTime will be returned.
  ///
  /// @Snippet(path: "SecurityPosture_ListPostures")
  public func listPostures(
    request: ListPosturesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.ListPosturesResponse {
    try await self.inner.listPostures(request: request, options: options)
  }

  /// (-- This option restricts the visibility of the API to only projects that
  /// will
  /// (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service.
  /// (-- option (google.api.api_visibility).restriction =
  /// "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization
  /// and location. In case a posture has multiple revisions, the latest revision
  /// as per UpdateTime will be returned.
  ///
  /// @Snippet(path: "SecurityPosture_ListPostures")
  public func listPostures(
    byItem: ListPosturesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Posture, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudSecuritypostureV1.ListPosturesResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listPostures(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Lists revisions of a Posture in a given organization and location.
  ///
  /// @Snippet(path: "SecurityPosture_ListPostureRevisions")
  public func listPostureRevisions(
    request: ListPostureRevisionsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.ListPostureRevisionsResponse {
    try await self.inner.listPostureRevisions(request: request, options: options)
  }

  /// Lists revisions of a Posture in a given organization and location.
  ///
  /// @Snippet(path: "SecurityPosture_ListPostureRevisions")
  public func listPostureRevisions(
    byItem: ListPostureRevisionsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Posture, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws
        -> GoogleCloudSecuritypostureV1.ListPostureRevisionsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listPostureRevisions(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets a posture in a given organization and location.
  /// User must provide revision_id to retrieve a specific revision of the
  /// resource.
  /// NOT_FOUND error is returned if the revision_id or the Posture name does not
  /// exist. In case revision_id is not provided then the latest Posture revision
  /// by UpdateTime is returned.
  ///
  /// @Snippet(path: "SecurityPosture_GetPosture")
  public func getPosture(
    request: GetPostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.Posture {
    try await self.inner.getPosture(request: request, options: options)
  }

  /// Creates a new Posture resource.
  /// If a Posture with the specified name already exists in the specified
  /// organization and location, the long running operation returns a
  /// [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.
  ///
  /// @Snippet(path: "SecurityPosture_CreatePosture")
  public func createPosture(
    request: CreatePostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.createPosture(request: request, options: options)
  }

  /// Creates a new Posture resource.
  /// If a Posture with the specified name already exists in the specified
  /// organization and location, the long running operation returns a
  /// [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.
  ///
  /// @Snippet(path: "SecurityPosture_CreatePosture")
  public func createPosture(
    withPolling: CreatePostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Posture> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Posture>.State in
      guard op.done else {
        return .init(done: false, result: nil)
      }

      switch op.result {
      case .response(let anyValue):
        guard let anyValueUnwrapped = anyValue else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding(
                "Operation completed but response value was missing")))
        }
        let response = try Posture(fromAny: anyValueUnwrapped)
        return .init(done: true, result: .success(response))
      case .error(let status):
        guard let statusUnwrapped = status else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding("Operation completed but error value was missing")
            ))
        }
        let error = GoogleCloudGax.RequestError.service(
          GoogleCloudGax.ServiceError(
            code: GoogleRpc.Code(intValue: Int(statusUnwrapped.code)),
            message: statusUnwrapped.message))
        return .init(done: true, result: .failure(error))
      case .none:
        return .init(
          done: true,
          result: .failure(
            GoogleCloudGax.RequestError.binding("Operation completed but result was missing")))
      }
    }
    let rawOp = try await self.createPosture(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Posture>.State in
      let op = try await self.getOperation(
        request: .init().with { $0.name = rawOp.name }, options: options)
      return try extractStatus(op)
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: initialState,
      polling: options.pollingErrorPolicy ?? self.pollingErrorPolicy,
      backoff: options.pollingBackoffPolicy ?? self.pollingBackoffPolicy,
      poll: poll,
    )
  }

  /// Updates an existing Posture.
  /// A new revision of the posture will be created if the revision to be
  /// updated is currently deployed on a workload.
  /// Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
  /// Posture does not exist.
  /// Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag
  /// supplied in the request does not match the persisted etag of the Posture.
  /// Updatable fields are state, description and policy_sets.
  /// State update operation cannot be clubbed with update of description and
  /// policy_sets.
  /// An ACTIVE posture can be updated to both DRAFT or DEPRECATED states.
  /// Postures in DRAFT or DEPRECATED states can only be updated to ACTIVE state.
  ///
  /// @Snippet(path: "SecurityPosture_UpdatePosture")
  public func updatePosture(
    request: UpdatePostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.updatePosture(request: request, options: options)
  }

  /// Updates an existing Posture.
  /// A new revision of the posture will be created if the revision to be
  /// updated is currently deployed on a workload.
  /// Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
  /// Posture does not exist.
  /// Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag
  /// supplied in the request does not match the persisted etag of the Posture.
  /// Updatable fields are state, description and policy_sets.
  /// State update operation cannot be clubbed with update of description and
  /// policy_sets.
  /// An ACTIVE posture can be updated to both DRAFT or DEPRECATED states.
  /// Postures in DRAFT or DEPRECATED states can only be updated to ACTIVE state.
  ///
  /// @Snippet(path: "SecurityPosture_UpdatePosture")
  public func updatePosture(
    withPolling: UpdatePostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Posture> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Posture>.State in
      guard op.done else {
        return .init(done: false, result: nil)
      }

      switch op.result {
      case .response(let anyValue):
        guard let anyValueUnwrapped = anyValue else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding(
                "Operation completed but response value was missing")))
        }
        let response = try Posture(fromAny: anyValueUnwrapped)
        return .init(done: true, result: .success(response))
      case .error(let status):
        guard let statusUnwrapped = status else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding("Operation completed but error value was missing")
            ))
        }
        let error = GoogleCloudGax.RequestError.service(
          GoogleCloudGax.ServiceError(
            code: GoogleRpc.Code(intValue: Int(statusUnwrapped.code)),
            message: statusUnwrapped.message))
        return .init(done: true, result: .failure(error))
      case .none:
        return .init(
          done: true,
          result: .failure(
            GoogleCloudGax.RequestError.binding("Operation completed but result was missing")))
      }
    }
    let rawOp = try await self.updatePosture(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Posture>.State in
      let op = try await self.getOperation(
        request: .init().with { $0.name = rawOp.name }, options: options)
      return try extractStatus(op)
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: initialState,
      polling: options.pollingErrorPolicy ?? self.pollingErrorPolicy,
      backoff: options.pollingBackoffPolicy ?? self.pollingBackoffPolicy,
      poll: poll,
    )
  }

  /// Deletes all the revisions of a resource.
  /// A posture can only be deleted when none of the revisions are deployed to
  /// any workload.
  ///
  /// @Snippet(path: "SecurityPosture_DeletePosture")
  public func deletePosture(
    request: DeletePostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.deletePosture(request: request, options: options)
  }

  /// Deletes all the revisions of a resource.
  /// A posture can only be deleted when none of the revisions are deployed to
  /// any workload.
  ///
  /// @Snippet(path: "SecurityPosture_DeletePosture")
  public func deletePosture(
    withPolling: DeletePostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Void> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws -> GoogleCloudGax._PollableOperationImpl<Void>.State
      in
      guard op.done else {
        return .init(done: false, result: nil)
      }

      switch op.result {
      case .response:
        return .init(done: true, result: .success(()))
      case .error(let status):
        guard let statusUnwrapped = status else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding("Operation completed but error value was missing")
            ))
        }
        let error = GoogleCloudGax.RequestError.service(
          GoogleCloudGax.ServiceError(
            code: GoogleRpc.Code(intValue: Int(statusUnwrapped.code)),
            message: statusUnwrapped.message))
        return .init(done: true, result: .failure(error))
      case .none:
        return .init(
          done: true,
          result: .failure(
            GoogleCloudGax.RequestError.binding("Operation completed but result was missing")))
      }
    }
    let rawOp = try await self.deletePosture(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Void>.State in
      let op = try await self.getOperation(
        request: .init().with { $0.name = rawOp.name }, options: options)
      return try extractStatus(op)
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: initialState,
      polling: options.pollingErrorPolicy ?? self.pollingErrorPolicy,
      backoff: options.pollingBackoffPolicy ?? self.pollingBackoffPolicy,
      poll: poll,
    )
  }

  /// Extracts existing policies on a workload as a posture.
  /// If a Posture on the given workload already exists, the long running
  /// operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.
  ///
  /// @Snippet(path: "SecurityPosture_ExtractPosture")
  public func extractPosture(
    request: ExtractPostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.extractPosture(request: request, options: options)
  }

  /// Extracts existing policies on a workload as a posture.
  /// If a Posture on the given workload already exists, the long running
  /// operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.
  ///
  /// @Snippet(path: "SecurityPosture_ExtractPosture")
  public func extractPosture(
    withPolling: ExtractPostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Posture> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Posture>.State in
      guard op.done else {
        return .init(done: false, result: nil)
      }

      switch op.result {
      case .response(let anyValue):
        guard let anyValueUnwrapped = anyValue else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding(
                "Operation completed but response value was missing")))
        }
        let response = try Posture(fromAny: anyValueUnwrapped)
        return .init(done: true, result: .success(response))
      case .error(let status):
        guard let statusUnwrapped = status else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding("Operation completed but error value was missing")
            ))
        }
        let error = GoogleCloudGax.RequestError.service(
          GoogleCloudGax.ServiceError(
            code: GoogleRpc.Code(intValue: Int(statusUnwrapped.code)),
            message: statusUnwrapped.message))
        return .init(done: true, result: .failure(error))
      case .none:
        return .init(
          done: true,
          result: .failure(
            GoogleCloudGax.RequestError.binding("Operation completed but result was missing")))
      }
    }
    let rawOp = try await self.extractPosture(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Posture>.State in
      let op = try await self.getOperation(
        request: .init().with { $0.name = rawOp.name }, options: options)
      return try extractStatus(op)
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: initialState,
      polling: options.pollingErrorPolicy ?? self.pollingErrorPolicy,
      backoff: options.pollingBackoffPolicy ?? self.pollingBackoffPolicy,
      poll: poll,
    )
  }

  /// PostureDeployments
  /// Lists PostureDeployments in a given project and location.
  ///
  /// @Snippet(path: "SecurityPosture_ListPostureDeployments")
  public func listPostureDeployments(
    request: ListPostureDeploymentsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.ListPostureDeploymentsResponse {
    try await self.inner.listPostureDeployments(request: request, options: options)
  }

  /// PostureDeployments
  /// Lists PostureDeployments in a given project and location.
  ///
  /// @Snippet(path: "SecurityPosture_ListPostureDeployments")
  public func listPostureDeployments(
    byItem: ListPostureDeploymentsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<PostureDeployment, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws
        -> GoogleCloudSecuritypostureV1.ListPostureDeploymentsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listPostureDeployments(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets details of a single PostureDeployment.
  ///
  /// @Snippet(path: "SecurityPosture_GetPostureDeployment")
  public func getPostureDeployment(
    request: GetPostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.PostureDeployment {
    try await self.inner.getPostureDeployment(request: request, options: options)
  }

  /// Creates a new PostureDeployment in a given project and location.
  ///
  /// @Snippet(path: "SecurityPosture_CreatePostureDeployment")
  public func createPostureDeployment(
    request: CreatePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.createPostureDeployment(request: request, options: options)
  }

  /// Creates a new PostureDeployment in a given project and location.
  ///
  /// @Snippet(path: "SecurityPosture_CreatePostureDeployment")
  public func createPostureDeployment(
    withPolling: CreatePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<PostureDeployment> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<PostureDeployment>.State in
      guard op.done else {
        return .init(done: false, result: nil)
      }

      switch op.result {
      case .response(let anyValue):
        guard let anyValueUnwrapped = anyValue else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding(
                "Operation completed but response value was missing")))
        }
        let response = try PostureDeployment(fromAny: anyValueUnwrapped)
        return .init(done: true, result: .success(response))
      case .error(let status):
        guard let statusUnwrapped = status else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding("Operation completed but error value was missing")
            ))
        }
        let error = GoogleCloudGax.RequestError.service(
          GoogleCloudGax.ServiceError(
            code: GoogleRpc.Code(intValue: Int(statusUnwrapped.code)),
            message: statusUnwrapped.message))
        return .init(done: true, result: .failure(error))
      case .none:
        return .init(
          done: true,
          result: .failure(
            GoogleCloudGax.RequestError.binding("Operation completed but result was missing")))
      }
    }
    let rawOp = try await self.createPostureDeployment(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = {
      () async throws -> GoogleCloudGax._PollableOperationImpl<PostureDeployment>.State in
      let op = try await self.getOperation(
        request: .init().with { $0.name = rawOp.name }, options: options)
      return try extractStatus(op)
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: initialState,
      polling: options.pollingErrorPolicy ?? self.pollingErrorPolicy,
      backoff: options.pollingBackoffPolicy ?? self.pollingBackoffPolicy,
      poll: poll,
    )
  }

  /// Updates the parameters of a single PostureDeployment.
  ///
  /// @Snippet(path: "SecurityPosture_UpdatePostureDeployment")
  public func updatePostureDeployment(
    request: UpdatePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.updatePostureDeployment(request: request, options: options)
  }

  /// Updates the parameters of a single PostureDeployment.
  ///
  /// @Snippet(path: "SecurityPosture_UpdatePostureDeployment")
  public func updatePostureDeployment(
    withPolling: UpdatePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<PostureDeployment> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<PostureDeployment>.State in
      guard op.done else {
        return .init(done: false, result: nil)
      }

      switch op.result {
      case .response(let anyValue):
        guard let anyValueUnwrapped = anyValue else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding(
                "Operation completed but response value was missing")))
        }
        let response = try PostureDeployment(fromAny: anyValueUnwrapped)
        return .init(done: true, result: .success(response))
      case .error(let status):
        guard let statusUnwrapped = status else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding("Operation completed but error value was missing")
            ))
        }
        let error = GoogleCloudGax.RequestError.service(
          GoogleCloudGax.ServiceError(
            code: GoogleRpc.Code(intValue: Int(statusUnwrapped.code)),
            message: statusUnwrapped.message))
        return .init(done: true, result: .failure(error))
      case .none:
        return .init(
          done: true,
          result: .failure(
            GoogleCloudGax.RequestError.binding("Operation completed but result was missing")))
      }
    }
    let rawOp = try await self.updatePostureDeployment(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = {
      () async throws -> GoogleCloudGax._PollableOperationImpl<PostureDeployment>.State in
      let op = try await self.getOperation(
        request: .init().with { $0.name = rawOp.name }, options: options)
      return try extractStatus(op)
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: initialState,
      polling: options.pollingErrorPolicy ?? self.pollingErrorPolicy,
      backoff: options.pollingBackoffPolicy ?? self.pollingBackoffPolicy,
      poll: poll,
    )
  }

  /// Deletes a single PostureDeployment.
  ///
  /// @Snippet(path: "SecurityPosture_DeletePostureDeployment")
  public func deletePostureDeployment(
    request: DeletePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.deletePostureDeployment(request: request, options: options)
  }

  /// Deletes a single PostureDeployment.
  ///
  /// @Snippet(path: "SecurityPosture_DeletePostureDeployment")
  public func deletePostureDeployment(
    withPolling: DeletePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Void> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws -> GoogleCloudGax._PollableOperationImpl<Void>.State
      in
      guard op.done else {
        return .init(done: false, result: nil)
      }

      switch op.result {
      case .response:
        return .init(done: true, result: .success(()))
      case .error(let status):
        guard let statusUnwrapped = status else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding("Operation completed but error value was missing")
            ))
        }
        let error = GoogleCloudGax.RequestError.service(
          GoogleCloudGax.ServiceError(
            code: GoogleRpc.Code(intValue: Int(statusUnwrapped.code)),
            message: statusUnwrapped.message))
        return .init(done: true, result: .failure(error))
      case .none:
        return .init(
          done: true,
          result: .failure(
            GoogleCloudGax.RequestError.binding("Operation completed but result was missing")))
      }
    }
    let rawOp = try await self.deletePostureDeployment(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Void>.State in
      let op = try await self.getOperation(
        request: .init().with { $0.name = rawOp.name }, options: options)
      return try extractStatus(op)
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: initialState,
      polling: options.pollingErrorPolicy ?? self.pollingErrorPolicy,
      backoff: options.pollingBackoffPolicy ?? self.pollingBackoffPolicy,
      poll: poll,
    )
  }

  /// PostureTemplates
  /// Lists all the PostureTemplates available to the user.
  ///
  /// @Snippet(path: "SecurityPosture_ListPostureTemplates")
  public func listPostureTemplates(
    request: ListPostureTemplatesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.ListPostureTemplatesResponse {
    try await self.inner.listPostureTemplates(request: request, options: options)
  }

  /// PostureTemplates
  /// Lists all the PostureTemplates available to the user.
  ///
  /// @Snippet(path: "SecurityPosture_ListPostureTemplates")
  public func listPostureTemplates(
    byItem: ListPostureTemplatesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<PostureTemplate, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws
        -> GoogleCloudSecuritypostureV1.ListPostureTemplatesResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listPostureTemplates(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets a PostureTemplate.
  /// User must provide revision_id to retrieve a specific revision of the
  /// resource.
  /// NOT_FOUND error is returned if the revision_id or the PostureTemplate name
  /// does not exist. In case revision_id is not provided then the
  /// PostureTemplate with latest revision_id is returned.
  ///
  /// @Snippet(path: "SecurityPosture_GetPostureTemplate")
  public func getPostureTemplate(
    request: GetPostureTemplateRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.PostureTemplate {
    try await self.inner.getPostureTemplate(request: request, options: options)
  }

  /// Lists information about the supported locations for this service.
  ///
  /// @Snippet(path: "SecurityPosture_ListLocations")
  public func listLocations(
    request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudLocation.ListLocationsResponse {
    try await self.inner.listLocations(request: request, options: options)
  }

  /// Lists information about the supported locations for this service.
  ///
  /// @Snippet(path: "SecurityPosture_ListLocations")
  public func listLocations(
    byItem: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudLocation.ListLocationsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listLocations(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets information about a location.
  ///
  /// @Snippet(path: "SecurityPosture_GetLocation")
  public func getLocation(
    request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudLocation.Location {
    try await self.inner.getLocation(request: request, options: options)
  }

  /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
  ///
  /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
  ///
  /// @Snippet(path: "SecurityPosture_ListOperations")
  public func listOperations(
    request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.ListOperationsResponse {
    try await self.inner.listOperations(request: request, options: options)
  }

  /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
  ///
  /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
  ///
  /// @Snippet(path: "SecurityPosture_ListOperations")
  public func listOperations(
    byItem: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleLongRunning.ListOperationsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listOperations(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
  ///
  /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
  ///
  /// @Snippet(path: "SecurityPosture_GetOperation")
  func getOperation(
    request: GoogleLongRunning.GetOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.getOperation(request: request, options: options)
  }

  /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
  ///
  /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
  ///
  /// @Snippet(path: "SecurityPosture_DeleteOperation")
  public func deleteOperation(
    request: GoogleLongRunning.DeleteOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    try await self.inner.deleteOperation(request: request, options: options)
  }

  /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
  ///
  /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
  ///
  /// @Snippet(path: "SecurityPosture_CancelOperation")
  public func cancelOperation(
    request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    try await self.inner.cancelOperation(request: request, options: options)
  }
}

extension Clients {
  /// A Swift protocol to mock `SecurityPostureClient`.
  ///
  /// To mock `SecurityPostureClient` change your functions to receive
  /// `some SecurityPostureProtocol` or `any SecurityPostureProtocol`
  /// and pass a mock implementation in your tests.
  public protocol SecurityPostureProtocol {
    /// See `SecurityPostureClient.listPostures`.
    func listPostures(request: ListPosturesRequest) async throws
      -> GoogleCloudSecuritypostureV1.ListPosturesResponse

    /// See `SecurityPostureClient.listPostures`.
    func listPostures(
      byItem: ListPosturesRequest
    ) throws -> any AsyncSequence<Posture, Swift.Error>

    /// See `SecurityPostureClient.listPostures`.
    func listPostures(
      parent: Swift.String,
    ) throws -> any AsyncSequence<Posture, Swift.Error>

    /// See `SecurityPostureClient.listPostureRevisions`.
    func listPostureRevisions(request: ListPostureRevisionsRequest) async throws
      -> GoogleCloudSecuritypostureV1.ListPostureRevisionsResponse

    /// See `SecurityPostureClient.listPostureRevisions`.
    func listPostureRevisions(
      byItem: ListPostureRevisionsRequest
    ) throws -> any AsyncSequence<Posture, Swift.Error>

    /// See `SecurityPostureClient.getPosture`.
    func getPosture(request: GetPostureRequest) async throws -> GoogleCloudSecuritypostureV1.Posture

    /// See `SecurityPostureClient.getPosture`.
    func getPosture(
      name: Swift.String,
    ) async throws -> GoogleCloudSecuritypostureV1.Posture

    /// See `SecurityPostureClient.createPosture`.
    func createPosture(request: CreatePostureRequest) async throws -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.createPosture`.
    func createPosture(withPolling: CreatePostureRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Posture>

    /// See `SecurityPostureClient.createPosture`.
    func createPosture(
      parent: Swift.String,
      posture: Posture?,
      postureId: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Posture>

    /// See `SecurityPostureClient.updatePosture`.
    func updatePosture(request: UpdatePostureRequest) async throws -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.updatePosture`.
    func updatePosture(withPolling: UpdatePostureRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Posture>

    /// See `SecurityPostureClient.updatePosture`.
    func updatePosture(
      posture: Posture?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> any GoogleCloudGax.PollableOperation<Posture>

    /// See `SecurityPostureClient.deletePosture`.
    func deletePosture(request: DeletePostureRequest) async throws -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.deletePosture`.
    func deletePosture(withPolling: DeletePostureRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Void>

    /// See `SecurityPostureClient.deletePosture`.
    func deletePosture(
      name: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

    /// See `SecurityPostureClient.extractPosture`.
    func extractPosture(request: ExtractPostureRequest) async throws -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.extractPosture`.
    func extractPosture(withPolling: ExtractPostureRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Posture>

    /// See `SecurityPostureClient.extractPosture`.
    func extractPosture(
      parent: Swift.String,
      postureId: Swift.String,
      workload: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Posture>

    /// See `SecurityPostureClient.listPostureDeployments`.
    func listPostureDeployments(request: ListPostureDeploymentsRequest) async throws
      -> GoogleCloudSecuritypostureV1.ListPostureDeploymentsResponse

    /// See `SecurityPostureClient.listPostureDeployments`.
    func listPostureDeployments(
      byItem: ListPostureDeploymentsRequest
    ) throws -> any AsyncSequence<PostureDeployment, Swift.Error>

    /// See `SecurityPostureClient.listPostureDeployments`.
    func listPostureDeployments(
      parent: Swift.String,
    ) throws -> any AsyncSequence<PostureDeployment, Swift.Error>

    /// See `SecurityPostureClient.getPostureDeployment`.
    func getPostureDeployment(request: GetPostureDeploymentRequest) async throws
      -> GoogleCloudSecuritypostureV1.PostureDeployment

    /// See `SecurityPostureClient.getPostureDeployment`.
    func getPostureDeployment(
      name: Swift.String,
    ) async throws -> GoogleCloudSecuritypostureV1.PostureDeployment

    /// See `SecurityPostureClient.createPostureDeployment`.
    func createPostureDeployment(request: CreatePostureDeploymentRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.createPostureDeployment`.
    func createPostureDeployment(withPolling: CreatePostureDeploymentRequest) async throws
      -> any GoogleCloudGax.PollableOperation<PostureDeployment>

    /// See `SecurityPostureClient.createPostureDeployment`.
    func createPostureDeployment(
      parent: Swift.String,
      postureDeployment: PostureDeployment?,
      postureDeploymentId: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<PostureDeployment>

    /// See `SecurityPostureClient.updatePostureDeployment`.
    func updatePostureDeployment(request: UpdatePostureDeploymentRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.updatePostureDeployment`.
    func updatePostureDeployment(withPolling: UpdatePostureDeploymentRequest) async throws
      -> any GoogleCloudGax.PollableOperation<PostureDeployment>

    /// See `SecurityPostureClient.updatePostureDeployment`.
    func updatePostureDeployment(
      postureDeployment: PostureDeployment?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> any GoogleCloudGax.PollableOperation<PostureDeployment>

    /// See `SecurityPostureClient.deletePostureDeployment`.
    func deletePostureDeployment(request: DeletePostureDeploymentRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.deletePostureDeployment`.
    func deletePostureDeployment(withPolling: DeletePostureDeploymentRequest) async throws
      -> any GoogleCloudGax.PollableOperation<Void>

    /// See `SecurityPostureClient.deletePostureDeployment`.
    func deletePostureDeployment(
      name: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

    /// See `SecurityPostureClient.listPostureTemplates`.
    func listPostureTemplates(request: ListPostureTemplatesRequest) async throws
      -> GoogleCloudSecuritypostureV1.ListPostureTemplatesResponse

    /// See `SecurityPostureClient.listPostureTemplates`.
    func listPostureTemplates(
      byItem: ListPostureTemplatesRequest
    ) throws -> any AsyncSequence<PostureTemplate, Swift.Error>

    /// See `SecurityPostureClient.listPostureTemplates`.
    func listPostureTemplates(
      parent: Swift.String,
    ) throws -> any AsyncSequence<PostureTemplate, Swift.Error>

    /// See `SecurityPostureClient.getPostureTemplate`.
    func getPostureTemplate(request: GetPostureTemplateRequest) async throws
      -> GoogleCloudSecuritypostureV1.PostureTemplate

    /// See `SecurityPostureClient.getPostureTemplate`.
    func getPostureTemplate(
      name: Swift.String,
    ) async throws -> GoogleCloudSecuritypostureV1.PostureTemplate

    /// See `SecurityPostureClient.listLocations`.
    func listLocations(request: GoogleCloudLocation.ListLocationsRequest) async throws
      -> GoogleCloudLocation.ListLocationsResponse

    /// See `SecurityPostureClient.listLocations`.
    func listLocations(
      byItem: GoogleCloudLocation.ListLocationsRequest
    ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error>

    /// See `SecurityPostureClient.getLocation`.
    func getLocation(request: GoogleCloudLocation.GetLocationRequest) async throws
      -> GoogleCloudLocation.Location

    /// See `SecurityPostureClient.listOperations`.
    func listOperations(request: GoogleLongRunning.ListOperationsRequest) async throws
      -> GoogleLongRunning.ListOperationsResponse

    /// See `SecurityPostureClient.listOperations`.
    func listOperations(
      byItem: GoogleLongRunning.ListOperationsRequest
    ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error>

    /// See `SecurityPostureClient.listOperations`.
    func listOperations(
      name: Swift.String,
      filter: Swift.String,
    ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error>

    /// See `SecurityPostureClient.deleteOperation`.
    func deleteOperation(request: GoogleLongRunning.DeleteOperationRequest) async throws

    /// See `SecurityPostureClient.deleteOperation`.
    func deleteOperation(
      name: Swift.String,
    ) async throws

    /// See `SecurityPostureClient.cancelOperation`.
    func cancelOperation(request: GoogleLongRunning.CancelOperationRequest) async throws

    /// See `SecurityPostureClient.cancelOperation`.
    func cancelOperation(
      name: Swift.String,
    ) async throws

    /// See `SecurityPostureClient.listPostures`.
    func listPostures(
      request: ListPosturesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecuritypostureV1.ListPosturesResponse

    /// See `SecurityPostureClient.listPostures`.
    func listPostures(
      byItem: ListPosturesRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Posture, Swift.Error>

    /// See `SecurityPostureClient.listPostureRevisions`.
    func listPostureRevisions(
      request: ListPostureRevisionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecuritypostureV1.ListPostureRevisionsResponse

    /// See `SecurityPostureClient.listPostureRevisions`.
    func listPostureRevisions(
      byItem: ListPostureRevisionsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Posture, Swift.Error>

    /// See `SecurityPostureClient.getPosture`.
    func getPosture(
      request: GetPostureRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecuritypostureV1.Posture

    /// See `SecurityPostureClient.createPosture`.
    func createPosture(
      request: CreatePostureRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.createPosture`.
    func createPosture(
      withPolling: CreatePostureRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Posture>

    /// See `SecurityPostureClient.updatePosture`.
    func updatePosture(
      request: UpdatePostureRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.updatePosture`.
    func updatePosture(
      withPolling: UpdatePostureRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Posture>

    /// See `SecurityPostureClient.deletePosture`.
    func deletePosture(
      request: DeletePostureRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.deletePosture`.
    func deletePosture(
      withPolling: DeletePostureRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

    /// See `SecurityPostureClient.extractPosture`.
    func extractPosture(
      request: ExtractPostureRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.extractPosture`.
    func extractPosture(
      withPolling: ExtractPostureRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Posture>

    /// See `SecurityPostureClient.listPostureDeployments`.
    func listPostureDeployments(
      request: ListPostureDeploymentsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecuritypostureV1.ListPostureDeploymentsResponse

    /// See `SecurityPostureClient.listPostureDeployments`.
    func listPostureDeployments(
      byItem: ListPostureDeploymentsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<PostureDeployment, Swift.Error>

    /// See `SecurityPostureClient.getPostureDeployment`.
    func getPostureDeployment(
      request: GetPostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecuritypostureV1.PostureDeployment

    /// See `SecurityPostureClient.createPostureDeployment`.
    func createPostureDeployment(
      request: CreatePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.createPostureDeployment`.
    func createPostureDeployment(
      withPolling: CreatePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<PostureDeployment>

    /// See `SecurityPostureClient.updatePostureDeployment`.
    func updatePostureDeployment(
      request: UpdatePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.updatePostureDeployment`.
    func updatePostureDeployment(
      withPolling: UpdatePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<PostureDeployment>

    /// See `SecurityPostureClient.deletePostureDeployment`.
    func deletePostureDeployment(
      request: DeletePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `SecurityPostureClient.deletePostureDeployment`.
    func deletePostureDeployment(
      withPolling: DeletePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

    /// See `SecurityPostureClient.listPostureTemplates`.
    func listPostureTemplates(
      request: ListPostureTemplatesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecuritypostureV1.ListPostureTemplatesResponse

    /// See `SecurityPostureClient.listPostureTemplates`.
    func listPostureTemplates(
      byItem: ListPostureTemplatesRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<PostureTemplate, Swift.Error>

    /// See `SecurityPostureClient.getPostureTemplate`.
    func getPostureTemplate(
      request: GetPostureTemplateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecuritypostureV1.PostureTemplate

    /// See `SecurityPostureClient.listLocations`.
    func listLocations(
      request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.ListLocationsResponse

    /// See `SecurityPostureClient.listLocations`.
    func listLocations(
      byItem: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error>

    /// See `SecurityPostureClient.getLocation`.
    func getLocation(
      request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.Location

    /// See `SecurityPostureClient.listOperations`.
    func listOperations(
      request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.ListOperationsResponse

    /// See `SecurityPostureClient.listOperations`.
    func listOperations(
      byItem: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error>

    /// See `SecurityPostureClient.deleteOperation`.
    func deleteOperation(
      request: GoogleLongRunning.DeleteOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    /// See `SecurityPostureClient.cancelOperation`.
    func cancelOperation(
      request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws
  }
}

// Default implementations
extension Clients.SecurityPostureProtocol {
  public func listPostures(request: ListPosturesRequest) async throws
    -> GoogleCloudSecuritypostureV1.ListPosturesResponse
  {
    try await self.listPostures(request: request, options: .init())
  }

  public func listPostures(
    request: ListPosturesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.ListPosturesResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listPostures(
    byItem: ListPosturesRequest
  ) throws -> any AsyncSequence<Posture, Swift.Error> {
    try self.listPostures(byItem: byItem, options: .init())
  }

  public func listPostures(
    byItem: ListPosturesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Posture, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudSecuritypostureV1.ListPosturesResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func listPostures(
    parent: Swift.String,
  ) throws -> any AsyncSequence<Posture, Swift.Error> {
    let request = ListPosturesRequest().with {
      $0.parent = parent
    }
    return try self.listPostures(byItem: request)
  }

  public func listPostureRevisions(request: ListPostureRevisionsRequest) async throws
    -> GoogleCloudSecuritypostureV1.ListPostureRevisionsResponse
  {
    try await self.listPostureRevisions(request: request, options: .init())
  }

  public func listPostureRevisions(
    request: ListPostureRevisionsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.ListPostureRevisionsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listPostureRevisions(
    byItem: ListPostureRevisionsRequest
  ) throws -> any AsyncSequence<Posture, Swift.Error> {
    try self.listPostureRevisions(byItem: byItem, options: .init())
  }

  public func listPostureRevisions(
    byItem: ListPostureRevisionsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Posture, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws
        -> GoogleCloudSecuritypostureV1.ListPostureRevisionsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func getPosture(request: GetPostureRequest) async throws
    -> GoogleCloudSecuritypostureV1.Posture
  {
    try await self.getPosture(request: request, options: .init())
  }

  public func getPosture(
    request: GetPostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.Posture {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getPosture(
    name: Swift.String,
  ) async throws -> GoogleCloudSecuritypostureV1.Posture {
    let request = GetPostureRequest().with {
      $0.name = name
    }
    return try await self.getPosture(request: request)
  }

  public func createPosture(request: CreatePostureRequest) async throws
    -> GoogleLongRunning.Operation
  {
    try await self.createPosture(request: request, options: .init())
  }

  public func createPosture(
    request: CreatePostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func createPosture(withPolling: CreatePostureRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Posture>
  {
    try await self.createPosture(withPolling: withPolling, options: .init())
  }

  public func createPosture(
    withPolling: CreatePostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Posture> {
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Posture>.State in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: .init(done: false, result: nil), poll: poll)
  }

  public func createPosture(
    parent: Swift.String,
    posture: Posture?,
    postureId: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<Posture> {
    let request = CreatePostureRequest().with {
      $0.parent = parent
      $0.posture = posture
      $0.postureId = postureId
    }
    return try await self.createPosture(withPolling: request)
  }

  public func updatePosture(request: UpdatePostureRequest) async throws
    -> GoogleLongRunning.Operation
  {
    try await self.updatePosture(request: request, options: .init())
  }

  public func updatePosture(
    request: UpdatePostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func updatePosture(withPolling: UpdatePostureRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Posture>
  {
    try await self.updatePosture(withPolling: withPolling, options: .init())
  }

  public func updatePosture(
    withPolling: UpdatePostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Posture> {
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Posture>.State in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: .init(done: false, result: nil), poll: poll)
  }

  public func updatePosture(
    posture: Posture?,
    updateMask: GoogleCloudWkt.FieldMask?,
  ) async throws -> any GoogleCloudGax.PollableOperation<Posture> {
    let request = UpdatePostureRequest().with {
      $0.posture = posture
      $0.updateMask = updateMask
    }
    return try await self.updatePosture(withPolling: request)
  }

  public func deletePosture(request: DeletePostureRequest) async throws
    -> GoogleLongRunning.Operation
  {
    try await self.deletePosture(request: request, options: .init())
  }

  public func deletePosture(
    request: DeletePostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func deletePosture(withPolling: DeletePostureRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Void>
  {
    try await self.deletePosture(withPolling: withPolling, options: .init())
  }

  public func deletePosture(
    withPolling: DeletePostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Void> {
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Void>.State in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: .init(done: false, result: nil), poll: poll)
  }

  public func deletePosture(
    name: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<Void> {
    let request = DeletePostureRequest().with {
      $0.name = name
    }
    return try await self.deletePosture(withPolling: request)
  }

  public func extractPosture(request: ExtractPostureRequest) async throws
    -> GoogleLongRunning.Operation
  {
    try await self.extractPosture(request: request, options: .init())
  }

  public func extractPosture(
    request: ExtractPostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func extractPosture(withPolling: ExtractPostureRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Posture>
  {
    try await self.extractPosture(withPolling: withPolling, options: .init())
  }

  public func extractPosture(
    withPolling: ExtractPostureRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Posture> {
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Posture>.State in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: .init(done: false, result: nil), poll: poll)
  }

  public func extractPosture(
    parent: Swift.String,
    postureId: Swift.String,
    workload: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<Posture> {
    let request = ExtractPostureRequest().with {
      $0.parent = parent
      $0.postureId = postureId
      $0.workload = workload
    }
    return try await self.extractPosture(withPolling: request)
  }

  public func listPostureDeployments(request: ListPostureDeploymentsRequest) async throws
    -> GoogleCloudSecuritypostureV1.ListPostureDeploymentsResponse
  {
    try await self.listPostureDeployments(request: request, options: .init())
  }

  public func listPostureDeployments(
    request: ListPostureDeploymentsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.ListPostureDeploymentsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listPostureDeployments(
    byItem: ListPostureDeploymentsRequest
  ) throws -> any AsyncSequence<PostureDeployment, Swift.Error> {
    try self.listPostureDeployments(byItem: byItem, options: .init())
  }

  public func listPostureDeployments(
    byItem: ListPostureDeploymentsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<PostureDeployment, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws
        -> GoogleCloudSecuritypostureV1.ListPostureDeploymentsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func listPostureDeployments(
    parent: Swift.String,
  ) throws -> any AsyncSequence<PostureDeployment, Swift.Error> {
    let request = ListPostureDeploymentsRequest().with {
      $0.parent = parent
    }
    return try self.listPostureDeployments(byItem: request)
  }

  public func getPostureDeployment(request: GetPostureDeploymentRequest) async throws
    -> GoogleCloudSecuritypostureV1.PostureDeployment
  {
    try await self.getPostureDeployment(request: request, options: .init())
  }

  public func getPostureDeployment(
    request: GetPostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.PostureDeployment {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getPostureDeployment(
    name: Swift.String,
  ) async throws -> GoogleCloudSecuritypostureV1.PostureDeployment {
    let request = GetPostureDeploymentRequest().with {
      $0.name = name
    }
    return try await self.getPostureDeployment(request: request)
  }

  public func createPostureDeployment(request: CreatePostureDeploymentRequest) async throws
    -> GoogleLongRunning.Operation
  {
    try await self.createPostureDeployment(request: request, options: .init())
  }

  public func createPostureDeployment(
    request: CreatePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func createPostureDeployment(withPolling: CreatePostureDeploymentRequest) async throws
    -> any GoogleCloudGax.PollableOperation<PostureDeployment>
  {
    try await self.createPostureDeployment(withPolling: withPolling, options: .init())
  }

  public func createPostureDeployment(
    withPolling: CreatePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<PostureDeployment> {
    let poll = {
      () async throws -> GoogleCloudGax._PollableOperationImpl<PostureDeployment>.State in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: .init(done: false, result: nil), poll: poll)
  }

  public func createPostureDeployment(
    parent: Swift.String,
    postureDeployment: PostureDeployment?,
    postureDeploymentId: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<PostureDeployment> {
    let request = CreatePostureDeploymentRequest().with {
      $0.parent = parent
      $0.postureDeployment = postureDeployment
      $0.postureDeploymentId = postureDeploymentId
    }
    return try await self.createPostureDeployment(withPolling: request)
  }

  public func updatePostureDeployment(request: UpdatePostureDeploymentRequest) async throws
    -> GoogleLongRunning.Operation
  {
    try await self.updatePostureDeployment(request: request, options: .init())
  }

  public func updatePostureDeployment(
    request: UpdatePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func updatePostureDeployment(withPolling: UpdatePostureDeploymentRequest) async throws
    -> any GoogleCloudGax.PollableOperation<PostureDeployment>
  {
    try await self.updatePostureDeployment(withPolling: withPolling, options: .init())
  }

  public func updatePostureDeployment(
    withPolling: UpdatePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<PostureDeployment> {
    let poll = {
      () async throws -> GoogleCloudGax._PollableOperationImpl<PostureDeployment>.State in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: .init(done: false, result: nil), poll: poll)
  }

  public func updatePostureDeployment(
    postureDeployment: PostureDeployment?,
    updateMask: GoogleCloudWkt.FieldMask?,
  ) async throws -> any GoogleCloudGax.PollableOperation<PostureDeployment> {
    let request = UpdatePostureDeploymentRequest().with {
      $0.postureDeployment = postureDeployment
      $0.updateMask = updateMask
    }
    return try await self.updatePostureDeployment(withPolling: request)
  }

  public func deletePostureDeployment(request: DeletePostureDeploymentRequest) async throws
    -> GoogleLongRunning.Operation
  {
    try await self.deletePostureDeployment(request: request, options: .init())
  }

  public func deletePostureDeployment(
    request: DeletePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func deletePostureDeployment(withPolling: DeletePostureDeploymentRequest) async throws
    -> any GoogleCloudGax.PollableOperation<Void>
  {
    try await self.deletePostureDeployment(withPolling: withPolling, options: .init())
  }

  public func deletePostureDeployment(
    withPolling: DeletePostureDeploymentRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Void> {
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Void>.State in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: .init(done: false, result: nil), poll: poll)
  }

  public func deletePostureDeployment(
    name: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<Void> {
    let request = DeletePostureDeploymentRequest().with {
      $0.name = name
    }
    return try await self.deletePostureDeployment(withPolling: request)
  }

  public func listPostureTemplates(request: ListPostureTemplatesRequest) async throws
    -> GoogleCloudSecuritypostureV1.ListPostureTemplatesResponse
  {
    try await self.listPostureTemplates(request: request, options: .init())
  }

  public func listPostureTemplates(
    request: ListPostureTemplatesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.ListPostureTemplatesResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listPostureTemplates(
    byItem: ListPostureTemplatesRequest
  ) throws -> any AsyncSequence<PostureTemplate, Swift.Error> {
    try self.listPostureTemplates(byItem: byItem, options: .init())
  }

  public func listPostureTemplates(
    byItem: ListPostureTemplatesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<PostureTemplate, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws
        -> GoogleCloudSecuritypostureV1.ListPostureTemplatesResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func listPostureTemplates(
    parent: Swift.String,
  ) throws -> any AsyncSequence<PostureTemplate, Swift.Error> {
    let request = ListPostureTemplatesRequest().with {
      $0.parent = parent
    }
    return try self.listPostureTemplates(byItem: request)
  }

  public func getPostureTemplate(request: GetPostureTemplateRequest) async throws
    -> GoogleCloudSecuritypostureV1.PostureTemplate
  {
    try await self.getPostureTemplate(request: request, options: .init())
  }

  public func getPostureTemplate(
    request: GetPostureTemplateRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecuritypostureV1.PostureTemplate {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getPostureTemplate(
    name: Swift.String,
  ) async throws -> GoogleCloudSecuritypostureV1.PostureTemplate {
    let request = GetPostureTemplateRequest().with {
      $0.name = name
    }
    return try await self.getPostureTemplate(request: request)
  }

  public func listLocations(request: GoogleCloudLocation.ListLocationsRequest) async throws
    -> GoogleCloudLocation.ListLocationsResponse
  {
    try await self.listLocations(request: request, options: .init())
  }

  public func listLocations(
    request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudLocation.ListLocationsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listLocations(
    byItem: GoogleCloudLocation.ListLocationsRequest
  ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error> {
    try self.listLocations(byItem: byItem, options: .init())
  }

  public func listLocations(
    byItem: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudLocation.ListLocationsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func getLocation(request: GoogleCloudLocation.GetLocationRequest) async throws
    -> GoogleCloudLocation.Location
  {
    try await self.getLocation(request: request, options: .init())
  }

  public func getLocation(
    request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudLocation.Location {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listOperations(request: GoogleLongRunning.ListOperationsRequest) async throws
    -> GoogleLongRunning.ListOperationsResponse
  {
    try await self.listOperations(request: request, options: .init())
  }

  public func listOperations(
    request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.ListOperationsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listOperations(
    byItem: GoogleLongRunning.ListOperationsRequest
  ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
    try self.listOperations(byItem: byItem, options: .init())
  }

  public func listOperations(
    byItem: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleLongRunning.ListOperationsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func listOperations(
    name: Swift.String,
    filter: Swift.String,
  ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
    let request = GoogleLongRunning.ListOperationsRequest().with {
      $0.name = name
      $0.filter = filter
    }
    return try self.listOperations(byItem: request)
  }

  public func getOperation(request: GoogleLongRunning.GetOperationRequest) async throws
    -> GoogleLongRunning.Operation
  {
    try await self.getOperation(request: request, options: .init())
  }

  public func getOperation(
    request: GoogleLongRunning.GetOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getOperation(
    name: Swift.String,
  ) async throws -> GoogleLongRunning.Operation {
    let request = GoogleLongRunning.GetOperationRequest().with {
      $0.name = name
    }
    return try await self.getOperation(request: request)
  }

  public func deleteOperation(request: GoogleLongRunning.DeleteOperationRequest) async throws {
    try await self.deleteOperation(request: request, options: .init())
  }

  public func deleteOperation(
    request: GoogleLongRunning.DeleteOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func deleteOperation(
    name: Swift.String,
  ) async throws {
    let request = GoogleLongRunning.DeleteOperationRequest().with {
      $0.name = name
    }
    try await self.deleteOperation(request: request)
  }

  public func cancelOperation(request: GoogleLongRunning.CancelOperationRequest) async throws {
    try await self.cancelOperation(request: request, options: .init())
  }

  public func cancelOperation(
    request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func cancelOperation(
    name: Swift.String,
  ) async throws {
    let request = GoogleLongRunning.CancelOperationRequest().with {
      $0.name = name
    }
    try await self.cancelOperation(request: request)
  }
}
