Skip to content

Commit

Permalink
Update SDK (Azure#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
ninpan-ms authored Aug 16, 2021
1 parent f1f61c4 commit 486fde7
Show file tree
Hide file tree
Showing 6 changed files with 220 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from .operations import ConfigServersOperations
from .operations import ConfigurationServicesOperations
from .operations import ServiceRegistriesOperations
from .operations import ServiceOperations
from .operations import BuildServiceOperations
from .operations import BuildpacksBindingOperations
from .operations import MonitoringSettingsOperations
Expand All @@ -49,8 +48,6 @@ class AppPlatformManagementClient(object):
:vartype configuration_services: azure.mgmt.appplatform.v2022_05_01_preview.operations.ConfigurationServicesOperations
:ivar service_registries: ServiceRegistriesOperations operations
:vartype service_registries: azure.mgmt.appplatform.v2022_05_01_preview.operations.ServiceRegistriesOperations
:ivar service: ServiceOperations operations
:vartype service: azure.mgmt.appplatform.v2022_05_01_preview.operations.ServiceOperations
:ivar build_service: BuildServiceOperations operations
:vartype build_service: azure.mgmt.appplatform.v2022_05_01_preview.operations.BuildServiceOperations
:ivar buildpacks_binding: BuildpacksBindingOperations operations
Expand Down Expand Up @@ -107,8 +104,6 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize)
self.service_registries = ServiceRegistriesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.service = ServiceOperations(
self._client, self._config, self._serialize, self._deserialize)
self.build_service = BuildServiceOperations(
self._client, self._config, self._serialize, self._deserialize)
self.buildpacks_binding = BuildpacksBindingOperations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from .operations import ConfigServersOperations
from .operations import ConfigurationServicesOperations
from .operations import ServiceRegistriesOperations
from .operations import ServiceOperations
from .operations import BuildServiceOperations
from .operations import BuildpacksBindingOperations
from .operations import MonitoringSettingsOperations
Expand All @@ -47,8 +46,6 @@ class AppPlatformManagementClient(object):
:vartype configuration_services: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ConfigurationServicesOperations
:ivar service_registries: ServiceRegistriesOperations operations
:vartype service_registries: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ServiceRegistriesOperations
:ivar service: ServiceOperations operations
:vartype service: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ServiceOperations
:ivar build_service: BuildServiceOperations operations
:vartype build_service: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BuildServiceOperations
:ivar buildpacks_binding: BuildpacksBindingOperations operations
Expand Down Expand Up @@ -104,8 +101,6 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize)
self.service_registries = ServiceRegistriesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.service = ServiceOperations(
self._client, self._config, self._serialize, self._deserialize)
self.build_service = BuildServiceOperations(
self._client, self._config, self._serialize, self._deserialize)
self.buildpacks_binding = BuildpacksBindingOperations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from ._config_servers_operations import ConfigServersOperations
from ._configuration_services_operations import ConfigurationServicesOperations
from ._service_registries_operations import ServiceRegistriesOperations
from ._service_operations import ServiceOperations
from ._build_service_operations import BuildServiceOperations
from ._buildpacks_binding_operations import BuildpacksBindingOperations
from ._monitoring_settings_operations import MonitoringSettingsOperations
Expand All @@ -28,7 +27,6 @@
'ConfigServersOperations',
'ConfigurationServicesOperations',
'ServiceRegistriesOperations',
'ServiceOperations',
'BuildServiceOperations',
'BuildpacksBindingOperations',
'MonitoringSettingsOperations',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,112 @@ def get_long_running_output(pipeline_response):
else:
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/default'} # type: ignore

async def _delete_initial(
self,
resource_group_name: str,
service_name: str,
**kwargs: Any
) -> None:
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2022-05-01-preview"
accept = "application/json"

# Construct URL
url = self._delete_initial.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'serviceName': self._serialize.url("service_name", service_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')

# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')

request = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

if cls:
return cls(pipeline_response, None, {})

_delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/default'} # type: ignore

async def begin_delete(
self,
resource_group_name: str,
service_name: str,
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Disable the default Service Registry.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal.
:type resource_group_name: str
:param service_name: The name of the Service resource.
:type service_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling.
Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType[None]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
service_name=service_name,
cls=lambda x,y,z: x,
**kwargs
)

kwargs.pop('error_map', None)
kwargs.pop('content_type', None)

def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})

path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'serviceName': self._serialize.url("service_name", service_name, 'str'),
}

if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/default'} # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from ._config_servers_operations import ConfigServersOperations
from ._configuration_services_operations import ConfigurationServicesOperations
from ._service_registries_operations import ServiceRegistriesOperations
from ._service_operations import ServiceOperations
from ._build_service_operations import BuildServiceOperations
from ._buildpacks_binding_operations import BuildpacksBindingOperations
from ._monitoring_settings_operations import MonitoringSettingsOperations
Expand All @@ -28,7 +27,6 @@
'ConfigServersOperations',
'ConfigurationServicesOperations',
'ServiceRegistriesOperations',
'ServiceOperations',
'BuildServiceOperations',
'BuildpacksBindingOperations',
'MonitoringSettingsOperations',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,114 @@ def get_long_running_output(pipeline_response):
else:
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/default'} # type: ignore

def _delete_initial(
self,
resource_group_name, # type: str
service_name, # type: str
**kwargs # type: Any
):
# type: (...) -> None
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2022-05-01-preview"
accept = "application/json"

# Construct URL
url = self._delete_initial.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'serviceName': self._serialize.url("service_name", service_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')

# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')

request = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

if cls:
return cls(pipeline_response, None, {})

_delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/default'} # type: ignore

def begin_delete(
self,
resource_group_name, # type: str
service_name, # type: str
**kwargs # type: Any
):
# type: (...) -> LROPoller[None]
"""Disable the default Service Registry.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal.
:type resource_group_name: str
:param service_name: The name of the Service resource.
:type service_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling.
Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType[None]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
service_name=service_name,
cls=lambda x,y,z: x,
**kwargs
)

kwargs.pop('error_map', None)
kwargs.pop('content_type', None)

def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})

path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'serviceName': self._serialize.url("service_name", service_name, 'str'),
}

if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = NoPolling()
else: polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/default'} # type: ignore

0 comments on commit 486fde7

Please sign in to comment.