desc
stringlengths
3
26.7k
decl
stringlengths
11
7.89k
bodies
stringlengths
8
553k
'Return distribution full name with - replaced with _'
@property def wheel_dist_name(self):
return '-'.join((safer_name(self.distribution.get_name()), safer_version(self.distribution.get_version())))
'Return archive name without extension'
def get_archive_basename(self):
(impl_tag, abi_tag, plat_tag) = self.get_tag() archive_basename = ('%s-%s-%s-%s' % (self.wheel_dist_name, impl_tag, abi_tag, plat_tag)) return archive_basename
'Return license filename from a license-file key in setup.cfg, or None.'
def license_file(self):
metadata = self.distribution.get_option_dict('metadata') if (not ('license_file' in metadata)): return None return metadata['license_file'][1]
'Generate requirements from setup.cfg as (\'Requires-Dist\', \'requirement; qualifier\') tuples. From a metadata section in setup.cfg: [metadata] provides-extra = extra1 extra2 requires-dist = requirement; qualifier another; qualifier2 unqualified Yields (\'Provides-Extra\', \'extra1\'), (\'Provides-Extra\', \'extra2\'...
def setupcfg_requirements(self):
metadata = self.distribution.get_option_dict('metadata') for (key, title) in (('provides_extra', 'Provides-Extra'), ('requires_dist', 'Requires-Dist')): if (not (key in metadata)): continue field = metadata[key] for line in field[1].splitlines(): line = line.strip...
'Add additional requirements from setup.cfg to file metadata_path'
def add_requirements(self, metadata_path):
additional = list(self.setupcfg_requirements()) if (not additional): return pkg_info = read_pkg_info(metadata_path) if (('Provides-Extra' in pkg_info) or ('Requires-Dist' in pkg_info)): warnings.warn('setup.cfg requirements overwrite values from setup.py') del pkg_...
'Convert an .egg-info directory into a .dist-info directory'
def egg2dist(self, egginfo_path, distinfo_path):
def adios(p): 'Appropriately delete directory, file or link.' if (os.path.exists(p) and (not os.path.islink(p)) and os.path.isdir(p)): shutil.rmtree(p) elif os.path.exists(p): os.unlink(p) adios(distinfo_path) if (not os.path.exists(egginfo_path...
'Get the non-security related metadata of an IoT hub. Get the non-security related metadata of an IoT hub. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param dict custom_heade...
def get(self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url('resource_grou...
'Create or update the metadata of an IoT hub. Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. :param resource_group_name: The name of the res...
def create_or_update(self, resource_group_name, resource_name, iot_hub_description, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url('resource_grou...
'Delete an IoT hub. Delete an IoT hub. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub to delete. :type resource_name: str :param dict custom_headers: headers that will be added to the request :param bool ...
def delete(self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url('resource_grou...
'Get all the IoT hubs in a subscription. Get all the IoT hubs in a subscription. :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides<msrest:optionsforoperat...
def list_by_subscription(self, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str')} ...
'Get all the IoT hubs in a resource group. Get all the IoT hubs in a resource group. :param resource_group_name: The name of the resource group that contains the IoT hubs. :type resource_group_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response al...
def list_by_resource_group(self, resource_group_name, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config...
'Get the statistics from an IoT hub. Get the statistics from an IoT hub. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param dict custom_headers: headers that will be added to ...
def get_stats(self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url('r...
'Get the list of valid SKUs for an IoT hub. Get the list of valid SKUs for an IoT hub. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param dict custom_headers: headers that wil...
def get_valid_skus(self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscript...
'Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: st...
def list_event_hub_consumer_groups(self, resource_group_name, resource_name, event_hub_endpoint_name, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups' path_format_arguments = {'subscrip...
'Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_na...
def get_event_hub_consumer_group(self, resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, ...
'Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resou...
def create_event_hub_consumer_group(self, resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, ...
'Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :...
def delete_event_hub_consumer_group(self, resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, ...
'Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. :param resource_group_name:...
def list_jobs(self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscript...
'Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. :param resource_group_name:...
def get_job(self, resource_group_name, resource_name, job_id, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url('...
'Get the quota metrics for an IoT hub. Get the quota metrics for an IoT hub. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param dict custom_headers: headers that will be added...
def get_quota_metrics(self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.s...
'Check if an IoT hub name is available. Check if an IoT hub name is available. :param name: The name of the IoT hub to check. :type name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :r...
def check_name_availability(self, name, custom_headers=None, raw=False, **operation_config):
operation_inputs = models.OperationInputs(name=name) url = '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str')} url = self._client.format_url(...
'Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. :param resource_group_name: The name of the r...
def list_keys(self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subsc...
'Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. :param resource_group_nam...
def get_keys_for_key_name(self, resource_group_name, resource_name, key_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGroupName': self...
'Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azu...
def export_devices(self, resource_group_name, resource_name, export_blob_container_uri, exclude_keys, custom_headers=None, raw=False, **operation_config):
export_devices_parameters = models.ExportDevicesRequest(export_blob_container_uri=export_blob_container_uri, exclude_keys=exclude_keys) url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices' path_format_arguments = {'subscr...
'Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob....
def import_devices(self, resource_group_name, resource_name, input_blob_container_uri, output_blob_container_uri, custom_headers=None, raw=False, **operation_config):
import_devices_parameters = models.ImportDevicesRequest(input_blob_container_uri=input_blob_container_uri, output_blob_container_uri=output_blob_container_uri) url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices' path_for...
'Return distribution full name with - replaced with _'
@property def wheel_dist_name(self):
return '-'.join((safer_name(self.distribution.get_name()), safer_version(self.distribution.get_version())))
'Return archive name without extension'
def get_archive_basename(self):
(impl_tag, abi_tag, plat_tag) = self.get_tag() archive_basename = ('%s-%s-%s-%s' % (self.wheel_dist_name, impl_tag, abi_tag, plat_tag)) return archive_basename
'Return license filename from a license-file key in setup.cfg, or None.'
def license_file(self):
metadata = self.distribution.get_option_dict('metadata') if (not ('license_file' in metadata)): return None return metadata['license_file'][1]
'Generate requirements from setup.cfg as (\'Requires-Dist\', \'requirement; qualifier\') tuples. From a metadata section in setup.cfg: [metadata] provides-extra = extra1 extra2 requires-dist = requirement; qualifier another; qualifier2 unqualified Yields (\'Provides-Extra\', \'extra1\'), (\'Provides-Extra\', \'extra2\'...
def setupcfg_requirements(self):
metadata = self.distribution.get_option_dict('metadata') for (key, title) in (('provides_extra', 'Provides-Extra'), ('requires_dist', 'Requires-Dist')): if (not (key in metadata)): continue field = metadata[key] for line in field[1].splitlines(): line = line.strip...
'Add additional requirements from setup.cfg to file metadata_path'
def add_requirements(self, metadata_path):
additional = list(self.setupcfg_requirements()) if (not additional): return pkg_info = read_pkg_info(metadata_path) if (('Provides-Extra' in pkg_info) or ('Requires-Dist' in pkg_info)): warnings.warn('setup.cfg requirements overwrite values from setup.py') del pkg_...
'Convert an .egg-info directory into a .dist-info directory'
def egg2dist(self, egginfo_path, distinfo_path):
def adios(p): 'Appropriately delete directory, file or link.' if (os.path.exists(p) and (not os.path.islink(p)) and os.path.isdir(p)): shutil.rmtree(p) elif os.path.exists(p): os.unlink(p) adios(distinfo_path) if (not os.path.exists(egginfo_path...
'Update a Traffic Manager endpoint. :param resource_group_name: The name of the resource group containing the Traffic Manager endpoint to be updated. :type resource_group_name: str :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param endpoint_type: The type of the Traffic Manager...
def update(self, resource_group_name, profile_name, endpoint_type, endpoint_name, parameters, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}' path_format_arguments = {'resourceGroupName': self._serialize.url('resource_group_name', resource_group_name, 'str'), 'profileName': self._ser...
'Gets a Traffic Manager endpoint. :param resource_group_name: The name of the resource group containing the Traffic Manager endpoint. :type resource_group_name: str :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param endpoint_type: The type of the Traffic Manager endpoint. :type...
def get(self, resource_group_name, profile_name, endpoint_type, endpoint_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}' path_format_arguments = {'resourceGroupName': self._serialize.url('resource_group_name', resource_group_name, 'str'), 'profileName': self._ser...
'Create or update a Traffic Manager endpoint. :param resource_group_name: The name of the resource group containing the Traffic Manager endpoint to be created or updated. :type resource_group_name: str :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param endpoint_type: The type o...
def create_or_update(self, resource_group_name, profile_name, endpoint_type, endpoint_name, parameters, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}' path_format_arguments = {'resourceGroupName': self._serialize.url('resource_group_name', resource_group_name, 'str'), 'profileName': self._ser...
'Deletes a Traffic Manager endpoint. :param resource_group_name: The name of the resource group containing the Traffic Manager endpoint to be deleted. :type resource_group_name: str :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param endpoint_type: The type of the Traffic Manage...
def delete(self, resource_group_name, profile_name, endpoint_type, endpoint_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}' path_format_arguments = {'resourceGroupName': self._serialize.url('resource_group_name', resource_group_name, 'str'), 'profileName': self._ser...
'Checks the availability of a Traffic Manager Relative DNS name. :param name: The name of the resource. :type name: str :param type: The type of the resource. :type type: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized res...
def check_traffic_manager_relative_dns_name_availability(self, name=None, type=None, custom_headers=None, raw=False, **operation_config):
parameters = models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters(name=name, type=type) url = '/providers/Microsoft.Network/checkTrafficManagerNameAvailability' query_parameters = {} query_parameters['api-version'] = self._serialize.query('self.api_version', self.api_version, 'str') heade...
'Lists all Traffic Manager profiles within a resource group. :param resource_group_name: The name of the resource group containing the Traffic Manager profiles to be listed. :type resource_group_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response ...
def list_by_resource_group(self, resource_group_name, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles' path_format_arguments = {'resourceGroupName': self._serialize.url('resource_group_name', r...
'Lists all Traffic Manager profiles within a subscription. :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides<msrest:optionsforoperations>`. :rtype: :class...
def list_by_subscription(self, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 's...
'Gets a Traffic Manager profile. :param resource_group_name: The name of the resource group containing the Traffic Manager profile. :type resource_group_name: str :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param dict custom_headers: headers that will be added to the request :...
def get(self, resource_group_name, profile_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}' path_format_arguments = {'resourceGroupName': self._serialize.url('resource_group_name', resource_group_name, 'str'), 'profileName': self._serialize.url('profile_name', pro...
'Create or update a Traffic Manager profile. :param resource_group_name: The name of the resource group containing the Traffic Manager profile. :type resource_group_name: str :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param parameters: The Traffic Manager profile parameters s...
def create_or_update(self, resource_group_name, profile_name, parameters, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}' path_format_arguments = {'resourceGroupName': self._serialize.url('resource_group_name', resource_group_name, 'str'), 'profileName': self._serialize.url('profile_name', pro...
'Deletes a Traffic Manager profile. :param resource_group_name: The name of the resource group containing the Traffic Manager profile to be deleted. :type resource_group_name: str :param profile_name: The name of the Traffic Manager profile to be deleted. :type profile_name: str :param dict custom_headers: headers that...
def delete(self, resource_group_name, profile_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}' path_format_arguments = {'resourceGroupName': self._serialize.url('resource_group_name', resource_group_name, 'str'), 'profileName': self._serialize.url('profile_name', pro...
'Update a Traffic Manager profile. :param resource_group_name: The name of the resource group containing the Traffic Manager profile. :type resource_group_name: str :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param parameters: The Traffic Manager profile parameters supplied to...
def update(self, resource_group_name, profile_name, parameters, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}' path_format_arguments = {'resourceGroupName': self._serialize.url('resource_group_name', resource_group_name, 'str'), 'profileName': self._serialize.url('profile_name', pro...
'Gets the default Geographic Hierarchy used by the Geographic traffic routing method. :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides<msrest:optionsforo...
def get_default(self, custom_headers=None, raw=False, **operation_config):
url = '/providers/Microsoft.Network/trafficManagerGeographicHierarchies/default' query_parameters = {} query_parameters['api-version'] = self._serialize.query('self.api_version', self.api_version, 'str') header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' ...
'Return distribution full name with - replaced with _'
@property def wheel_dist_name(self):
return '-'.join((safer_name(self.distribution.get_name()), safer_version(self.distribution.get_version())))
'Return archive name without extension'
def get_archive_basename(self):
(impl_tag, abi_tag, plat_tag) = self.get_tag() archive_basename = ('%s-%s-%s-%s' % (self.wheel_dist_name, impl_tag, abi_tag, plat_tag)) return archive_basename
'Return license filename from a license-file key in setup.cfg, or None.'
def license_file(self):
metadata = self.distribution.get_option_dict('metadata') if (not ('license_file' in metadata)): return None return metadata['license_file'][1]
'Generate requirements from setup.cfg as (\'Requires-Dist\', \'requirement; qualifier\') tuples. From a metadata section in setup.cfg: [metadata] provides-extra = extra1 extra2 requires-dist = requirement; qualifier another; qualifier2 unqualified Yields (\'Provides-Extra\', \'extra1\'), (\'Provides-Extra\', \'extra2\'...
def setupcfg_requirements(self):
metadata = self.distribution.get_option_dict('metadata') for (key, title) in (('provides_extra', 'Provides-Extra'), ('requires_dist', 'Requires-Dist')): if (not (key in metadata)): continue field = metadata[key] for line in field[1].splitlines(): line = line.strip...
'Add additional requirements from setup.cfg to file metadata_path'
def add_requirements(self, metadata_path):
additional = list(self.setupcfg_requirements()) if (not additional): return pkg_info = read_pkg_info(metadata_path) if (('Provides-Extra' in pkg_info) or ('Requires-Dist' in pkg_info)): warnings.warn('setup.cfg requirements overwrite values from setup.py') del pkg_...
'Convert an .egg-info directory into a .dist-info directory'
def egg2dist(self, egginfo_path, distinfo_path):
def adios(p): 'Appropriately delete directory, file or link.' if (os.path.exists(p) and (not os.path.islink(p)) and os.path.isdir(p)): shutil.rmtree(p) elif os.path.exists(p): os.unlink(p) adios(distinfo_path) if (not os.path.exists(egginfo_path...
'Parses an HTTP WWW-Authentication Bearer challenge from a server.'
def __init__(self, request_uri, challenge):
self.source_authority = self._validate_request_uri(request_uri) self.source_uri = request_uri self._parameters = {} trimmed_challenge = self._validate_challenge(challenge) for item in trimmed_challenge.split(','): comps = item.split('=') if (len(comps) == 2): key = comps[...
'Tests whether an authentication header is a Bearer challenge. :param authentication_header: the authentication header to test rtype: bool'
@staticmethod def is_bearer_challenge(authentication_header):
if (not authentication_header): return False return authentication_header.strip().startswith('Bearer ')
'Returns the URI for the authorization server if present, otherwise empty string.'
def get_authorization_server(self):
value = '' for key in ['authorization_uri', 'authorization']: value = (self.get_value(key) or '') if value: break return value
'Returns the resource if present, otherwise empty string.'
def get_resource(self):
return (self.get_value('resource') or '')
'Returns the scope if present, otherwise empty string.'
def get_scope(self):
return (self.get_value('scope') or '')
'Verifies that the challenge is a Bearer challenge and returns the key=value pairs.'
def _validate_challenge(self, challenge):
bearer_string = 'Bearer ' if (not challenge): raise ValueError('Challenge cannot be empty') challenge = challenge.strip() if (not challenge.startswith(bearer_string)): raise ValueError('Challenge is not Bearer') return challenge[len(bearer_string):]
'Extracts the host authority from the given URI.'
def _validate_request_uri(self, uri):
if (not uri): raise ValueError('request_uri cannot be empty') uri = parse.urlparse(uri) if (not uri.netloc): raise ValueError('request_uri must be an absolute URI') if (uri.scheme.lower() not in ['http', 'https']): raise ValueError('request_uri must ...
':param collection: The resource collection type. :type collection: str :param vault: The vault URI. :type vault: str :param name: The resource name. :type name: str :param version: The resource version. :type version: str'
def __init__(self, collection, vault, name, version):
self.vault = vault self.name = name self.collection = collection self.version = (version or KeyVaultId.version_none)
':return: The identifier string of the current KeyVaultId :rtype: str'
def __str__(self):
return self.id
':param collection: The resource collection type. :type collection: str :param vault: The vault URI. :type vault: str :param name: The resource name. :type name: str :param version: The resource version. :type version: str :rtype: KeyVaultId'
@staticmethod def create_object_id(collection, vault, name, version):
collection = _validate_string_argument(collection, 'collection') vault = _validate_string_argument(vault, 'vault') name = _validate_string_argument(name, 'name') version = _validate_string_argument(version, 'version', True) _parse_uri_argument(vault) return KeyVaultIdentifier(collection=collecti...
':param collection: The resource collection type. :type collection: str :param id: The resource uri. :type id: str :rtype: KeyVaultId'
@staticmethod def parse_object_id(collection, id):
collection = _validate_string_argument(collection, 'collection') return KeyVaultIdentifier(uri=id, collection=collection)
':param vault: The vault uri. :type vault: str :param name: The key name. :type name: str :param version: The key version. :type version: str :rtype: KeyVaultId'
@staticmethod def create_key_id(vault, name, version=None):
return KeyId(vault=vault, name=name, version=version)
':param id: The key uri. :type id: str :rtype: KeyVaultId'
@staticmethod def parse_key_id(id):
return KeyId(id)
':param vault: The vault uri. :type vault: str :param name: The secret name. :type name: str :param version: The secret version. :type version: str :rtype: KeyVaultId'
@staticmethod def create_secret_id(vault, name, version=None):
return SecretId(vault=vault, name=name, version=version)
':param id: The secret uri. :type id: str :rtype: KeyVaultId'
@staticmethod def parse_secret_id(id):
return SecretId(id)
':param vault: The vault uri. :type vault: str :param name: The certificate name. :type name: str :param version: The certificate version. :type version: str :rtype: KeyVaultId'
@staticmethod def create_certificate_id(vault, name, version=None):
return CertificateId(vault=vault, name=name, version=version)
':param id: The resource collection type. :type id: str :rtype: KeyVaultId'
@staticmethod def parse_certificate_id(id):
return CertificateId(id)
':param vault: The vault uri. :type vault: str :param name: The certificate name. :type name: str :rtype: KeyVaultId'
@staticmethod def create_certificate_operation_id(vault, name):
return CertificateOperationId(vault=vault, name=name)
':param id: The resource collection type. :type id: str :rtype: KeyVaultId'
@staticmethod def parse_certificate_operation_id(id):
return CertificateOperationId(id)
':param vault: The vault uri. :type vault: str :param name: The certificate name. :type name: str :rtype: KeyVaultId'
@staticmethod def create_certificate_issuer_id(vault, name):
return CertificateIssuerId(vault=vault, name=name)
':param id: The resource collection type. :type id: str :rtype: KeyVaultId'
@staticmethod def parse_certificate_issuer_id(id):
return CertificateIssuerId(id)
'Creates a KeyVaultIdentifier based of the specified uri or keyword arguments :param uri: The uri of the key vault object identifier :param kwargs: The format parameters for the key vault object identifier. If uri is specified these are used to validate the components of the uri.'
def __init__(self, uri=None, **kwargs):
self.version = KeyVaultIdentifier.version_none for (key, value) in kwargs.items(): self.__dict__[key] = _validate_string_argument(value, key, True) self.version = (self.version or KeyVaultIdentifier.version_none) if uri: self._parse(uri, kwargs)
':return: The full key vault object identifier uri'
@property def id(self):
return self._format()
':return: The version-less key vault object identifier uri,'
@property def base_id(self):
return self._format(fmt=self._id_format.replace('/{version?}', ''))
'Formats the KeyVaultIdentifier into a identifier uri based of the specified format string :param fmt: The format string for the identifier uri :return: The formatted key vault object identifier uri'
def _format(self, fmt=None):
fmt = (fmt or self._id_format) segments = [] for fmt_seg in fmt.split('/'): if (fmt_seg.startswith('{') and fmt_seg.endswith('}')): fmt_seg = fmt_seg[1:(-1)] fmt_prop = fmt_seg.rstrip('?') seg_val = getattr(self, fmt_prop) if seg_val: s...
'Parses the specified uri, using _id_format as a format string, and sets the parsed format arguments as attributes on the current id object. :param uri: The key vault identifier uri to be parsed :param validation_args: format arguments to be validated :return: None'
def _parse(self, uri, validation_args):
def format_error(): return ValueError('invalid id: The specified uri "{}", does to match the specified format "{}"'.format(uri, self._id_format)) uri = _validate_string_argument(uri, 'uri') parsed_uri = _parse_uri_argument(uri) id_segs = list(filter(None, pars...
'Creates a key vault key id. If uri is specified the id properties are parsed from the uri, otherwise builds the id from the specified vault, name and version. :param uri: The uri of the key vault key :param vault: The vault uri :param name: The key name :param version: The key version'
def __init__(self, uri=None, vault=None, name=None, version=None):
super(KeyId, self).__init__(uri=uri, collection='keys', vault=vault, name=name, version=version)
'Creates a key vault secret id. If uri is specified the id properties are parsed from the uri, otherwise builds the id from the specified vault, name and version. :param uri: The uri of the key vault secret :param vault: The vault uri :param name: The secret name :param version: The secret version'
def __init__(self, uri=None, vault=None, name=None, version=None):
super(SecretId, self).__init__(uri=uri, collection='secrets', vault=vault, name=name, version=version)
'Creates a key vault certificate id. If uri is specified the id properties are parsed from the uri, otherwise builds the id from the specified vault, name and version. :param uri: The uri of the key vault certificate :param vault: The vault uri :param name: The certificate name :param version: The certificate version...
def __init__(self, uri=None, vault=None, name=None, version=None):
super(CertificateId, self).__init__(uri=uri, collection='certificates', vault=vault, name=name, version=version)
'Creates a key vault certificate operation id. If uri is specified the id properties are parsed from the uri, otherwise builds the id from the specified vault and name. :param uri: The uri of the key vault certificate operation :param vault: The vault uri :param name: The certificate name'
def __init__(self, uri=None, vault=None, name=None):
super(CertificateOperationId, self).__init__(uri=uri, collection='certificates', version='pending', vault=vault, name=name)
'Creates a key vault certificate issuer id. If uri is specified the id properties are parsed from the uri, otherwise builds the id from the specified vault and name. :param uri: The uri of the key vault certificate issuer :param vault: The vault uri :param name: The certificate issuer name'
def __init__(self, uri=None, vault=None, name=None):
super(CertificateIssuerId, self).__init__(uri=uri, collection='certificates', vault=vault, name=name)
'Creates a key vault storage account id. If uri is specified the id properties are parsed from the uri, otherwise builds the id from the specified vault and name. :param uri: The uri of the key vault storage account :param vault: The vault uri :param name: The storage account name'
def __init__(self, uri=None, vault=None, name=None):
super(StorageAccountId, self).__init__(uri=uri, collection='storage', vault=vault, name=name)
'Creates a key vault storage account sas definition id. If uri is specified the id properties are parsed from the uri, otherwise builds the id from the specified vault, account_name, and sas_definition. :param uri: The uri of the key vault storage account sas definition :param vault: The vault uri :param account_name...
def __init__(self, uri=None, vault=None, account_name=None, sas_definition=None):
super(StorageSasDefinitionId, self).__init__(uri=uri, collection='storage', vault=vault, account_name=account_name, sas_definition=sas_definition)
'Creates a new KeyVaultAuthBase instance used for handling authentication challenges, by hooking into the request AuthBase extension model. :param authorization_callback: A callback used to provide authentication credentials to the key vault data service. This callback should take three str arguments: authorization uri...
def __init__(self, authorization_callback):
self._callback = authorization_callback self._token = None self._thread_local = threading.local() self._thread_local.pos = None self._thread_local.auth_attempted = False
'Called prior to requests being sent. :param request: Request to be sent :return: returns the original request, registering hooks on the response if it is the first time this url has been called and an auth challenge might be returned'
def __call__(self, request):
if self._callback: challenge = ChallengeCache.get_challenge_for_url(request.url) if challenge: self.set_authorization_header(request, challenge) else: try: self._thread_local.pos = request.body.tell() except AttributeError: ...
'Reset auth_attempted on redirects.'
def handle_redirect(self, r, **kwargs):
if r.is_redirect: self._thread_local.auth_attempted = False
'Takes the response authenticates and resends if neccissary :return: The final response to the authenticated request :rtype: requests.Response'
def handle_401(self, response, **kwargs):
if (not (response.status_code == 401)): self._thread_local.auth_attempted = False return response auth_header = response.headers.get('www-authenticate', '') if (not HttpBearerChallenge.is_bearer_challenge(auth_header)): self._thread_local.auth_attempted = False return respons...
'Creates a new KeyVaultAuthentication instance used for authentication in the KeyVaultClient :param authorization_callback: A callback used to provide authentication credentials to the key vault data service. This callback should take three str arguments: authorization uri, resource, and scope, and return a tuple of (t...
def __init__(self, authorization_callback):
super(KeyVaultAuthentication, self).__init__() self.auth = KeyVaultAuthBase(authorization_callback) self._callback = authorization_callback
'Gets the Base64 pending certificate signing request (PKCS-10). :param vault_base_url: The vault name, e.g. https://myvault.vault.azure.net :type vault_base_url: str :param certificate_name: The name of the certificate :type certificate_name: str :param dict custom_headers: headers that will be added to the request :pa...
def get_pending_certificate_signing_request(self, vault_base_url, certificate_name, custom_headers=None, raw=False, **operation_config):
url = '/certificates/{certificate-name}/pending' path_format_arguments = {'vaultBaseUrl': self._serialize.url('vault_base_url', vault_base_url, 'str', skip_quote=True), 'certificate-name': self._serialize.url('certificate_name', certificate_name, 'str')} url = self._client.format_url(url, **path_format_argu...
'Creates a new key, stores it, then returns key parameters and attributes to the client. The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. :param vault_base_url: The vault name, for example https://myvault.v...
def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops=None, key_attributes=None, tags=None, custom_headers=None, raw=False, **operation_config):
parameters = models.KeyCreateParameters(kty=kty, key_size=key_size, key_ops=key_ops, key_attributes=key_attributes, tags=tags) url = '/keys/{key-name}/create' path_format_arguments = {'vaultBaseUrl': self._serialize.url('vault_base_url', vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.u...
'Imports an externally created key, stores it, and returns key parameters and attributes to the client. The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. :param vault_base_url: The vault name, for examp...
def import_key(self, vault_base_url, key_name, key, hsm=None, key_attributes=None, tags=None, custom_headers=None, raw=False, **operation_config):
parameters = models.KeyImportParameters(hsm=hsm, key=key, key_attributes=key_attributes, tags=tags) url = '/keys/{key-name}' path_format_arguments = {'vaultBaseUrl': self._serialize.url('vault_base_url', vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url('key_name', key_name, 'str', pa...
'Deletes a key of any type from storage in Azure Key Vault. The delete key operation cannot be used to remove individual versions of a key. This operation removes the cryptographic material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. :param vaul...
def delete_key(self, vault_base_url, key_name, custom_headers=None, raw=False, **operation_config):
url = '/keys/{key-name}' path_format_arguments = {'vaultBaseUrl': self._serialize.url('vault_base_url', vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url('key_name', key_name, 'str')} url = self._client.format_url(url, **path_format_arguments) query_parameters = {} query_param...
'The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a key itself cannot be changed. :param vault_base_url:...
def update_key(self, vault_base_url, key_name, key_version, key_ops=None, key_attributes=None, tags=None, custom_headers=None, raw=False, **operation_config):
parameters = models.KeyUpdateParameters(key_ops=key_ops, key_attributes=key_attributes, tags=tags) url = '/keys/{key-name}/{key-version}' path_format_arguments = {'vaultBaseUrl': self._serialize.url('vault_base_url', vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url('key_name', key_na...
'Gets the public part of a stored key. The get key operation is applicable to all key types. If the requested key is symmetric, then no key material is released in the response. :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the...
def get_key(self, vault_base_url, key_name, key_version, custom_headers=None, raw=False, **operation_config):
url = '/keys/{key-name}/{key-version}' path_format_arguments = {'vaultBaseUrl': self._serialize.url('vault_base_url', vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url('key_name', key_name, 'str'), 'key-version': self._serialize.url('key_version', key_version, 'str')} url = self._clie...
'Retrieves a list of individual key versions with the same key name. The full key identifier, attributes, and tags are provided in the response. :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param ...
def get_key_versions(self, vault_base_url, key_name, maxresults=None, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/keys/{key-name}/versions' path_format_arguments = {'vaultBaseUrl': self._serialize.url('vault_base_url', vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url('key_name', key_name, 'str')} ...
'List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a stored key. The LIST operation is applicable to all key types, however only the base key identifier,attributes, and tags are provided in the response. Individual versions of a ke...
def get_keys(self, vault_base_url, maxresults=None, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/keys' path_format_arguments = {'vaultBaseUrl': self._serialize.url('vault_base_url', vault_base_url, 'str', skip_quote=True)} url = self._client.format_url(url, **path_format_arguments) ...
'Requests that a backup of the specified key be downloaded to the client. The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation does NOT return key material in a form that can be used outside the Azure Key Vault system, the returned key material is either protected to...
def backup_key(self, vault_base_url, key_name, custom_headers=None, raw=False, **operation_config):
url = '/keys/{key-name}/backup' path_format_arguments = {'vaultBaseUrl': self._serialize.url('vault_base_url', vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url('key_name', key_name, 'str')} url = self._client.format_url(url, **path_format_arguments) query_parameters = {} quer...
'Restores a backed up key to a vault. Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, attributes and access control policies. The RESTORE operation may be used to import a previously backed up key. Individual versions of a key cannot be restored. The key is restored in it...
def restore_key(self, vault_base_url, key_bundle_backup, custom_headers=None, raw=False, **operation_config):
parameters = models.KeyRestoreParameters(key_bundle_backup=key_bundle_backup) url = '/keys/restore' path_format_arguments = {'vaultBaseUrl': self._serialize.url('vault_base_url', vault_base_url, 'str', skip_quote=True)} url = self._client.format_url(url, **path_format_arguments) query_parameters = {...
'Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is stored in Azure Key Vault. Note that the ENCRYPT operation only supports a single block of data, the size of which is dependent on...
def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, custom_headers=None, raw=False, **operation_config):
parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) url = '/keys/{key-name}/{key-version}/encrypt' path_format_arguments = {'vaultBaseUrl': self._serialize.url('vault_base_url', vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url('key_name', key_name, 'str'), '...
'Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption key and specified algorithm. This operation is the reverse of the ENCRYPT operation; only a single block of data may be decrypted, the size of this block is dependent on the target ke...
def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, custom_headers=None, raw=False, **operation_config):
parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) url = '/keys/{key-name}/{key-version}/decrypt' path_format_arguments = {'vaultBaseUrl': self._serialize.url('vault_base_url', vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url('key_name', key_name, 'str'), '...
'Creates a signature from a digest using the specified key. The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault since this operation uses the private portion of the key. :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str ...
def sign(self, vault_base_url, key_name, key_version, algorithm, value, custom_headers=None, raw=False, **operation_config):
parameters = models.KeySignParameters(algorithm=algorithm, value=value) url = '/keys/{key-name}/{key-version}/sign' path_format_arguments = {'vaultBaseUrl': self._serialize.url('vault_base_url', vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url('key_name', key_name, 'str'), 'key-versi...