"""Generated client library for serviceusage version v2beta."""
# NOTE: This file is autogenerated and should not be edited by hand.

from __future__ import absolute_import

from apitools.base.py import base_api
from googlecloudsdk.generated_clients.apis.serviceusage.v2beta import serviceusage_v2beta_messages as messages


class ServiceusageV2beta(base_api.BaseApiClient):
  """Generated client library for service serviceusage version v2beta."""

  MESSAGES_MODULE = messages
  BASE_URL = 'https://serviceusage.googleapis.com/'
  MTLS_BASE_URL = 'https://serviceusage.mtls.googleapis.com/'

  _PACKAGE = 'serviceusage'
  _SCOPES = ['https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/cloud-platform.read-only', 'https://www.googleapis.com/auth/service.management']
  _VERSION = 'v2beta'
  _CLIENT_ID = 'CLIENT_ID'
  _CLIENT_SECRET = 'CLIENT_SECRET'
  _USER_AGENT = 'google-cloud-sdk'
  _CLIENT_CLASS_NAME = 'ServiceusageV2beta'
  _URL_VERSION = 'v2beta'
  _API_KEY = None

  def __init__(self, url='', credentials=None,
               get_credentials=True, http=None, model=None,
               log_request=False, log_response=False,
               credentials_args=None, default_global_params=None,
               additional_http_headers=None, response_encoding=None):
    """Create a new serviceusage handle."""
    url = url or self.BASE_URL
    super(ServiceusageV2beta, self).__init__(
        url, credentials=credentials,
        get_credentials=get_credentials, http=http, model=model,
        log_request=log_request, log_response=log_response,
        credentials_args=credentials_args,
        default_global_params=default_global_params,
        additional_http_headers=additional_http_headers,
        response_encoding=response_encoding)
    self.categories_categoryServices = self.CategoriesCategoryServicesService(self)
    self.categories = self.CategoriesService(self)
    self.consumerPolicies = self.ConsumerPoliciesService(self)
    self.operations = self.OperationsService(self)
    self.services_apis = self.ServicesApisService(self)
    self.services_groups_expandedMembers = self.ServicesGroupsExpandedMembersService(self)
    self.services_groups_members = self.ServicesGroupsMembersService(self)
    self.services_groups = self.ServicesGroupsService(self)
    self.services = self.ServicesService(self)
    self.v2beta = self.V2betaService(self)

  class CategoriesCategoryServicesService(base_api.BaseApiService):
    """Service class for the categories_categoryServices resource."""

    _NAME = 'categories_categoryServices'

    def __init__(self, client):
      super(ServiceusageV2beta.CategoriesCategoryServicesService, self).__init__(client)
      self._upload_configs = {
          }

    def List(self, request, global_params=None):
      r"""List the services that belong to a given category. The supported categories are: `categories/google` and `categories/partner`.

      Args:
        request: (ServiceusageCategoriesCategoryServicesListRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (ListCategoryServicesResponse) The response message.
      """
      config = self.GetMethodConfig('List')
      return self._RunMethod(
          config, request, global_params=global_params)

    List.method_config = lambda: base_api.ApiMethodInfo(
        flat_path='v2beta/{v2betaId}/{v2betaId1}/categories/{categoriesId}/categoryServices',
        http_method='GET',
        method_id='serviceusage.categories.categoryServices.list',
        ordered_params=['parent'],
        path_params=['parent'],
        query_params=['pageSize', 'pageToken'],
        relative_path='v2beta/{+parent}/categoryServices',
        request_field='',
        request_type_name='ServiceusageCategoriesCategoryServicesListRequest',
        response_type_name='ListCategoryServicesResponse',
        supports_download=False,
    )

  class CategoriesService(base_api.BaseApiService):
    """Service class for the categories resource."""

    _NAME = 'categories'

    def __init__(self, client):
      super(ServiceusageV2beta.CategoriesService, self).__init__(client)
      self._upload_configs = {
          }

  class ConsumerPoliciesService(base_api.BaseApiService):
    """Service class for the consumerPolicies resource."""

    _NAME = 'consumerPolicies'

    def __init__(self, client):
      super(ServiceusageV2beta.ConsumerPoliciesService, self).__init__(client)
      self._upload_configs = {
          }

    def Analyze(self, request, global_params=None):
      r"""Analyze a consumer policy change without kicking off the actual update. The consumer policy is subject to change before the actual update takes place.

      Args:
        request: (ServiceusageConsumerPoliciesAnalyzeRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (Operation) The response message.
      """
      config = self.GetMethodConfig('Analyze')
      return self._RunMethod(
          config, request, global_params=global_params)

    Analyze.method_config = lambda: base_api.ApiMethodInfo(
        flat_path='v2beta/{v2betaId}/{v2betaId1}/consumerPolicies/{consumerPoliciesId}:analyze',
        http_method='POST',
        method_id='serviceusage.consumerPolicies.analyze',
        ordered_params=['name'],
        path_params=['name'],
        query_params=[],
        relative_path='v2beta/{+name}:analyze',
        request_field='analyzeConsumerPolicyRequest',
        request_type_name='ServiceusageConsumerPoliciesAnalyzeRequest',
        response_type_name='Operation',
        supports_download=False,
    )

    def Get(self, request, global_params=None):
      r"""Get the consumer policy of a resource.

      Args:
        request: (ServiceusageConsumerPoliciesGetRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (GoogleApiServiceusageV2betaConsumerPolicy) The response message.
      """
      config = self.GetMethodConfig('Get')
      return self._RunMethod(
          config, request, global_params=global_params)

    Get.method_config = lambda: base_api.ApiMethodInfo(
        flat_path='v2beta/{v2betaId}/{v2betaId1}/consumerPolicies/{consumerPoliciesId}',
        http_method='GET',
        method_id='serviceusage.consumerPolicies.get',
        ordered_params=['name'],
        path_params=['name'],
        query_params=[],
        relative_path='v2beta/{+name}',
        request_field='',
        request_type_name='ServiceusageConsumerPoliciesGetRequest',
        response_type_name='GoogleApiServiceusageV2betaConsumerPolicy',
        supports_download=False,
    )

    def Patch(self, request, global_params=None):
      r"""Update the consumer policy of a resource.

      Args:
        request: (ServiceusageConsumerPoliciesPatchRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (Operation) The response message.
      """
      config = self.GetMethodConfig('Patch')
      return self._RunMethod(
          config, request, global_params=global_params)

    Patch.method_config = lambda: base_api.ApiMethodInfo(
        flat_path='v2beta/{v2betaId}/{v2betaId1}/consumerPolicies/{consumerPoliciesId}',
        http_method='PATCH',
        method_id='serviceusage.consumerPolicies.patch',
        ordered_params=['name'],
        path_params=['name'],
        query_params=['force', 'validateOnly'],
        relative_path='v2beta/{+name}',
        request_field='googleApiServiceusageV2betaConsumerPolicy',
        request_type_name='ServiceusageConsumerPoliciesPatchRequest',
        response_type_name='Operation',
        supports_download=False,
    )

  class OperationsService(base_api.BaseApiService):
    """Service class for the operations resource."""

    _NAME = 'operations'

    def __init__(self, client):
      super(ServiceusageV2beta.OperationsService, self).__init__(client)
      self._upload_configs = {
          }

    def Get(self, request, global_params=None):
      r"""Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

      Args:
        request: (ServiceusageOperationsGetRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (Operation) The response message.
      """
      config = self.GetMethodConfig('Get')
      return self._RunMethod(
          config, request, global_params=global_params)

    Get.method_config = lambda: base_api.ApiMethodInfo(
        flat_path='v2beta/operations/{operationsId}',
        http_method='GET',
        method_id='serviceusage.operations.get',
        ordered_params=['name'],
        path_params=['name'],
        query_params=[],
        relative_path='v2beta/{+name}',
        request_field='',
        request_type_name='ServiceusageOperationsGetRequest',
        response_type_name='Operation',
        supports_download=False,
    )

    def List(self, request, global_params=None):
      r"""Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.

      Args:
        request: (ServiceusageOperationsListRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (ListOperationsResponse) The response message.
      """
      config = self.GetMethodConfig('List')
      return self._RunMethod(
          config, request, global_params=global_params)

    List.method_config = lambda: base_api.ApiMethodInfo(
        http_method='GET',
        method_id='serviceusage.operations.list',
        ordered_params=[],
        path_params=[],
        query_params=['filter', 'name', 'pageSize', 'pageToken'],
        relative_path='v2beta/operations',
        request_field='',
        request_type_name='ServiceusageOperationsListRequest',
        response_type_name='ListOperationsResponse',
        supports_download=False,
    )

  class ServicesApisService(base_api.BaseApiService):
    """Service class for the services_apis resource."""

    _NAME = 'services_apis'

    def __init__(self, client):
      super(ServiceusageV2beta.ServicesApisService, self).__init__(client)
      self._upload_configs = {
          }

    def List(self, request, global_params=None):
      r"""List APIs exposed by the given service.

      Args:
        request: (ServiceusageServicesApisListRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (ListServiceApisResponse) The response message.
      """
      config = self.GetMethodConfig('List')
      return self._RunMethod(
          config, request, global_params=global_params)

    List.method_config = lambda: base_api.ApiMethodInfo(
        flat_path='v2beta/{v2betaId}/{v2betaId1}/services/{servicesId}/apis',
        http_method='GET',
        method_id='serviceusage.services.apis.list',
        ordered_params=['parent'],
        path_params=['parent'],
        query_params=['pageSize', 'pageToken'],
        relative_path='v2beta/{+parent}/apis',
        request_field='',
        request_type_name='ServiceusageServicesApisListRequest',
        response_type_name='ListServiceApisResponse',
        supports_download=False,
    )

  class ServicesGroupsExpandedMembersService(base_api.BaseApiService):
    """Service class for the services_groups_expandedMembers resource."""

    _NAME = 'services_groups_expandedMembers'

    def __init__(self, client):
      super(ServiceusageV2beta.ServicesGroupsExpandedMembersService, self).__init__(client)
      self._upload_configs = {
          }

    def List(self, request, global_params=None):
      r"""List the expanded members that belong to a given service group or transitively to any of the groups that are members of the service group. The expanded members are always services. The service group is defined by service producers. It throws NOT_FOUND if the given service group is not defined.

      Args:
        request: (ServiceusageServicesGroupsExpandedMembersListRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (ListExpandedMembersResponse) The response message.
      """
      config = self.GetMethodConfig('List')
      return self._RunMethod(
          config, request, global_params=global_params)

    List.method_config = lambda: base_api.ApiMethodInfo(
        flat_path='v2beta/{v2betaId}/{v2betaId1}/services/{servicesId}/groups/{groupsId}/expandedMembers',
        http_method='GET',
        method_id='serviceusage.services.groups.expandedMembers.list',
        ordered_params=['parent'],
        path_params=['parent'],
        query_params=['pageSize', 'pageToken'],
        relative_path='v2beta/{+parent}/expandedMembers',
        request_field='',
        request_type_name='ServiceusageServicesGroupsExpandedMembersListRequest',
        response_type_name='ListExpandedMembersResponse',
        supports_download=False,
    )

  class ServicesGroupsMembersService(base_api.BaseApiService):
    """Service class for the services_groups_members resource."""

    _NAME = 'services_groups_members'

    def __init__(self, client):
      super(ServiceusageV2beta.ServicesGroupsMembersService, self).__init__(client)
      self._upload_configs = {
          }

    def List(self, request, global_params=None):
      r"""List members for the given service group. The service group is a producer defined service group.

      Args:
        request: (ServiceusageServicesGroupsMembersListRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (ListGroupMembersResponse) The response message.
      """
      config = self.GetMethodConfig('List')
      return self._RunMethod(
          config, request, global_params=global_params)

    List.method_config = lambda: base_api.ApiMethodInfo(
        flat_path='v2beta/{v2betaId}/{v2betaId1}/services/{servicesId}/groups/{groupsId}/members',
        http_method='GET',
        method_id='serviceusage.services.groups.members.list',
        ordered_params=['parent'],
        path_params=['parent'],
        query_params=['pageSize', 'pageToken', 'view'],
        relative_path='v2beta/{+parent}/members',
        request_field='',
        request_type_name='ServiceusageServicesGroupsMembersListRequest',
        response_type_name='ListGroupMembersResponse',
        supports_download=False,
    )

  class ServicesGroupsService(base_api.BaseApiService):
    """Service class for the services_groups resource."""

    _NAME = 'services_groups'

    def __init__(self, client):
      super(ServiceusageV2beta.ServicesGroupsService, self).__init__(client)
      self._upload_configs = {
          }

    def List(self, request, global_params=None):
      r"""List service groups owned by the given service.

      Args:
        request: (ServiceusageServicesGroupsListRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (ListServiceGroupsResponse) The response message.
      """
      config = self.GetMethodConfig('List')
      return self._RunMethod(
          config, request, global_params=global_params)

    List.method_config = lambda: base_api.ApiMethodInfo(
        flat_path='v2beta/{v2betaId}/{v2betaId1}/services/{servicesId}/groups',
        http_method='GET',
        method_id='serviceusage.services.groups.list',
        ordered_params=['parent'],
        path_params=['parent'],
        query_params=['pageSize', 'pageToken', 'view'],
        relative_path='v2beta/{+parent}/groups',
        request_field='',
        request_type_name='ServiceusageServicesGroupsListRequest',
        response_type_name='ListServiceGroupsResponse',
        supports_download=False,
    )

  class ServicesService(base_api.BaseApiService):
    """Service class for the services resource."""

    _NAME = 'services'

    def __init__(self, client):
      super(ServiceusageV2beta.ServicesService, self).__init__(client)
      self._upload_configs = {
          }

    def BatchGet(self, request, global_params=None):
      r"""Get the details of a collection of services.

      Args:
        request: (ServiceusageServicesBatchGetRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (BatchGetServicesResponse) The response message.
      """
      config = self.GetMethodConfig('BatchGet')
      return self._RunMethod(
          config, request, global_params=global_params)

    BatchGet.method_config = lambda: base_api.ApiMethodInfo(
        flat_path='v2beta/{v2betaId}/{v2betaId1}/services:batchGet',
        http_method='GET',
        method_id='serviceusage.services.batchGet',
        ordered_params=['parent'],
        path_params=['parent'],
        query_params=['services', 'view'],
        relative_path='v2beta/{+parent}/services:batchGet',
        request_field='',
        request_type_name='ServiceusageServicesBatchGetRequest',
        response_type_name='BatchGetServicesResponse',
        supports_download=False,
    )

    def Get(self, request, global_params=None):
      r"""Get the details of a service.

      Args:
        request: (ServiceusageServicesGetRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (ServiceState) The response message.
      """
      config = self.GetMethodConfig('Get')
      return self._RunMethod(
          config, request, global_params=global_params)

    Get.method_config = lambda: base_api.ApiMethodInfo(
        flat_path='v2beta/{v2betaId}/{v2betaId1}/services/{servicesId}',
        http_method='GET',
        method_id='serviceusage.services.get',
        ordered_params=['name'],
        path_params=['name'],
        query_params=['view'],
        relative_path='v2beta/{+name}',
        request_field='',
        request_type_name='ServiceusageServicesGetRequest',
        response_type_name='ServiceState',
        supports_download=False,
    )

  class V2betaService(base_api.BaseApiService):
    """Service class for the v2beta resource."""

    _NAME = 'v2beta'

    def __init__(self, client):
      super(ServiceusageV2beta.V2betaService, self).__init__(client)
      self._upload_configs = {
          }

    def GetEffectivePolicy(self, request, global_params=None):
      r"""Get effective consumer policy for a resource, which contains enable rule information of consumer policies from the resource hierarchy.

      Args:
        request: (ServiceusageGetEffectivePolicyRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (EffectivePolicy) The response message.
      """
      config = self.GetMethodConfig('GetEffectivePolicy')
      return self._RunMethod(
          config, request, global_params=global_params)

    GetEffectivePolicy.method_config = lambda: base_api.ApiMethodInfo(
        flat_path='v2beta/{v2betaId}/{v2betaId1}/effectivePolicy',
        http_method='GET',
        method_id='serviceusage.getEffectivePolicy',
        ordered_params=['name'],
        path_params=['name'],
        query_params=['view'],
        relative_path='v2beta/{+name}',
        request_field='',
        request_type_name='ServiceusageGetEffectivePolicyRequest',
        response_type_name='EffectivePolicy',
        supports_download=False,
    )

    def TestEnabled(self, request, global_params=None):
      r"""Tests a value against the result of merging consumer policies in the resource hierarchy. This operation is designed to be used for building policy-aware UIs and command-line tools, not for access checking.

      Args:
        request: (ServiceusageTestEnabledRequest) input message
        global_params: (StandardQueryParameters, default: None) global arguments
      Returns:
        (State) The response message.
      """
      config = self.GetMethodConfig('TestEnabled')
      return self._RunMethod(
          config, request, global_params=global_params)

    TestEnabled.method_config = lambda: base_api.ApiMethodInfo(
        flat_path='v2beta/{v2betaId}/{v2betaId1}:testEnabled',
        http_method='POST',
        method_id='serviceusage.testEnabled',
        ordered_params=['name'],
        path_params=['name'],
        query_params=[],
        relative_path='v2beta/{+name}:testEnabled',
        request_field='testEnabledRequest',
        request_type_name='ServiceusageTestEnabledRequest',
        response_type_name='State',
        supports_download=False,
    )
