2222
2323from ... import models as _models
2424from ..._vendor import _convert_request
25- from ...operations ._arc_settings_operations import build_create_request , build_delete_request_initial , build_get_request , build_list_by_cluster_request
25+ from ...operations ._arc_settings_operations import build_create_identity_request_initial , build_create_request , build_delete_request_initial , build_generate_password_request , build_get_request , build_list_by_cluster_request
2626T = TypeVar ('T' )
2727ClsType = Optional [Callable [[PipelineResponse [HttpRequest , AsyncHttpResponse ], T , Dict [str , Any ]], Any ]]
2828
@@ -33,7 +33,7 @@ class ArcSettingsOperations:
3333 instantiates it for you and attaches it as an attribute.
3434
3535 :ivar models: Alias to model classes used in this operation group.
36- :type models: ~azure_stack_hci_client .models
36+ :type models: ~azure.mgmt.azurestackhci .models
3737 :param client: Client for service requests.
3838 :param config: Configuration of service client.
3939 :param serializer: An object model serializer.
@@ -63,7 +63,8 @@ def list_by_cluster(
6363 :type cluster_name: str
6464 :keyword callable cls: A custom type or function that will be passed the direct response
6565 :return: An iterator like instance of either ArcSettingList or the result of cls(response)
66- :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_stack_hci_client.models.ArcSettingList]
66+ :rtype:
67+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.ArcSettingList]
6768 :raises: ~azure.core.exceptions.HttpResponseError
6869 """
6970 cls = kwargs .pop ('cls' , None ) # type: ClsType["_models.ArcSettingList"]
@@ -141,7 +142,7 @@ async def get(
141142 :type arc_setting_name: str
142143 :keyword callable cls: A custom type or function that will be passed the direct response
143144 :return: ArcSetting, or the result of cls(response)
144- :rtype: ~azure_stack_hci_client .models.ArcSetting
145+ :rtype: ~azure.mgmt.azurestackhci .models.ArcSetting
145146 :raises: ~azure.core.exceptions.HttpResponseError
146147 """
147148 cls = kwargs .pop ('cls' , None ) # type: ClsType["_models.ArcSetting"]
@@ -198,10 +199,10 @@ async def create(
198199 information.
199200 :type arc_setting_name: str
200201 :param arc_setting: Parameters supplied to the Create ArcSetting resource for this HCI cluster.
201- :type arc_setting: ~azure_stack_hci_client .models.ArcSetting
202+ :type arc_setting: ~azure.mgmt.azurestackhci .models.ArcSetting
202203 :keyword callable cls: A custom type or function that will be passed the direct response
203204 :return: ArcSetting, or the result of cls(response)
204- :rtype: ~azure_stack_hci_client .models.ArcSetting
205+ :rtype: ~azure.mgmt.azurestackhci .models.ArcSetting
205206 :raises: ~azure.core.exceptions.HttpResponseError
206207 """
207208 cls = kwargs .pop ('cls' , None ) # type: ClsType["_models.ArcSetting"]
@@ -346,3 +347,174 @@ def get_long_running_output(pipeline_response):
346347 return AsyncLROPoller (self ._client , raw_result , get_long_running_output , polling_method )
347348
348349 begin_delete .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}' } # type: ignore
350+
351+ @distributed_trace_async
352+ async def generate_password (
353+ self ,
354+ resource_group_name : str ,
355+ cluster_name : str ,
356+ arc_setting_name : str ,
357+ ** kwargs : Any
358+ ) -> "_models.PasswordCredential" :
359+ """Generate password for arc settings.
360+
361+ :param resource_group_name: The name of the resource group. The name is case insensitive.
362+ :type resource_group_name: str
363+ :param cluster_name: The name of the cluster.
364+ :type cluster_name: str
365+ :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting
366+ information.
367+ :type arc_setting_name: str
368+ :keyword callable cls: A custom type or function that will be passed the direct response
369+ :return: PasswordCredential, or the result of cls(response)
370+ :rtype: ~azure.mgmt.azurestackhci.models.PasswordCredential
371+ :raises: ~azure.core.exceptions.HttpResponseError
372+ """
373+ cls = kwargs .pop ('cls' , None ) # type: ClsType["_models.PasswordCredential"]
374+ error_map = {
375+ 401 : ClientAuthenticationError , 404 : ResourceNotFoundError , 409 : ResourceExistsError
376+ }
377+ error_map .update (kwargs .pop ('error_map' , {}))
378+
379+
380+ request = build_generate_password_request (
381+ subscription_id = self ._config .subscription_id ,
382+ resource_group_name = resource_group_name ,
383+ cluster_name = cluster_name ,
384+ arc_setting_name = arc_setting_name ,
385+ template_url = self .generate_password .metadata ['url' ],
386+ )
387+ request = _convert_request (request )
388+ request .url = self ._client .format_url (request .url )
389+
390+ pipeline_response = await self ._client ._pipeline .run (request , stream = False , ** kwargs )
391+ response = pipeline_response .http_response
392+
393+ if response .status_code not in [200 ]:
394+ map_error (status_code = response .status_code , response = response , error_map = error_map )
395+ error = self ._deserialize .failsafe_deserialize (_models .ErrorResponse , pipeline_response )
396+ raise HttpResponseError (response = response , model = error , error_format = ARMErrorFormat )
397+
398+ deserialized = self ._deserialize ('PasswordCredential' , pipeline_response )
399+
400+ if cls :
401+ return cls (pipeline_response , deserialized , {})
402+
403+ return deserialized
404+
405+ generate_password .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/generatePassword' } # type: ignore
406+
407+
408+ async def _create_identity_initial (
409+ self ,
410+ resource_group_name : str ,
411+ cluster_name : str ,
412+ arc_setting_name : str ,
413+ ** kwargs : Any
414+ ) -> Optional ["_models.ArcIdentityResponse" ]:
415+ cls = kwargs .pop ('cls' , None ) # type: ClsType[Optional["_models.ArcIdentityResponse"]]
416+ error_map = {
417+ 401 : ClientAuthenticationError , 404 : ResourceNotFoundError , 409 : ResourceExistsError
418+ }
419+ error_map .update (kwargs .pop ('error_map' , {}))
420+
421+
422+ request = build_create_identity_request_initial (
423+ subscription_id = self ._config .subscription_id ,
424+ resource_group_name = resource_group_name ,
425+ cluster_name = cluster_name ,
426+ arc_setting_name = arc_setting_name ,
427+ template_url = self ._create_identity_initial .metadata ['url' ],
428+ )
429+ request = _convert_request (request )
430+ request .url = self ._client .format_url (request .url )
431+
432+ pipeline_response = await self ._client ._pipeline .run (request , stream = False , ** kwargs )
433+ response = pipeline_response .http_response
434+
435+ if response .status_code not in [200 , 202 ]:
436+ map_error (status_code = response .status_code , response = response , error_map = error_map )
437+ raise HttpResponseError (response = response , error_format = ARMErrorFormat )
438+
439+ deserialized = None
440+ if response .status_code == 200 :
441+ deserialized = self ._deserialize ('ArcIdentityResponse' , pipeline_response )
442+
443+ if cls :
444+ return cls (pipeline_response , deserialized , {})
445+
446+ return deserialized
447+
448+ _create_identity_initial .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity' } # type: ignore
449+
450+
451+ @distributed_trace_async
452+ async def begin_create_identity (
453+ self ,
454+ resource_group_name : str ,
455+ cluster_name : str ,
456+ arc_setting_name : str ,
457+ ** kwargs : Any
458+ ) -> AsyncLROPoller ["_models.ArcIdentityResponse" ]:
459+ """Create Aad identity for arc settings.
460+
461+ :param resource_group_name: The name of the resource group. The name is case insensitive.
462+ :type resource_group_name: str
463+ :param cluster_name: The name of the cluster.
464+ :type cluster_name: str
465+ :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting
466+ information.
467+ :type arc_setting_name: str
468+ :keyword callable cls: A custom type or function that will be passed the direct response
469+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
470+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
471+ this operation to not poll, or pass in your own initialized polling object for a personal
472+ polling strategy.
473+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
474+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
475+ Retry-After header is present.
476+ :return: An instance of AsyncLROPoller that returns either ArcIdentityResponse or the result of
477+ cls(response)
478+ :rtype:
479+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.ArcIdentityResponse]
480+ :raises: ~azure.core.exceptions.HttpResponseError
481+ """
482+ polling = kwargs .pop ('polling' , True ) # type: Union[bool, azure.core.polling.AsyncPollingMethod]
483+ cls = kwargs .pop ('cls' , None ) # type: ClsType["_models.ArcIdentityResponse"]
484+ lro_delay = kwargs .pop (
485+ 'polling_interval' ,
486+ self ._config .polling_interval
487+ )
488+ cont_token = kwargs .pop ('continuation_token' , None ) # type: Optional[str]
489+ if cont_token is None :
490+ raw_result = await self ._create_identity_initial (
491+ resource_group_name = resource_group_name ,
492+ cluster_name = cluster_name ,
493+ arc_setting_name = arc_setting_name ,
494+ cls = lambda x ,y ,z : x ,
495+ ** kwargs
496+ )
497+ kwargs .pop ('error_map' , None )
498+
499+ def get_long_running_output (pipeline_response ):
500+ response = pipeline_response .http_response
501+ deserialized = self ._deserialize ('ArcIdentityResponse' , pipeline_response )
502+ if cls :
503+ return cls (pipeline_response , deserialized , {})
504+ return deserialized
505+
506+
507+ if polling is True : polling_method = AsyncARMPolling (lro_delay , lro_options = {'final-state-via' : 'azure-async-operation' }, ** kwargs )
508+ elif polling is False : polling_method = AsyncNoPolling ()
509+ else : polling_method = polling
510+ if cont_token :
511+ return AsyncLROPoller .from_continuation_token (
512+ polling_method = polling_method ,
513+ continuation_token = cont_token ,
514+ client = self ._client ,
515+ deserialization_callback = get_long_running_output
516+ )
517+ else :
518+ return AsyncLROPoller (self ._client , raw_result , get_long_running_output , polling_method )
519+
520+ begin_create_identity .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity' } # type: ignore
0 commit comments