async def get( self, resource_group_name: str, network_watcher_name: str, flow_log_name: str, **kwargs: Any ) -> "_models.FlowLog": """Gets a flow log resource by name. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_watcher_name: The name of the network watcher. :type network_watcher_name: str :param flow_log_name: The name of the flow log resource. :type flow_log_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FlowLog, or the result of cls(response) :rtype: ~azure.mgmt.network.v2021_05_01.models.FlowLog :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FlowLog"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-05-01" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkWatcherName': self._serialize.url("network_watcher_name", network_watcher_name, 'str'), 'flowLogName': self._serialize.url("flow_log_name", flow_log_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FlowLog', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def update( self, resource_group_name: str, service_name: str, product_id: str, if_match: str, parameters: "_models.ProductUpdateParameters", **kwargs ) -> "_models.ProductContract": """Update existing product details. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param service_name: The name of the API Management service. :type service_name: str :param product_id: Product identifier. Must be unique in the current API Management service instance. :type product_id: str :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. :type if_match: str :param parameters: Update parameters. :type parameters: ~azure.mgmt.apimanagement.models.ProductUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ProductContract, or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ProductContract :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductContract"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ProductUpdateParameters') body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) deserialized = self._deserialize('ProductContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized
async def get(self, resource_group_name: str, firewall_policy_name: str, expand: Optional[str] = None, **kwargs) -> "models.FirewallPolicy": """Gets the specified Firewall Policy. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param firewall_policy_name: The name of the Firewall Policy. :type firewall_policy_name: str :param expand: Expands referenced resources. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallPolicy, or the result of cls(response) :rtype: ~azure.mgmt.network.v2019_08_01.models.FirewallPolicy :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FirewallPolicy"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'firewallPolicyName': self._serialize.url("firewall_policy_name", firewall_policy_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query( "api_version", api_version, 'str') if expand is not None: query_parameters['$expand'] = self._serialize.query( "expand", expand, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('FirewallPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
def update( self, resource_group_name, # type: str automation_account_name, # type: str package_name, # type: str parameters, # type: "_models.PythonPackageUpdateParameters" **kwargs # type: Any ): # type: (...) -> "_models.Module" """Update the python 2 package identified by package name. :param resource_group_name: Name of an Azure Resource group. :type resource_group_name: str :param automation_account_name: The name of the automation account. :type automation_account_name: str :param package_name: The name of python package. :type package_name: str :param parameters: The update parameters for python package. :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: Module, or the result of cls(response) :rtype: ~azure.mgmt.automation.models.Module :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Module"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-06-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), 'packageName': self._serialize.url("package_name", package_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PythonPackageUpdateParameters') body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Module', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
def _revoke_access_initial( self, resource_group_name, # type: str snapshot_name, # type: str **kwargs # type: Any ): # type: (...) -> Optional["models.OperationStatusResponse"] cls = kwargs.pop( 'cls', None) # type: ClsType[Optional["models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2017-03-30" accept = "application/json" # Construct URL url = self._revoke_access_initial.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query( "api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header( "accept", accept, 'str') request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: deserialized = self._deserialize('OperationStatusResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
def list( self, resource_group_name, # type: str vm_name, # type: str expand=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> "models.VirtualMachineExtensionsListResult" """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param vm_name: The name of the virtual machine containing the extension. :type vm_name: str :param expand: The expand expression to apply on the operation. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineExtensionsListResult, or the result of cls(response) :rtype: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionsListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop( 'cls', None) # type: ClsType["models.VirtualMachineExtensionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-01" accept = "application/json" # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vmName': self._serialize.url("vm_name", vm_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] if expand is not None: query_parameters['$expand'] = self._serialize.query( "expand", expand, 'str') query_parameters['api-version'] = self._serialize.query( "api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header( "accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('VirtualMachineExtensionsListResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def _delete_initial(self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-12-01" accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', 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'), 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query( "api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header( "accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {})
async def configure_factory_repo( self, location_id: str, factory_resource_id: Optional[str] = None, repo_configuration: Optional["models.FactoryRepoConfiguration"] = None, **kwargs ) -> "models.Factory": """Updates a factory's repo information. :param location_id: The location identifier. :type location_id: str :param factory_resource_id: The factory resource id. :type factory_resource_id: str :param repo_configuration: Git repo information of the factory. :type repo_configuration: ~dfaz_management_client.models.FactoryRepoConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: Factory, or the result of cls(response) :rtype: ~dfaz_management_client.models.Factory :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Factory"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) _factory_repo_update = models.FactoryRepoUpdate(factory_resource_id=factory_resource_id, repo_configuration=repo_configuration) api_version = "2018-06-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.configure_factory_repo.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'locationId': self._serialize.url("location_id", location_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_factory_repo_update, 'FactoryRepoUpdate') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Factory', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def create_or_update( self, resource_group_name: str, factory_name: str, if_match: Optional[str] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, repo_configuration: Optional["models.FactoryRepoConfiguration"] = None, fake_identity: Optional["models.FakeFactoryIdentity"] = None, zones: Optional[List[str]] = None, type: Optional[Union[str, "models.FactoryIdentityType"]] = None, **kwargs ) -> "models.Factory": """Creates or updates a factory. :param resource_group_name: The resource group name. :type resource_group_name: str :param factory_name: The factory name. :type factory_name: str :param if_match: ETag of the factory entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. :type if_match: str :param location: The resource location. :type location: str :param tags: The resource tags. :type tags: dict[str, str] :param repo_configuration: Git repo information of the factory. :type repo_configuration: ~dfaz_management_client.models.FactoryRepoConfiguration :param fake_identity: This is only for az test. :type fake_identity: ~dfaz_management_client.models.FakeFactoryIdentity :param zones: This is only for az test. :type zones: list[str] :param type: The identity type. Currently the only supported type is 'SystemAssigned'. :type type: str or ~dfaz_management_client.models.FactoryIdentityType :keyword callable cls: A custom type or function that will be passed the direct response :return: Factory, or the result of cls(response) :rtype: ~dfaz_management_client.models.Factory :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Factory"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) _factory = models.Factory(location=location, tags=tags, repo_configuration=repo_configuration, fake_identity=fake_identity, zones=zones, type_identity_type=type) api_version = "2018-06-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'factoryName': self._serialize.url("factory_name", factory_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if if_match is not None: header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_factory, 'Factory') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Factory', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
def create( self, resource_group_name, # type: str account_name, # type: str share_name, # type: str share, # type: "_models.Share" **kwargs # type: Any ): # type: (...) -> "_models.Share" """Create a share in the given account. Create a share. :param resource_group_name: The resource group name. :type resource_group_name: str :param account_name: The name of the share account. :type account_name: str :param share_name: The name of the share. :type share_name: str :param share: The share payload. :type share: ~azure.mgmt.datashare.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :return: Share, or the result of cls(response) :rtype: ~azure.mgmt.datashare.models.Share :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self.create.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'accountName': self._serialize.url("account_name", account_name, 'str'), 'shareName': self._serialize.url("share_name", share_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query( "api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header( "content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header( "accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(share, 'Share') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(_models.DataShareError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Share', pipeline_response) if response.status_code == 201: deserialized = self._deserialize('Share', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def update_tags( self, resource_group_name: str, ddos_protection_plan_name: str, parameters: "_models.TagsObject", **kwargs: Any ) -> "_models.DdosProtectionPlan": """Update a DDoS protection plan tags. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param ddos_protection_plan_name: The name of the DDoS protection plan. :type ddos_protection_plan_name: str :param parameters: Parameters supplied to the update DDoS protection plan resource tags. :type parameters: ~azure.mgmt.network.v2019_12_01.models.TagsObject :keyword callable cls: A custom type or function that will be passed the direct response :return: DdosProtectionPlan, or the result of cls(response) :rtype: ~azure.mgmt.network.v2019_12_01.models.DdosProtectionPlan :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DdosProtectionPlan"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-12-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self.update_tags.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ddosProtectionPlanName': self._serialize.url("ddos_protection_plan_name", ddos_protection_plan_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'TagsObject') body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('DdosProtectionPlan', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def _create_or_update_initial( self, resource_group_name: str, load_balancer_name: str, inbound_nat_rule_name: str, inbound_nat_rule_parameters: "_models.InboundNatRule", **kwargs: Any) -> "_models.InboundNatRule": cls = kwargs.pop('cls', None) # type: ClsType["_models.InboundNatRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-04-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'loadBalancerName': self._serialize.url("load_balancer_name", load_balancer_name, 'str'), 'inboundNatRuleName': self._serialize.url("inbound_nat_rule_name", inbound_nat_rule_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query( "api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header( "content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header( "accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(inbound_nat_rule_parameters, 'InboundNatRule') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('InboundNatRule', pipeline_response) if response.status_code == 201: deserialized = self._deserialize('InboundNatRule', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
def get_logs_default( self, resource_group_name, # type: str script_name, # type: str tail=None, # type: Optional[int] **kwargs # type: Any ): # type: (...) -> "models.ScriptLog" """Gets deployment script logs for a given deployment script name. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param script_name: Name of the deployment script. :type script_name: str :param tail: The number of lines to show from the tail of the deployment script log. Valid value is a positive number up to 1000. If 'tail' is not provided, all available logs are shown up to container instance log capacity of 4mb. :type tail: int :keyword callable cls: A custom type or function that will be passed the direct response :return: ScriptLog, or the result of cls(response) :rtype: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptLog :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ScriptLog"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-10-01" accept = "application/json" # Construct URL url = self.get_logs_default.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if tail is not None: query_parameters['tail'] = self._serialize.query("tail", tail, 'int') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ScriptLog', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
def update( self, resource_group_name, # type: str script_name, # type: str deployment_script=None, # type: Optional["models.DeploymentScriptUpdateParameter"] **kwargs # type: Any ): # type: (...) -> "models.DeploymentScript" """Updates deployment script tags with specified values. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param script_name: Name of the deployment script. :type script_name: str :param deployment_script: Deployment script resource with the tags to be updated. :type deployment_script: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScriptUpdateParameter :keyword callable cls: A custom type or function that will be passed the direct response :return: DeploymentScript, or the result of cls(response) :rtype: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] if deployment_script is not None: body_content = self._serialize.body(deployment_script, 'DeploymentScriptUpdateParameter') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeploymentScript', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
def get( self, resource_group_name, # type: str circuit_name, # type: str peering_name, # type: str **kwargs # type: Any ): # type: (...) -> "_models.ExpressRouteCircuitPeering" """Gets the specified peering for the 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 peering_name: The name of the peering. :type peering_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ExpressRouteCircuitPeering, or the result of cls(response) :rtype: ~azure.mgmt.network.v2018_08_01.models.ExpressRouteCircuitPeering :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpressRouteCircuitPeering"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-08-01" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'circuitName': self._serialize.url("circuit_name", circuit_name, 'str'), 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ExpressRouteCircuitPeering', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def update( self, resource_group_name: str, factory_name: str, type: Union[str, "models.FactoryIdentityType"], tags: Optional[Dict[str, str]] = None, **kwargs ) -> "models.Factory": """Updates a factory. :param resource_group_name: The resource group name. :type resource_group_name: str :param factory_name: The factory name. :type factory_name: str :param type: The identity type. Currently the only supported type is 'SystemAssigned'. :type type: str or ~dfaz_management_client.models.FactoryIdentityType :param tags: The resource tags. :type tags: dict[str, str] :keyword callable cls: A custom type or function that will be passed the direct response :return: Factory, or the result of cls(response) :rtype: ~dfaz_management_client.models.Factory :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Factory"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) _factory_update_parameters = models.FactoryUpdateParameters(tags=tags, type=type) api_version = "2018-06-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'factoryName': self._serialize.url("factory_name", factory_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_factory_update_parameters, 'FactoryUpdateParameters') body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Factory', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
def _create_or_update_initial( self, resource_group_name, # type: str vm_name, # type: str vm_extension_name, # type: str extension_parameters, # type: "models.VirtualMachineExtension" **kwargs # type: Any ): # type: (...) -> "models.VirtualMachineExtension" cls = kwargs.pop( 'cls', None) # type: ClsType["models.VirtualMachineExtension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore 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'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query( "api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header( "content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header( "accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(extension_parameters, 'VirtualMachineExtension') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) if response.status_code == 201: deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def get( self, resource_group_name: str, factory_name: str, if_none_match: Optional[str] = None, **kwargs ) -> Optional["models.Factory"]: """Gets a factory. :param resource_group_name: The resource group name. :type resource_group_name: str :param factory_name: The factory name. :type factory_name: str :param if_none_match: ETag of the factory entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Factory, or the result of cls(response) :rtype: ~dfaz_management_client.models.Factory or None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Factory"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'factoryName': self._serialize.url("factory_name", factory_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if if_none_match is not None: header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') header_parameters['Accept'] = 'application/json' request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 304]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: deserialized = self._deserialize('Factory', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def get(self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any) -> "_models.ScriptExecution": """Get an script execution by name in a private cloud. Get an script execution by name in a private cloud. :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 script_execution_name: Name of the user-invoked script execution resource. :type script_execution_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ScriptExecution, or the result of cls(response) :rtype: ~avs_client.models.ScriptExecution :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecution"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-12-01" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore 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'), 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query( "api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header( "accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ScriptExecution', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def get_git_hub_access_token( self, resource_group_name: str, factory_name: str, git_hub_access_code: str, git_hub_access_token_base_url: str, git_hub_client_id: Optional[str] = None, **kwargs ) -> "models.GitHubAccessTokenResponse": """Get GitHub Access Token. :param resource_group_name: The resource group name. :type resource_group_name: str :param factory_name: The factory name. :type factory_name: str :param git_hub_access_code: GitHub access code. :type git_hub_access_code: str :param git_hub_access_token_base_url: GitHub access token base URL. :type git_hub_access_token_base_url: str :param git_hub_client_id: GitHub application client ID. :type git_hub_client_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: GitHubAccessTokenResponse, or the result of cls(response) :rtype: ~dfaz_management_client.models.GitHubAccessTokenResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GitHubAccessTokenResponse"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) _git_hub_access_token_request = models.GitHubAccessTokenRequest(git_hub_access_code=git_hub_access_code, git_hub_client_id=git_hub_client_id, git_hub_access_token_base_url=git_hub_access_token_base_url) api_version = "2018-06-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.get_git_hub_access_token.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'factoryName': self._serialize.url("factory_name", factory_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_git_hub_access_token_request, 'GitHubAccessTokenRequest') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('GitHubAccessTokenResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def get_execution_logs( self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, script_output_stream_type: Optional[List[Union[ str, "_models.ScriptOutputStreamType"]]] = None, **kwargs: Any) -> "_models.ScriptExecution": """Return the logs for a script execution resource. :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 script_execution_name: Name of the user-invoked script execution resource. :type script_execution_name: str :param script_output_stream_type: Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. :type script_output_stream_type: list[str or ~avs_client.models.ScriptOutputStreamType] :keyword callable cls: A custom type or function that will be passed the direct response :return: ScriptExecution, or the result of cls(response) :rtype: ~avs_client.models.ScriptExecution :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecution"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-12-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self.get_execution_logs.metadata['url'] # type: ignore 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'), 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query( "api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header( "content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header( "accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] if script_output_stream_type is not None: body_content = self._serialize.body(script_output_stream_type, '[str]') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ScriptExecution', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def get_data_plane_access( self, resource_group_name: str, factory_name: str, permissions: Optional[str] = None, access_resource_path: Optional[str] = None, profile_name: Optional[str] = None, start_time: Optional[str] = None, expire_time: Optional[str] = None, **kwargs ) -> "models.AccessPolicyResponse": """Get Data Plane access. :param resource_group_name: The resource group name. :type resource_group_name: str :param factory_name: The factory name. :type factory_name: str :param permissions: The string with permissions for Data Plane access. Currently only 'r' is supported which grants read only access. :type permissions: str :param access_resource_path: The resource path to get access relative to factory. Currently only empty string is supported which corresponds to the factory resource. :type access_resource_path: str :param profile_name: The name of the profile. Currently only the default is supported. The default value is DefaultProfile. :type profile_name: str :param start_time: Start time for the token. If not specified the current time will be used. :type start_time: str :param expire_time: Expiration time for the token. Maximum duration for the token is eight hours and by default the token will expire in eight hours. :type expire_time: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessPolicyResponse, or the result of cls(response) :rtype: ~dfaz_management_client.models.AccessPolicyResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AccessPolicyResponse"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) _policy = models.UserAccessPolicy(permissions=permissions, access_resource_path=access_resource_path, profile_name=profile_name, start_time=start_time, expire_time=expire_time) api_version = "2018-06-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.get_data_plane_access.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'factoryName': self._serialize.url("factory_name", factory_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_policy, 'UserAccessPolicy') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessPolicyResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
def get( self, resource_group_name, # type: str snapshot_name, # type: str **kwargs # type: Any ): # type: (...) -> "models.Snapshot" """Gets information about a snapshot. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param snapshot_name: The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Snapshot, or the result of cls(response) :rtype: ~azure.mgmt.compute.v2017_03_30.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2017-03-30" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query( "api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header( "accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Snapshot', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
def create_or_update( self, resource_group_name, # type: str service_name, # type: str notification_name, # type: Union[str, "_models.NotificationName"] if_match=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> "_models.NotificationContract" """Create or Update API Management publisher notification. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param service_name: The name of the API Management service. :type service_name: str :param notification_name: Notification Name Identifier. :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: NotificationContract, or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.NotificationContract :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NotificationContract"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-12-01" accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url( "service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query( "api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if if_match is not None: header_parameters['If-Match'] = self._serialize.header( "if_match", if_match, 'str') header_parameters['Accept'] = self._serialize.header( "accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NotificationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def get_entity_tag( self, resource_group_name: str, service_name: str, product_id: str, **kwargs ) -> bool: """Gets the entity state (Etag) version of the product specified by its identifier. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param service_name: The name of the API Management service. :type service_name: str :param product_id: Product identifier. Must be unique in the current API Management service instance. :type product_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: bool, or the result of cls(response) :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-01-preview" accept = "application/json" # Construct URL url = self.get_entity_tag.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) if cls: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299
def _update_tags_initial( self, resource_group_name, # type: str local_network_gateway_name, # type: str parameters, # type: "_models.TagsObject" **kwargs # type: Any ): # type: (...) -> "_models.LocalNetworkGateway" cls = kwargs.pop('cls', None) # type: ClsType["_models.LocalNetworkGateway"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-01-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json, text/json" # Construct URL url = self._update_tags_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'localNetworkGatewayName': self._serialize.url("local_network_gateway_name", local_network_gateway_name, 'str', min_length=1), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query( "api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header( "content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header( "accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'TagsObject') body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('LocalNetworkGateway', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def delete( self, resource_group_name: str, service_name: str, product_id: str, if_match: str, delete_subscriptions: Optional[bool] = None, **kwargs ) -> None: """Delete product. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param service_name: The name of the API Management service. :type service_name: str :param product_id: Product identifier. Must be unique in the current API Management service instance. :type product_id: str :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. :type if_match: str :param delete_subscriptions: Delete existing subscriptions associated with the product or not. :type delete_subscriptions: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-01-preview" accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] if delete_subscriptions is not None: query_parameters['deleteSubscriptions'] = self._serialize.query("delete_subscriptions", delete_subscriptions, 'bool') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {})
def list_versions( self, location: str, publisher_name: str, type: str, filter: Optional[str] = None, top: Optional[int] = None, orderby: Optional[str] = None, **kwargs: Any) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. :type location: str :param publisher_name: :type publisher_name: str :param type: :type type: str :param filter: The filter to apply on the operation. :type filter: str :param top: :type top: int :param orderby: :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of VirtualMachineExtensionImage, or the result of cls(response) :rtype: list[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineExtensionImage] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop( 'cls', None ) # type: ClsType[List["_models.VirtualMachineExtensionImage"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) request = build_list_versions_request( location=location, publisher_name=publisher_name, type=type, subscription_id=self._config.subscription_id, filter=filter, top=top, orderby=orderby, template_url=self.list_versions.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('[VirtualMachineExtensionImage]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
async def update_tags(self, resource_group_name: str, firewall_policy_name: str, firewall_policy_parameters: "models.TagsObject", **kwargs) -> "models.FirewallPolicy": """Updates a Firewall Policy Tags. :param resource_group_name: The resource group name of the Firewall Policy. :type resource_group_name: str :param firewall_policy_name: The name of the Firewall Policy being updated. :type firewall_policy_name: str :param firewall_policy_parameters: Parameters supplied to Update Firewall Policy tags. :type firewall_policy_parameters: ~azure.mgmt.network.v2019_08_01.models.TagsObject :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallPolicy, or the result of cls(response) :rtype: ~azure.mgmt.network.v2019_08_01.models.FirewallPolicy :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FirewallPolicy"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.update_tags.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'firewallPolicyName': self._serialize.url("firewall_policy_name", firewall_policy_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query( "api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header( "content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(firewall_policy_parameters, 'TagsObject') body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(models.Error, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FirewallPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
def create( self, resource_id, # type: str advanced_threat_protection_setting, # type: "_models.AdvancedThreatProtectionSetting" **kwargs # type: Any ): # type: (...) -> "_models.AdvancedThreatProtectionSetting" """Creates or updates the Advanced Threat Protection settings on a specified resource. :param resource_id: The identifier of the resource. :type resource_id: str :param advanced_threat_protection_setting: Advanced Threat Protection Settings. :type advanced_threat_protection_setting: ~azure.mgmt.security.models.AdvancedThreatProtectionSetting :keyword callable cls: A custom type or function that will be passed the direct response :return: AdvancedThreatProtectionSetting, or the result of cls(response) :rtype: ~azure.mgmt.security.models.AdvancedThreatProtectionSetting :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AdvancedThreatProtectionSetting"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-01-01" setting_name = "current" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self.create.metadata['url'] # type: ignore path_format_arguments = { 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), 'settingName': self._serialize.url("setting_name", setting_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(advanced_threat_protection_setting, 'AdvancedThreatProtectionSetting') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('AdvancedThreatProtectionSetting', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized