async def begin_update(
            self, resource_group_name: str, gallery_name: str,
            gallery_image_name: str,
            gallery_image: "_models.GalleryImageUpdate",
            **kwargs: Any) -> AsyncLROPoller["_models.GalleryImage"]:
        """Update a gallery Image Definition.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to
         be updated.
        :type gallery_name: str
        :param gallery_image_name: The name of the gallery Image Definition to be updated. The allowed
         characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The
         maximum length is 80 characters.
        :type gallery_image_name: str
        :param gallery_image: Parameters supplied to the update gallery image operation.
        :type gallery_image: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageUpdate
        :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 GalleryImage or the result of
         cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImage]
        :raises: ~azure.core.exceptions.HttpResponseError
        """
        content_type = kwargs.pop('content_type',
                                  "application/json")  # type: Optional[str]
        polling = kwargs.pop(
            'polling',
            True)  # type: Union[bool, azure.core.polling.AsyncPollingMethod]
        cls = kwargs.pop('cls', None)  # type: ClsType["_models.GalleryImage"]
        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._update_initial(
                resource_group_name=resource_group_name,
                gallery_name=gallery_name,
                gallery_image_name=gallery_image_name,
                gallery_image=gallery_image,
                content_type=content_type,
                cls=lambda x, y, z: x,
                **kwargs)
        kwargs.pop('error_map', None)

        def get_long_running_output(pipeline_response):
            response = pipeline_response.http_response
            deserialized = self._deserialize('GalleryImage', pipeline_response)
            if cls:
                return cls(pipeline_response, deserialized, {})
            return deserialized

        if polling is True:
            polling_method = AsyncARMPolling(lro_delay, **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)
    async def begin_create_or_update(
        self,
        resource_group_name: str,
        virtual_router_name: str,
        parameters: "_models.VirtualRouter",
        **kwargs: Any
    ) -> AsyncLROPoller["_models.VirtualRouter"]:
        """Creates or updates the specified Virtual Router.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param virtual_router_name: The name of the Virtual Router.
        :type virtual_router_name: str
        :param parameters: Parameters supplied to the create or update Virtual Router.
        :type parameters: ~azure.mgmt.network.v2020_06_01.models.VirtualRouter
        :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 VirtualRouter or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2020_06_01.models.VirtualRouter]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop('cls', None)  # type: ClsType["_models.VirtualRouter"]
        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._create_or_update_initial(
                resource_group_name=resource_group_name,
                virtual_router_name=virtual_router_name,
                parameters=parameters,
                cls=lambda x,y,z: x,
                **kwargs
            )

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('VirtualRouter', pipeline_response)

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

        path_format_arguments = {
            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
            'virtualRouterName': self._serialize.url("virtual_router_name", virtual_router_name, 'str'),
            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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)
    async def begin_start_os_upgrade(
        self,
        resource_group_name: str,
        vm_scale_set_name: str,
        **kwargs
    ) -> AsyncLROPoller[None]:
        """Starts a rolling upgrade to move all virtual machine scale set instances to the latest
        available Platform Image OS version. Instances which are already running the latest available
        OS version are not affected.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param vm_scale_set_name: The name of the VM scale set.
        :type vm_scale_set_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: Pass in True if you'd like the AsyncARMPolling polling method,
         False for no polling, or 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._start_os_upgrade_initial(
                resource_group_name=resource_group_name,
                vm_scale_set_name=vm_scale_set_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 = {
            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
            'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'),
            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
        }

        if polling is True: polling_method = AsyncARMPolling(lro_delay, 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)
    async def begin_delete(self, resource_group_name: str, registry_name: str,
                           private_endpoint_connection_name: str,
                           **kwargs: Any) -> AsyncLROPoller[None]:
        """Deletes the specified private endpoint connection associated with the container registry.

        :param resource_group_name: The name of the resource group to which the container registry
         belongs.
        :type resource_group_name: str
        :param registry_name: The name of the container registry.
        :type registry_name: str
        :param private_endpoint_connection_name: The name of the private endpoint connection.
        :type private_endpoint_connection_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, azure.core.polling.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,
                registry_name=registry_name,
                private_endpoint_connection_name=
                private_endpoint_connection_name,
                cls=lambda x, y, z: x,
                **kwargs)
        kwargs.pop('error_map', None)

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

        if polling is True:
            polling_method = AsyncARMPolling(lro_delay, **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)
    async def begin_update(
            self, resource_group_name: str, registry_name: str,
            token_name: str,
            token_update_parameters: "_models.TokenUpdateParameters",
            **kwargs: Any) -> AsyncLROPoller["_models.Token"]:
        """Updates a token with the specified parameters.

        :param resource_group_name: The name of the resource group to which the container registry
         belongs.
        :type resource_group_name: str
        :param registry_name: The name of the container registry.
        :type registry_name: str
        :param token_name: The name of the token.
        :type token_name: str
        :param token_update_parameters: The parameters for updating a token.
        :type token_update_parameters:
         ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenUpdateParameters
        :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 Token or the result of cls(response)
        :rtype:
         ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token]
        :raises: ~azure.core.exceptions.HttpResponseError
        """
        content_type = kwargs.pop('content_type',
                                  "application/json")  # type: Optional[str]
        polling = kwargs.pop(
            'polling',
            True)  # type: Union[bool, azure.core.polling.AsyncPollingMethod]
        cls = kwargs.pop('cls', None)  # type: ClsType["_models.Token"]
        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._update_initial(
                resource_group_name=resource_group_name,
                registry_name=registry_name,
                token_name=token_name,
                token_update_parameters=token_update_parameters,
                content_type=content_type,
                cls=lambda x, y, z: x,
                **kwargs)
        kwargs.pop('error_map', None)

        def get_long_running_output(pipeline_response):
            response = pipeline_response.http_response
            deserialized = self._deserialize('Token', pipeline_response)
            if cls:
                return cls(pipeline_response, deserialized, {})
            return deserialized

        if polling is True:
            polling_method = AsyncARMPolling(lro_delay, **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)
    async def begin_generate_vpn_profile(
            self, resource_group_name: str, gateway_name: str,
            parameters: "_models.P2SVpnProfileParameters",
            **kwargs) -> AsyncLROPoller["_models.VpnProfileResponse"]:
        """Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param gateway_name: The name of the P2SVpnGateway.
        :type gateway_name: str
        :param parameters: Parameters supplied to the generate P2SVpnGateway VPN client package
         operation.
        :type parameters: ~azure.mgmt.network.v2018_08_01.models.P2SVpnProfileParameters
        :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: True for ARMPolling, False for no polling, or a
         polling object for 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 VpnProfileResponse or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2018_08_01.models.VpnProfileResponse]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop('cls',
                         None)  # type: ClsType["_models.VpnProfileResponse"]
        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._generate_vpn_profile_initial(
                resource_group_name=resource_group_name,
                gateway_name=gateway_name,
                parameters=parameters,
                cls=lambda x, y, z: x,
                **kwargs)

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('VpnProfileResponse',
                                             pipeline_response)

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

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

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                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)
Example #7
0
    async def begin_validate(
        self, resource_group_name: str, service_name: str,
        config_server_settings: "_models.ConfigServerSettings", **kwargs: Any
    ) -> AsyncLROPoller["_models.ConfigServerSettingsValidateResult"]:
        """Check if the config server settings are valid.

        :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
        :param config_server_settings: Config server settings to be validated.
        :type config_server_settings: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings
        :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 ConfigServerSettingsValidateResult or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsValidateResult]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop(
            'cls', None
        )  # type: ClsType["_models.ConfigServerSettingsValidateResult"]
        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._validate_initial(
                resource_group_name=resource_group_name,
                service_name=service_name,
                config_server_settings=config_server_settings,
                cls=lambda x, y, z: x,
                **kwargs)

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize(
                'ConfigServerSettingsValidateResult', pipeline_response)

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

        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': 'location'},
                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)
Example #8
0
    async def begin_create_or_update(
            self, resource_group_name: str,
            capacity_reservation_group_name: str,
            capacity_reservation_name: str,
            parameters: "_models.CapacityReservation",
            **kwargs: Any) -> AsyncLROPoller["_models.CapacityReservation"]:
        """The operation to create or update a capacity reservation. Please note some properties can be
        set only during capacity reservation creation. Please refer to
        https://aka.ms/CapacityReservation for more details.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param capacity_reservation_group_name: The name of the capacity reservation group.
        :type capacity_reservation_group_name: str
        :param capacity_reservation_name: The name of the capacity reservation.
        :type capacity_reservation_name: str
        :param parameters: Parameters supplied to the Create capacity reservation.
        :type parameters: ~azure.mgmt.compute.v2021_11_01.models.CapacityReservation
        :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 CapacityReservation or the result of
         cls(response)
        :rtype:
         ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.CapacityReservation]
        :raises: ~azure.core.exceptions.HttpResponseError
        """
        api_version = kwargs.pop('api_version', "2021-11-01")  # type: str
        content_type = kwargs.pop('content_type',
                                  "application/json")  # type: Optional[str]
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop('cls',
                         None)  # type: ClsType["_models.CapacityReservation"]
        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._create_or_update_initial(
                resource_group_name=resource_group_name,
                capacity_reservation_group_name=capacity_reservation_group_name,
                capacity_reservation_name=capacity_reservation_name,
                parameters=parameters,
                api_version=api_version,
                content_type=content_type,
                cls=lambda x, y, z: x,
                **kwargs)
        kwargs.pop('error_map', None)

        def get_long_running_output(pipeline_response):
            response = pipeline_response.http_response
            deserialized = self._deserialize('CapacityReservation',
                                             pipeline_response)
            if cls:
                return cls(pipeline_response, deserialized, {})
            return deserialized

        if polling is True:
            polling_method = AsyncARMPolling(lro_delay, **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)
        return AsyncLROPoller(self._client, raw_result,
                              get_long_running_output, polling_method)
Example #9
0
    async def begin_delete(  # pylint: disable=inconsistent-return-statements
            self, resource_group_name: str,
            capacity_reservation_group_name: str,
            capacity_reservation_name: str,
            **kwargs: Any) -> AsyncLROPoller[None]:
        """The operation to delete a capacity reservation. This operation is allowed only when all the
        associated resources are disassociated from the capacity reservation. Please refer to
        https://aka.ms/CapacityReservation for more details.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param capacity_reservation_group_name: The name of the capacity reservation group.
        :type capacity_reservation_group_name: str
        :param capacity_reservation_name: The name of the capacity reservation.
        :type capacity_reservation_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
        """
        api_version = kwargs.pop('api_version', "2021-11-01")  # type: str
        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,
                capacity_reservation_group_name=capacity_reservation_group_name,
                capacity_reservation_name=capacity_reservation_name,
                api_version=api_version,
                cls=lambda x, y, z: x,
                **kwargs)
        kwargs.pop('error_map', None)

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

        if polling is True:
            polling_method = AsyncARMPolling(lro_delay, **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)
        return AsyncLROPoller(self._client, raw_result,
                              get_long_running_output, polling_method)
Example #10
0
    async def begin_move(
            self, billing_account_name: str,
            parameters: "_models.TransferBillingSubscriptionRequestProperties",
            **kwargs) -> AsyncLROPoller["_models.BillingSubscription"]:
        """Moves a subscription's charges to a new invoice section. The new invoice section must belong to
        the same billing profile as the existing invoice section. This operation is supported for
        billing accounts with agreement type Microsoft Customer Agreement.

        :param billing_account_name: The ID that uniquely identifies a billing account.
        :type billing_account_name: str
        :param parameters: Request parameters that are provided to the move subscription operation.
        :type parameters: ~azure.mgmt.billing.models.TransferBillingSubscriptionRequestProperties
        :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: True for ARMPolling, False for no polling, or a
         polling object for 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 BillingSubscription or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.billing.models.BillingSubscription]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop('cls',
                         None)  # type: ClsType["_models.BillingSubscription"]
        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._move_initial(
                billing_account_name=billing_account_name,
                parameters=parameters,
                cls=lambda x, y, z: x,
                **kwargs)

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('BillingSubscription',
                                             pipeline_response)

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

        path_format_arguments = {
            'billingAccountName':
            self._serialize.url("billing_account_name", billing_account_name,
                                'str'),
            'subscriptionId':
            self._serialize.url("self._config.subscription_id",
                                self._config.subscription_id, 'str'),
        }

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                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)
    async def begin_create_or_update(
            self, resource_group_name: str, cluster_name: str,
            database_name: str, principal_assignment_name: str,
            parameters: "_models.DatabasePrincipalAssignment",
            **kwargs) -> AsyncLROPoller["_models.DatabasePrincipalAssignment"]:
        """Creates a Kusto cluster database principalAssignment.

        :param resource_group_name: The name of the resource group containing the Kusto cluster.
        :type resource_group_name: str
        :param cluster_name: The name of the Kusto cluster.
        :type cluster_name: str
        :param database_name: The name of the database in the Kusto cluster.
        :type database_name: str
        :param principal_assignment_name: The name of the Kusto principalAssignment.
        :type principal_assignment_name: str
        :param parameters: The Kusto principalAssignments parameters supplied for the operation.
        :type parameters: ~azure.mgmt.kusto.models.DatabasePrincipalAssignment
        :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: Pass in True if you'd like the AsyncARMPolling polling method,
         False for no polling, or 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 DatabasePrincipalAssignment or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kusto.models.DatabasePrincipalAssignment]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop(
            'cls',
            None)  # type: ClsType["_models.DatabasePrincipalAssignment"]
        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._create_or_update_initial(
                resource_group_name=resource_group_name,
                cluster_name=cluster_name,
                database_name=database_name,
                principal_assignment_name=principal_assignment_name,
                parameters=parameters,
                cls=lambda x, y, z: x,
                **kwargs)

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('DatabasePrincipalAssignment',
                                             pipeline_response)

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

        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'),
            'clusterName':
            self._serialize.url("cluster_name", cluster_name, 'str'),
            'databaseName':
            self._serialize.url("database_name", database_name, 'str'),
            'principalAssignmentName':
            self._serialize.url("principal_assignment_name",
                                principal_assignment_name, 'str'),
        }

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                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)
    async def begin_update(
            self, resource_group_name: str, vm_scale_set_name: str,
            instance_id: str, run_command_name: str,
            run_command: "_models.VirtualMachineRunCommandUpdate",
            **kwargs) -> AsyncLROPoller["_models.VirtualMachineRunCommand"]:
        """The operation to update the VMSS VM run command.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param vm_scale_set_name: The name of the VM scale set.
        :type vm_scale_set_name: str
        :param instance_id: The instance ID of the virtual machine.
        :type instance_id: str
        :param run_command_name: The name of the virtual machine run command.
        :type run_command_name: str
        :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation.
        :type run_command: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommandUpdate
        :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: True for ARMPolling, False for no polling, or a
         polling object for 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 VirtualMachineRunCommand or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop(
            'cls', None)  # type: ClsType["_models.VirtualMachineRunCommand"]
        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._update_initial(
                resource_group_name=resource_group_name,
                vm_scale_set_name=vm_scale_set_name,
                instance_id=instance_id,
                run_command_name=run_command_name,
                run_command=run_command,
                cls=lambda x, y, z: x,
                **kwargs)

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('VirtualMachineRunCommand',
                                             pipeline_response)

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

        path_format_arguments = {
            'resourceGroupName':
            self._serialize.url("resource_group_name", resource_group_name,
                                'str'),
            'vmScaleSetName':
            self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'),
            'instanceId':
            self._serialize.url("instance_id", instance_id, 'str'),
            'runCommandName':
            self._serialize.url("run_command_name", run_command_name, 'str'),
            'subscriptionId':
            self._serialize.url("self._config.subscription_id",
                                self._config.subscription_id, 'str'),
        }

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                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)
    async def begin_restrict_movement(
        self,
        resource_group_name: str,
        private_cloud_name: str,
        cluster_name: str,
        virtual_machine_id: str,
        restrict_movement: Optional[Union[str, "_models.VirtualMachineRestrictMovementState"]] = None,
        **kwargs: Any
    ) -> AsyncLROPoller[None]:
        """Enable or disable DRS-driven VM movement restriction.

        Enable or disable DRS-driven VM movement restriction.

        :param resource_group_name: The name of the resource group. The name is case insensitive.
        :type resource_group_name: str
        :param private_cloud_name: Name of the private cloud.
        :type private_cloud_name: str
        :param cluster_name: Name of the cluster in the private cloud.
        :type cluster_name: str
        :param virtual_machine_id: Virtual Machine identifier.
        :type virtual_machine_id: str
        :param restrict_movement: Whether VM DRS-driven movement is restricted (enabled) or not
         (disabled).
        :type restrict_movement: str or ~avs_client.models.VirtualMachineRestrictMovementState
        :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._restrict_movement_initial(
                resource_group_name=resource_group_name,
                private_cloud_name=private_cloud_name,
                cluster_name=cluster_name,
                virtual_machine_id=virtual_machine_id,
                restrict_movement=restrict_movement,
                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', min_length=1),
            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
            'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'),
            'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'),
            'virtualMachineId': self._serialize.url("virtual_machine_id", virtual_machine_id, 'str'),
        }

        if polling is True: polling_method = AsyncARMPolling(lro_delay, 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)
Example #14
0
    async def begin_manual_failover(self, iot_hub_name: str,
                                    resource_group_name: str,
                                    failover_input: "_models.FailoverInput",
                                    **kwargs: Any) -> AsyncLROPoller[None]:
        """Manual Failover Fail over.

        Perform manual fail over of given hub.

        :param iot_hub_name: IotHub to fail over.
        :type iot_hub_name: str
        :param resource_group_name: resource group which Iot Hub belongs to.
        :type resource_group_name: str
        :param failover_input: Region to failover to. Must be a azure DR pair.
        :type failover_input: ~azure.mgmt.iothub.v2019_07_01_preview.models.FailoverInput
        :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._manual_failover_initial(
                iot_hub_name=iot_hub_name,
                resource_group_name=resource_group_name,
                failover_input=failover_input,
                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 = {
            'iotHubName':
            self._serialize.url("iot_hub_name", iot_hub_name, 'str'),
            'subscriptionId':
            self._serialize.url("self._config.subscription_id",
                                self._config.subscription_id, 'str'),
            'resourceGroupName':
            self._serialize.url("resource_group_name", resource_group_name,
                                'str'),
        }

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                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)
Example #15
0
    async def begin_update(
            self, resource_group_name: str, route_filter_name: str,
            rule_name: str,
            route_filter_rule_parameters: "models.PatchRouteFilterRule",
            **kwargs) -> AsyncLROPoller["models.RouteFilterRule"]:
        """Updates a route in the specified route filter.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param route_filter_name: The name of the route filter.
        :type route_filter_name: str
        :param rule_name: The name of the route filter rule.
        :type rule_name: str
        :param route_filter_rule_parameters: Parameters supplied to the update route filter rule
         operation.
        :type route_filter_rule_parameters: ~azure.mgmt.network.v2017_06_01.models.PatchRouteFilterRule
        :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: True for ARMPolling, False for no polling, or a
         polling object for 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 RouteFilterRule or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2017_06_01.models.RouteFilterRule]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop('cls',
                         None)  # type: ClsType["models.RouteFilterRule"]
        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._update_initial(
                resource_group_name=resource_group_name,
                route_filter_name=route_filter_name,
                rule_name=rule_name,
                route_filter_rule_parameters=route_filter_rule_parameters,
                cls=lambda x, y, z: x,
                **kwargs)

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('RouteFilterRule',
                                             pipeline_response)

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

        if polling is True:
            polling_method = AsyncARMPolling(lro_delay, **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)
Example #16
0
    async def begin_create_or_update(
            self, device_name: str, name: str, resource_group_name: str,
            trigger: "_models.Trigger",
            **kwargs) -> AsyncLROPoller["_models.Trigger"]:
        """Creates or updates a trigger.

        :param device_name: Creates or updates a trigger.
        :type device_name: str
        :param name: The trigger name.
        :type name: str
        :param resource_group_name: The resource group name.
        :type resource_group_name: str
        :param trigger: The trigger.
        :type trigger: ~azure.mgmt.databoxedge.models.Trigger
        :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: True for ARMPolling, False for no polling, or a
         polling object for 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 Trigger or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.models.Trigger]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop('cls', None)  # type: ClsType["_models.Trigger"]
        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._create_or_update_initial(
                device_name=device_name,
                name=name,
                resource_group_name=resource_group_name,
                trigger=trigger,
                cls=lambda x, y, z: x,
                **kwargs)

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('Trigger', pipeline_response)

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

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

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                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)
    async def begin_create_or_update(
            self, provider_namespace: str, resource_type: str,
            nested_resource_type: str,
            properties: "models.ResourceTypeRegistration",
            **kwargs) -> AsyncLROPoller["models.ResourceTypeRegistration"]:
        """Creates or updates a resource type.

        :param provider_namespace: The name of the resource provider hosted within ProviderHub.
        :type provider_namespace: str
        :param resource_type: The resource type.
        :type resource_type: str
        :param nested_resource_type: The nested resource type.
        :type nested_resource_type: str
        :param properties: The required request body parameters supplied to the resource type
         registration CreateOrUpdate operation.
        :type properties: ~provider_hub.models.ResourceTypeRegistration
        :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: True for ARMPolling, False for no polling, or a
         polling object for 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 ResourceTypeRegistration or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~provider_hub.models.ResourceTypeRegistration]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop(
            'cls', None)  # type: ClsType["models.ResourceTypeRegistration"]
        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._create_or_update_initial(
                provider_namespace=provider_namespace,
                resource_type=resource_type,
                nested_resource_type=nested_resource_type,
                properties=properties,
                cls=lambda x, y, z: x,
                **kwargs)

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('ResourceTypeRegistration',
                                             pipeline_response)

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

        path_format_arguments = {
            'subscriptionId':
            self._serialize.url("self._config.subscription_id",
                                self._config.subscription_id,
                                'str',
                                min_length=1),
            'providerNamespace':
            self._serialize.url("provider_namespace", provider_namespace,
                                'str'),
            'resourceType':
            self._serialize.url("resource_type", resource_type, 'str'),
            'nestedResourceType':
            self._serialize.url("nested_resource_type", nested_resource_type,
                                '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)
Example #18
0
    async def begin_create_or_update(
        self, resource_group_name: str, circuit_name: str,
        authorization_name: str,
        authorization_parameters: "_models.ExpressRouteCircuitAuthorization",
        **kwargs
    ) -> AsyncLROPoller["_models.ExpressRouteCircuitAuthorization"]:
        """Creates or updates an authorization in the specified express route circuit.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param circuit_name: The name of the express route circuit.
        :type circuit_name: str
        :param authorization_name: The name of the authorization.
        :type authorization_name: str
        :param authorization_parameters: Parameters supplied to the create or update express route
         circuit authorization operation.
        :type authorization_parameters: ~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitAuthorization
        :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: True for ARMPolling, False for no polling, or a
         polling object for 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 ExpressRouteCircuitAuthorization or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitAuthorization]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop(
            'cls',
            None)  # type: ClsType["_models.ExpressRouteCircuitAuthorization"]
        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._create_or_update_initial(
                resource_group_name=resource_group_name,
                circuit_name=circuit_name,
                authorization_name=authorization_name,
                authorization_parameters=authorization_parameters,
                cls=lambda x, y, z: x,
                **kwargs)

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize(
                'ExpressRouteCircuitAuthorization', pipeline_response)

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

        path_format_arguments = {
            'resourceGroupName':
            self._serialize.url("resource_group_name", resource_group_name,
                                'str'),
            'circuitName':
            self._serialize.url("circuit_name", circuit_name, 'str'),
            'authorizationName':
            self._serialize.url("authorization_name", authorization_name,
                                'str'),
            'subscriptionId':
            self._serialize.url("self._config.subscription_id",
                                self._config.subscription_id, 'str'),
        }

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                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)
Example #19
0
    async def begin_list_routes_table(
        self,
        resource_group_name: str,
        cross_connection_name: str,
        peering_name: str,
        device_path: str,
        **kwargs
    ) -> "models.ExpressRouteCircuitsRoutesTableListResult":
        """Gets the currently advertised routes table associated with the express route cross connection
    in a resource group.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param cross_connection_name: The name of the ExpressRouteCrossConnection.
        :type cross_connection_name: str
        :param peering_name: The name of the peering.
        :type peering_name: str
        :param device_path: The path of the device.
        :type device_path: 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: True for ARMPolling, False for no polling, or a
         polling object for 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: ExpressRouteCircuitsRoutesTableListResult, or the result of cls(response)
        :rtype: ~azure.mgmt.network.v2018_10_01.models.ExpressRouteCircuitsRoutesTableListResult
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop('cls', None)  # type: ClsType["models.ExpressRouteCircuitsRoutesTableListResult"]
        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._list_routes_table_initial(
                resource_group_name=resource_group_name,
                cross_connection_name=cross_connection_name,
                peering_name=peering_name,
                device_path=device_path,
                cls=lambda x,y,z: x,
                **kwargs
            )

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', pipeline_response)

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

        if polling is True: polling_method = AsyncARMPolling(lro_delay,  **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)
    async def begin_create_or_update(
        self,
        resource_group_name: str,
        resource_name: str,
        agent_pool_name: str,
        parameters: "_models.AgentPool",
        **kwargs
    ) -> AsyncLROPoller["_models.AgentPool"]:
        """Creates or updates an agent pool.

        Creates or updates an agent pool in the specified managed cluster.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param resource_name: The name of the managed cluster resource.
        :type resource_name: str
        :param agent_pool_name: The name of the agent pool.
        :type agent_pool_name: str
        :param parameters: Parameters supplied to the Create or Update an agent pool operation.
        :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPool
        :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: True for ARMPolling, False for no polling, or a
         polling object for 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 AgentPool or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_06_01.models.AgentPool]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop('cls', None)  # type: ClsType["_models.AgentPool"]
        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._create_or_update_initial(
                resource_group_name=resource_group_name,
                resource_name=resource_name,
                agent_pool_name=agent_pool_name,
                parameters=parameters,
                cls=lambda x,y,z: x,
                **kwargs
            )

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('AgentPool', pipeline_response)

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

        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', min_length=1),
            'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'),
            'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str'),
        }

        if polling is True: polling_method = AsyncARMPolling(lro_delay, 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)
Example #21
0
    async def begin_delete(self,
                           resource_group_name: str,
                           force_deletion_types: Optional[str] = None,
                           **kwargs: Any) -> AsyncLROPoller[None]:
        """Deletes a resource group.

        When you delete a resource group, all of its resources are also deleted. Deleting a resource
        group deletes all of its template deployments and currently stored operations.

        :param resource_group_name: The name of the resource group to delete. The name is case
         insensitive.
        :type resource_group_name: str
        :param force_deletion_types: The resource types you want to force delete. Currently, only the
         following is supported:
         forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets.
        :type force_deletion_types: 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,
                force_deletion_types=force_deletion_types,
                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 = {
            'resourceGroupName':
            self._serialize.url("resource_group_name",
                                resource_group_name,
                                'str',
                                max_length=90,
                                min_length=1,
                                pattern=r'^[-\w\._\(\)]+$'),
            'subscriptionId':
            self._serialize.url("self._config.subscription_id",
                                self._config.subscription_id, 'str'),
        }

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                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)
Example #22
0
    async def begin_create_or_update(
            self, resource_group_name: str,
            network_virtual_appliance_name: str,
            parameters: "models.NetworkVirtualAppliance",
            **kwargs) -> "models.NetworkVirtualAppliance":
        """Creates or updates the specified Network Virtual Appliance.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param network_virtual_appliance_name: The name of Network Virtual Appliance.
        :type network_virtual_appliance_name: str
        :param parameters: Parameters supplied to the create or update Network Virtual Appliance.
        :type parameters: ~azure.mgmt.network.v2020_04_01.models.NetworkVirtualAppliance
        :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: True for ARMPolling, False for no polling, or a
         polling object for 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: NetworkVirtualAppliance, or the result of cls(response)
        :rtype: ~azure.mgmt.network.v2020_04_01.models.NetworkVirtualAppliance
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop(
            'cls', None)  # type: ClsType["models.NetworkVirtualAppliance"]
        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._create_or_update_initial(
                resource_group_name=resource_group_name,
                network_virtual_appliance_name=network_virtual_appliance_name,
                parameters=parameters,
                cls=lambda x, y, z: x,
                **kwargs)

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('NetworkVirtualAppliance',
                                             pipeline_response)

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

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                lro_options={'final-state-via': 'azure-async-operation'},
                **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)
    async def begin_update_tags(
            self, resource_group_name: str, public_ip_prefix_name: str,
            parameters: "_models.TagsObject",
            **kwargs) -> AsyncLROPoller["_models.PublicIPPrefix"]:
        """Updates public IP prefix tags.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param public_ip_prefix_name: The name of the public IP prefix.
        :type public_ip_prefix_name: str
        :param parameters: Parameters supplied to update public IP prefix tags.
        :type parameters: ~azure.mgmt.network.v2018_07_01.models.TagsObject
        :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: Pass in True if you'd like the AsyncARMPolling polling method,
         False for no polling, or 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 PublicIPPrefix or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2018_07_01.models.PublicIPPrefix]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop('cls',
                         None)  # type: ClsType["_models.PublicIPPrefix"]
        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._update_tags_initial(
                resource_group_name=resource_group_name,
                public_ip_prefix_name=public_ip_prefix_name,
                parameters=parameters,
                cls=lambda x, y, z: x,
                **kwargs)

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('PublicIPPrefix',
                                             pipeline_response)

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

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

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                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)
    async def begin_get_ike_sas(self, resource_group_name: str,
                                gateway_name: str, connection_name: str,
                                link_connection_name: str,
                                **kwargs) -> AsyncLROPoller[str]:
        """Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param gateway_name: The name of the gateway.
        :type gateway_name: str
        :param connection_name: The name of the vpn connection.
        :type connection_name: str
        :param link_connection_name: The name of the vpn link connection.
        :type link_connection_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: True for ARMPolling, False for no polling, or a
         polling object for 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 str or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[str]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop('cls', None)  # type: ClsType[str]
        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._get_ike_sas_initial(
                resource_group_name=resource_group_name,
                gateway_name=gateway_name,
                connection_name=connection_name,
                link_connection_name=link_connection_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):
            deserialized = self._deserialize('str', pipeline_response)

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

        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'),
            'gatewayName':
            self._serialize.url("gateway_name", gateway_name, 'str'),
            'connectionName':
            self._serialize.url("connection_name", connection_name, 'str'),
            'linkConnectionName':
            self._serialize.url("link_connection_name", link_connection_name,
                                'str'),
        }

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                lro_options={'final-state-via': 'location'},
                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)
Example #25
0
    async def begin_delete(
            self, resource_group_name: str, vm_name: str,
            vm_extension_name: str,
            **kwargs) -> AsyncLROPoller["_models.OperationStatusResponse"]:
        """The operation to delete the extension.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param vm_name: The name of the virtual machine where the extension should be deleted.
        :type vm_name: str
        :param vm_extension_name: The name of the virtual machine extension.
        :type vm_extension_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: Pass in True if you'd like the AsyncARMPolling polling method,
         False for no polling, or 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 OperationStatusResponse or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop(
            'cls', None)  # type: ClsType["_models.OperationStatusResponse"]
        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,
                vm_name=vm_name,
                vm_extension_name=vm_extension_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):
            deserialized = self._deserialize('OperationStatusResponse',
                                             pipeline_response)

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

        path_format_arguments = {
            'resourceGroupName':
            self._serialize.url("resource_group_name", resource_group_name,
                                'str'),
            'vmName':
            self._serialize.url("vm_name", vm_name, 'str'),
            'vmExtensionName':
            self._serialize.url("vm_extension_name", vm_extension_name, 'str'),
            'subscriptionId':
            self._serialize.url("self._config.subscription_id",
                                self._config.subscription_id, 'str'),
        }

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                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)
    async def begin_delete(self, resource_group_name: str, workspace_name: str,
                           integration_runtime_name: str,
                           **kwargs) -> AsyncLROPoller[None]:
        """Delete integration runtime.

        Delete an integration runtime.

        :param resource_group_name: The name of the resource group. The name is case insensitive.
        :type resource_group_name: str
        :param workspace_name: The name of the workspace.
        :type workspace_name: str
        :param integration_runtime_name: Integration runtime name.
        :type integration_runtime_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: True for ARMPolling, False for no polling, or a
         polling object for 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,
                workspace_name=workspace_name,
                integration_runtime_name=integration_runtime_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',
                                min_length=1),
            'resourceGroupName':
            self._serialize.url("resource_group_name",
                                resource_group_name,
                                'str',
                                max_length=90,
                                min_length=1,
                                pattern=r'^[-\w\._\(\)]+$'),
            'workspaceName':
            self._serialize.url("workspace_name", workspace_name, 'str'),
            'integrationRuntimeName':
            self._serialize.url("integration_runtime_name",
                                integration_runtime_name, 'str'),
        }

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                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)
    async def begin_unprepare_network_policies(
            self, resource_group_name: str, virtual_network_name: str,
            subnet_name: str, unprepare_network_policies_request_parameters:
        "_models.UnprepareNetworkPoliciesRequest",
            **kwargs) -> AsyncLROPoller[None]:
        """Unprepares a subnet by removing network intent policies.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param virtual_network_name: The name of the virtual network.
        :type virtual_network_name: str
        :param subnet_name: The name of the subnet.
        :type subnet_name: str
        :param unprepare_network_policies_request_parameters: Parameters supplied to unprepare subnet
         to remove network intent policies.
        :type unprepare_network_policies_request_parameters: ~azure.mgmt.network.v2020_05_01.models.UnprepareNetworkPoliciesRequest
        :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: True for ARMPolling, False for no polling, or a
         polling object for 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._unprepare_network_policies_initial(
                resource_group_name=resource_group_name,
                virtual_network_name=virtual_network_name,
                subnet_name=subnet_name,
                unprepare_network_policies_request_parameters=
                unprepare_network_policies_request_parameters,
                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 = {
            'resourceGroupName':
            self._serialize.url("resource_group_name", resource_group_name,
                                'str'),
            'virtualNetworkName':
            self._serialize.url("virtual_network_name", virtual_network_name,
                                'str'),
            'subnetName':
            self._serialize.url("subnet_name", subnet_name, 'str'),
            'subscriptionId':
            self._serialize.url("self._config.subscription_id",
                                self._config.subscription_id, 'str'),
        }

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                lro_options={'final-state-via': 'location'},
                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)
    async def begin_create_or_update(
            self, resource_group_name: str, server_name: str,
            private_endpoint_connection_name: str,
            parameters: "_models.PrivateEndpointConnection", **kwargs: Any
    ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]:
        """Approve or reject a private endpoint connection with a given name.

        :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 server_name: The name of the server.
        :type server_name: str
        :param private_endpoint_connection_name:
        :type private_endpoint_connection_name: str
        :param parameters:
        :type parameters: ~azure.mgmt.sql.models.PrivateEndpointConnection
        :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 PrivateEndpointConnection or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.PrivateEndpointConnection]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop(
            'cls', None)  # type: ClsType["_models.PrivateEndpointConnection"]
        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._create_or_update_initial(
                resource_group_name=resource_group_name,
                server_name=server_name,
                private_endpoint_connection_name=
                private_endpoint_connection_name,
                parameters=parameters,
                cls=lambda x, y, z: x,
                **kwargs)

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('PrivateEndpointConnection',
                                             pipeline_response)

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

        path_format_arguments = {
            'resourceGroupName':
            self._serialize.url("resource_group_name", resource_group_name,
                                'str'),
            'serverName':
            self._serialize.url("server_name", server_name, 'str'),
            'privateEndpointConnectionName':
            self._serialize.url("private_endpoint_connection_name",
                                private_endpoint_connection_name, 'str'),
            'subscriptionId':
            self._serialize.url("self._config.subscription_id",
                                self._config.subscription_id, 'str'),
        }

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                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)
Example #29
0
    async def begin_delete(self, resource_group_name: str,
                           private_endpoint_name: str,
                           **kwargs) -> AsyncLROPoller[None]:
        """Deletes the specified private endpoint.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param private_endpoint_name: The name of the private endpoint.
        :type private_endpoint_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: Pass in True if you'd like the AsyncARMPolling polling method,
         False for no polling, or 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,
                private_endpoint_name=private_endpoint_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 = {
            'resourceGroupName':
            self._serialize.url("resource_group_name", resource_group_name,
                                'str'),
            'privateEndpointName':
            self._serialize.url("private_endpoint_name", private_endpoint_name,
                                'str'),
            'subscriptionId':
            self._serialize.url("self._config.subscription_id",
                                self._config.subscription_id, 'str'),
        }

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                lro_options={'final-state-via': 'location'},
                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)
Example #30
0
    async def begin_create_or_update(
            self, resource_group_name: str, virtual_wan_name: str,
            p2_s_vpn_server_configuration_name: str,
            p2_s_vpn_server_configuration_parameters:
        "_models.P2SVpnServerConfiguration",
            **kwargs) -> AsyncLROPoller["_models.P2SVpnServerConfiguration"]:
        """Creates a P2SVpnServerConfiguration to associate with a VirtualWan if it doesn't exist else
        updates the existing P2SVpnServerConfiguration.

        :param resource_group_name: The resource group name of the VirtualWan.
        :type resource_group_name: str
        :param virtual_wan_name: The name of the VirtualWan.
        :type virtual_wan_name: str
        :param p2_s_vpn_server_configuration_name: The name of the P2SVpnServerConfiguration.
        :type p2_s_vpn_server_configuration_name: str
        :param p2_s_vpn_server_configuration_parameters: Parameters supplied to create or Update a
         P2SVpnServerConfiguration.
        :type p2_s_vpn_server_configuration_parameters: ~azure.mgmt.network.v2018_08_01.models.P2SVpnServerConfiguration
        :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: Pass in True if you'd like the AsyncARMPolling polling method,
         False for no polling, or 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 P2SVpnServerConfiguration or the result of cls(response)
        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2018_08_01.models.P2SVpnServerConfiguration]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, AsyncPollingMethod]
        cls = kwargs.pop(
            'cls', None)  # type: ClsType["_models.P2SVpnServerConfiguration"]
        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._create_or_update_initial(
                resource_group_name=resource_group_name,
                virtual_wan_name=virtual_wan_name,
                p2_s_vpn_server_configuration_name=
                p2_s_vpn_server_configuration_name,
                p2_s_vpn_server_configuration_parameters=
                p2_s_vpn_server_configuration_parameters,
                cls=lambda x, y, z: x,
                **kwargs)

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

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('P2SVpnServerConfiguration',
                                             pipeline_response)

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

        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'),
            'virtualWanName':
            self._serialize.url("virtual_wan_name", virtual_wan_name, 'str'),
            'p2SVpnServerConfigurationName':
            self._serialize.url("p2_s_vpn_server_configuration_name",
                                p2_s_vpn_server_configuration_name, 'str'),
        }

        if polling is True:
            polling_method = AsyncARMPolling(
                lro_delay,
                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)