docstring
stringlengths
52
499
function
stringlengths
67
35.2k
__index_level_0__
int64
52.6k
1.16M
Load windows for chunks-wise processing from raster internal tiling (first raster of given resolution). Arguments: res {numeric} -- Resolution determining the raster (1st of resolution group) from which to take the tiling.
def block_windows(self, res=None): # setter and getter ? if res is None: res = max(self._res_indices.keys()) self._windows_res = res a_file_index_given_res = self._res_indices[res][0] with rasterio.open(self._layer_files[a_file_index_given_res]) as src: ...
606,373
Create rasterio.windows.Window instances with given size which fully cover the raster. Arguments: blocksize_xy {int or list of two int} -- Size of the window. If one integer is given it defines the width and height of the window. If a list of two integers if given the first defines ...
def windows_from_blocksize(self, blocksize_xy=512): meta = self._get_template_for_given_resolution(self.dst_res, "meta") width = meta["width"] height = meta["height"] blocksize_wins = windows_from_blocksize(blocksize_xy, width, height) self.windows = np.array([win[1] fo...
606,374
For a given specific window, i.e. an element of :attr:`windows`, get the windows of all resolutions. Arguments: ij_win {int} -- The index specifying the window for which to return the resolution-windows.
def ji_windows(self, ij_win): # what can be given to ij_win NOT intuitive/right name by now!!! ji_windows = {} transform_src = self._layer_meta[self._res_indices[self._windows_res][0]]["transform"] for res in self._res_indices: transform_dst = self._layer_meta[self._res_ind...
606,377
Get the data of the a window given the ji_windows derived with :method:`ji_windows`. Arguments: ji_win {[type]} -- The index of the window or the (multi-resolution) windows returned by :meth:`ji_window`. Returns: (list of) array(s) -- List of 2D arrays in native resolution in c...
def get_arrays(self, ji_win): if isinstance(ji_win, dict): ji_windows = ji_win else: ji_windows = self.ji_windows(ji_win) arrays = [] for filename, res in zip(self._layer_files, self._layer_resolution): with rasterio.open(filename) as src: ...
606,378
Using a CSS selector, get the element and return the given attribute value, or None if no element. Args: document (HTMLElement) - HTMLElement document selector (str) - CSS selector attribute (str) - The attribute to get from the element
def _get_element_attr_or_none(document, selector, attribute): element = document.cssselect(selector) if element: return element[0].get(attribute) return None
606,470
Do an HTTP GET request and return JSON. Args: endpoint (str): Azure Resource Manager management endpoint. access_token (str): A valid Azure authentication token. Returns: HTTP response. JSON body.
def do_get(endpoint, access_token): headers = {"Authorization": 'Bearer ' + access_token} headers['User-Agent'] = get_user_agent() return requests.get(endpoint, headers=headers).json()
607,967
Do an HTTP GET request, follow the nextLink chain and return JSON. Args: endpoint (str): Azure Resource Manager management endpoint. access_token (str): A valid Azure authentication token. Returns: HTTP response. JSON body.
def do_get_next(endpoint, access_token): headers = {"Authorization": 'Bearer ' + access_token} headers['User-Agent'] = get_user_agent() looping = True value_list = [] vm_dict = {} while looping: get_return = requests.get(endpoint, headers=headers).json() if not 'value' in ge...
607,968
Do an HTTP GET request and return JSON. Args: endpoint (str): Azure Resource Manager management endpoint. access_token (str): A valid Azure authentication token. Returns: HTTP response.
def do_delete(endpoint, access_token): headers = {"Authorization": 'Bearer ' + access_token} headers['User-Agent'] = get_user_agent() return requests.delete(endpoint, headers=headers)
607,969
Do an HTTP PATCH request and return JSON. Args: endpoint (str): Azure Resource Manager management endpoint. body (str): JSON body of information to patch. access_token (str): A valid Azure authentication token. Returns: HTTP response. JSON body.
def do_patch(endpoint, body, access_token): headers = {"content-type": "application/json", "Authorization": 'Bearer ' + access_token} headers['User-Agent'] = get_user_agent() return requests.patch(endpoint, data=body, headers=headers)
607,970
Do an HTTP POST request and return JSON. Args: endpoint (str): Azure Resource Manager management endpoint. body (str): JSON body of information to post. access_token (str): A valid Azure authentication token. Returns: HTTP response. JSON body.
def do_post(endpoint, body, access_token): headers = {"content-type": "application/json", "Authorization": 'Bearer ' + access_token} headers['User-Agent'] = get_user_agent() return requests.post(endpoint, data=body, headers=headers)
607,971
Do an HTTP PUT request and return JSON. Args: endpoint (str): Azure Resource Manager management endpoint. body (str): JSON body of information to put. access_token (str): A valid Azure authentication token. Returns: HTTP response. JSON body.
def do_put(endpoint, body, access_token): headers = {"content-type": "application/json", "Authorization": 'Bearer ' + access_token} headers['User-Agent'] = get_user_agent() return requests.put(endpoint, data=body, headers=headers)
607,972
Get Media Services Final Endpoint URL. Args: access_token (str): A valid Azure authentication token. endpoint (str): Azure Media Services Initial Endpoint. flag (bol): flag. Returns: HTTP response. JSON body.
def get_url(access_token, endpoint=ams_rest_endpoint, flag=True): return do_ams_get_url(endpoint, access_token, flag)
607,973
Acquire Media Services Authentication Token. Args: endpoint (str): Azure Media Services Initial Endpoint. body (str): A Content Body. Returns: HTTP response. JSON body.
def do_ams_auth(endpoint, body): headers = {"content-type": "application/x-www-form-urlencoded", "Accept": json_acceptformat} return requests.post(endpoint, data=body, headers=headers)
607,974
Do a AMS HTTP PUT request and return JSON. Args: endpoint (str): Azure Media Services Initial Endpoint. path (str): Azure Media Services Endpoint Path. body (str): Azure Media Services Content Body. access_token (str): A valid Azure authentication token. rformat (str): A req...
def do_ams_put(endpoint, path, body, access_token, rformat="json", ds_min_version="3.0;NetFx"): min_ds = dsversion_min content_acceptformat = json_acceptformat if rformat == "json_only": min_ds = ds_min_version content_acceptformat = json_only_acceptformat headers = {"Content-Ty...
607,975
Do a AMS HTTP POST request and return JSON. Args: endpoint (str): Azure Media Services Initial Endpoint. path (str): Azure Media Services Endpoint Path. body (str): Azure Media Services Content Body. access_token (str): A valid Azure authentication token. rformat (str): A re...
def do_ams_post(endpoint, path, body, access_token, rformat="json", ds_min_version="3.0;NetFx"): min_ds = dsversion_min content_acceptformat = json_acceptformat acceptformat = json_acceptformat if rformat == "json_only": min_ds = ds_min_version content_acceptformat = json_only_accep...
607,976
Do a AMS PATCH request and return JSON. Args: endpoint (str): Azure Media Services Initial Endpoint. path (str): Azure Media Services Endpoint Path. body (str): Azure Media Services Content Body. access_token (str): A valid Azure authentication token. Returns: HTTP resp...
def do_ams_patch(endpoint, path, body, access_token): headers = {"Content-Type": json_acceptformat, "DataServiceVersion": dsversion_min, "MaxDataServiceVersion": dsversion_max, "Accept": json_acceptformat, "Accept-Charset" : charset, "A...
607,977
Do a AMS DELETE request and return JSON. Args: endpoint (str): Azure Media Services Initial Endpoint. path (str): Azure Media Services Endpoint Path. access_token (str): A valid Azure authentication token. Returns: HTTP response. JSON body.
def do_ams_delete(endpoint, path, access_token): headers = {"DataServiceVersion": dsversion_min, "MaxDataServiceVersion": dsversion_max, "Accept": json_acceptformat, "Accept-Charset" : charset, "Authorization": 'Bearer ' + access_token, ...
607,978
Do a PUT request to the Azure Storage API and return JSON. Args: endpoint (str): Azure Media Services Initial Endpoint. body (str): Azure Media Services Content Body. content_length (str): Content_length. Returns: HTTP response. JSON body.
def do_ams_sto_put(endpoint, body, content_length): headers = {"Accept": json_acceptformat, "Accept-Charset" : charset, "x-ms-blob-type" : "BlockBlob", "x-ms-meta-m1": "v1", "x-ms-meta-m2": "v2", "x-ms-version" : "2015-02-21", ...
607,979
Do an AMS GET request to retrieve the Final AMS Endpoint and return JSON. Args: endpoint (str): Azure Media Services Initial Endpoint. access_token (str): A valid Azure authentication token. flag (str): A Flag to follow the redirect or not. Returns: HTTP response. JSON body.
def do_ams_get_url(endpoint, access_token, flag=True): headers = {"Content-Type": json_acceptformat, "DataServiceVersion": dsversion_min, "MaxDataServiceVersion": dsversion_max, "Accept": json_acceptformat, "Accept-Charset" : charset, "...
607,980
Extract a multi-line string from a string array, up to a specified end marker. Args: end_mark (str): The end mark string to match for. current_str (str): The first line of the string array. str_array (list): An array of strings (lines). line_num (int): The curren...
def extract_code(end_mark, current_str, str_array, line_num): if end_mark not in current_str: reached_end = False line_num += 1 while reached_end is False: next_line = str_array[line_num] if end_mark in next_line: reached_end = True el...
607,983
Process a Python source file with Google style docstring comments. Reads file header comment, function definitions, function docstrings. Returns dictionary encapsulation for subsequent writing. Args: pyfile_name (str): file name to read. Returns: Dictionary object containing summary c...
def process_file(pyfile_name): print('Processing file: ' + pyfile_name) # load the source file with open(pyfile_name) as fpyfile: pyfile_str = fpyfile.readlines() # meta-doc for a source file file_dict = {'source_file': pyfile_name.replace('\\', '/')} # get file summary line at t...
607,984
Create a markdown format documentation file. Args: meta_file (dict): Dictionary with documentation metadata. outfile_name (str): Markdown file to write to.
def process_output(meta_file, outfile_name, code_links): # Markdown title line doc_str = '# ' + meta_file['header'] + '\n' doc_str += 'Generated by [py2md](https://github.com/gbowerman/py2md) on ' doc_str += strftime("%Y-%m-%d %H:%M:%S ") + '\n\n' # Create a table of contents if more than one...
607,985
Delete a named container. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. service_name (str): Name of container service. Returns: HTTP response.
def delete_container_service(access_token, subscription_id, resource_group, service_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', resource_group, '/providers/Microsoft.ContainerServic...
607,988
Get details about an Azure Container Server Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. service_name (str): Name of container service. Returns: HTTP response...
def get_container_service(access_token, subscription_id, resource_group, service_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', resource_group, '/providers/Microsoft.ContainerService/C...
607,989
List the container services in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. Returns: HTTP response. JSON model.
def list_container_services(access_token, subscription_id, resource_group): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', resource_group, '/providers/Microsoft.ContainerService/ContainerServ...
607,990
List the container services in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON model.
def list_container_services_sub(access_token, subscription_id): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.ContainerService/ContainerServices', '?api-version=', ACS_API]) return do_...
607,991
Delete a storage account in the specified resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. account_name (str): Name of the new storage account. Returns: H...
def delete_storage_account(access_token, subscription_id, rgname, account_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', accoun...
607,993
Get the properties for the named storage account. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. account_name (str): Name of the new storage account. Returns: HTTP resp...
def get_storage_account(access_token, subscription_id, rgname, account_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', account_n...
607,994
Get the access keys for the specified storage account. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. account_name (str): Name of the new storage account. Returns: HTTP...
def get_storage_account_keys(access_token, subscription_id, rgname, account_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', acco...
607,995
Returns storage usage and quota information for the specified subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of storage account usage.
def get_storage_usage(access_token, subscription_id, location): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Storage/locations/', location, '/usages', '?api-versio...
607,996
List the storage accounts in the specified resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP response. JSON body list of storage accounts.
def list_storage_accounts_rg(access_token, subscription_id, rgname): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts', ...
607,997
List the storage accounts in the specified subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body list of storage accounts.
def list_storage_accounts_sub(access_token, subscription_id): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Storage/storageAccounts', '?api-version=', STORAGE_API]) return do_get(endpo...
607,998
Check media service name availability. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. msname (str): media service name. Returns: HTTP response.
def check_media_service_name_availability(access_token, subscription_id, msname): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/microsoft.media/CheckNameAvailability?', 'api-version=', MEDIA_API]) ...
608,004
Create a media service in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. location (str): Azure data center location. E.g. westus. stoname (str): Azure stor...
def create_media_service_rg(access_token, subscription_id, rgname, location, stoname, msname): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', rgname, '/providers/microsoft.media/mediaservices...
608,005
Delete a media service. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. msname (str): Media service name. Returns: HTTP response.
def delete_media_service_rg(access_token, subscription_id, rgname, msname): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', rgname, '/providers/microsoft.media/mediaservices/', msname, ...
608,006
list the media endpoint keys in a media service Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. msname (str): Media service name. Returns: HTTP response. JSON body.
def list_media_endpoint_keys(access_token, subscription_id, rgname, msname): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', rgname, '/providers/microsoft.media/', '/me...
608,007
List the media services in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body.
def list_media_services(access_token, subscription_id): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/microsoft.media/mediaservices?api-version=', MEDIA_API]) return do_get(endpoint, access_token)
608,008
List the media services in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP response. JSON body.
def list_media_services_rg(access_token, subscription_id, rgname): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', rgname, '/providers/microsoft.media/mediaservices?api-version=', MEDIA_API]) ...
608,009
Get Media Services Authentication Token. Args: accountname (str): Azure Media Services account name. accountkey (str): Azure Media Services Key. Returns: HTTP response. JSON body.
def get_ams_access_token(accountname, accountkey): accountkey_encoded = urllib.parse.quote(accountkey, safe='') body = "grant_type=client_credentials&client_id=" + accountname + \ "&client_secret=" + accountkey_encoded + " &scope=urn%3aWindowsAzureMediaServices" return do_ams_auth(ams_auth_endpoint, b...
608,010
Create Media Service Asset. Args: access_token (str): A valid Azure authentication token. name (str): Media Service Asset Name. options (str): Media Service Options. Returns: HTTP response. JSON body.
def create_media_asset(access_token, name, options="0"): path = '/Assets' endpoint = ''.join([ams_rest_endpoint, path]) body = '{"Name": "' + name + '", "Options": "' + str(options) + '"}' return do_ams_post(endpoint, path, body, access_token)
608,011
Create Media Service SAS Locator. Args: access_token (str): A valid Azure authentication token. asset_id (str): Media Service Asset ID. accesspolicy_id (str): Media Service Access Policy ID. Returns: HTTP response. JSON body.
def create_sas_locator(access_token, asset_id, accesspolicy_id): path = '/Locators' endpoint = ''.join([ams_rest_endpoint, path]) body = '{ \ "AccessPolicyId":"' + accesspolicy_id + '", \ "AssetId":"' + asset_id + '", \ "Type":1 \ }' return do_ams_post(endpoint, path, body, access_token)
608,013
Create Media Service Asset Delivery Policy. Args: access_token (str): A valid Azure authentication token. ams_account (str): Media Service Account. Returns: HTTP response. JSON body.
def create_asset_delivery_policy(access_token, ams_account, key_delivery_url): path = '/AssetDeliveryPolicies' endpoint = ''.join([ams_rest_endpoint, path]) body = '{ \ "Name":"AssetDeliveryPolicy", \ "AssetDeliveryProtocol":"4", \ "AssetDeliveryPolicyType":"3", \ "AssetDeliveryConfiguration":"...
608,014
Create Media Service Content Key Authorization Policy. Args: access_token (str): A valid Azure authentication token. content (str): Content Payload. Returns: HTTP response. JSON body.
def create_contentkey_authorization_policy(access_token, content): path = '/ContentKeyAuthorizationPolicies' endpoint = ''.join([ams_rest_endpoint, path]) body = content return do_ams_post(endpoint, path, body, access_token)
608,015
Create Media Service Content Key Authorization Policy Options. Args: access_token (str): A valid Azure authentication token. key_delivery_type (str): A Media Service Content Key Authorization Policy Delivery Type. name (str): A Media Service Contenty Key Authorization Policy Name. k...
def create_contentkey_authorization_policy_options(access_token, key_delivery_type="2", \ name="HLS Open Authorization Policy", key_restriction_type="0"): path = '/ContentKeyAuthorizationPolicyOptions' endpoint = ''.join([ams_rest_endpoint, path]) body = '{ \ "Name":"policy",\ "KeyDeliveryType":"' ...
608,016
Create Media Service OnDemand Streaming Locator. Args: access_token (str): A valid Azure authentication token. encoded_asset_id (str): A Media Service Encoded Asset ID. pid (str): A Media Service Encoded PID. starttime (str): A Media Service Starttime. Returns: HTTP res...
def create_ondemand_streaming_locator(access_token, encoded_asset_id, pid, starttime=None): path = '/Locators' endpoint = ''.join([ams_rest_endpoint, path]) if starttime is None: body = '{ \ "AccessPolicyId":"' + pid + '", \ "AssetId":"' + encoded_asset_id + '", \ "Type": "2" \ }' ...
608,017
Create Media Service Asset Access Policy. Args: access_token (str): A valid Azure authentication token. name (str): A Media Service Asset Access Policy Name. duration (str): A Media Service duration. permission (str): A Media Service permission. Returns: HTTP response. ...
def create_asset_accesspolicy(access_token, name, duration, permission="1"): path = '/AccessPolicies' endpoint = ''.join([ams_rest_endpoint, path]) body = '{ \ "Name": "' + str(name) + '", \ "DurationInMinutes": "' + duration + '", \ "Permissions": "' + permission + '" \ }' return do_ams_pos...
608,018
Create Media Service Streaming Endpoint. Args: access_token (str): A valid Azure authentication token. name (str): A Media Service Streaming Endpoint Name. description (str): A Media Service Streaming Endpoint Description. scale_units (str): A Media Service Scale Units Number. ...
def create_streaming_endpoint(access_token, name, description="New Streaming Endpoint", \ scale_units="1"): path = '/StreamingEndpoints' endpoint = ''.join([ams_rest_endpoint, path]) body = '{ \ "Id":null, \ "Name":"' + name + '", \ "Description":"' + description + '", \ "Created":"0001-01-01T0...
608,019
Scale Media Service Streaming Endpoint. Args: access_token (str): A valid Azure authentication token. streaming_endpoint_id (str): A Media Service Streaming Endpoint ID. scale_units (str): A Media Service Scale Units Number. Returns: HTTP response. JSON body.
def scale_streaming_endpoint(access_token, streaming_endpoint_id, scale_units): path = '/StreamingEndpoints' full_path = ''.join([path, "('", streaming_endpoint_id, "')", "/Scale"]) full_path_encoded = urllib.parse.quote(full_path, safe='') endpoint = ''.join([ams_rest_endpoint, full_path_encoded])...
608,020
Link Media Service Asset and Content Key. Args: access_token (str): A valid Azure authentication token. asset_id (str): A Media Service Asset ID. encryption_id (str): A Media Service Encryption ID. ams_redirected_rest_endpoint (str): A Media Service Redirected Endpoint. Returns...
def link_asset_content_key(access_token, asset_id, encryptionkey_id, ams_redirected_rest_endpoint): path = '/Assets' full_path = ''.join([path, "('", asset_id, "')", "/$links/ContentKeys"]) full_path_encoded = urllib.parse.quote(full_path, safe='') endpoint = ''.join([ams_rest_endpoint, full_path_e...
608,021
Link Media Service Content Key Authorization Policy. Args: access_token (str): A valid Azure authentication token. ckap_id (str): A Media Service Asset Content Key Authorization Policy ID. options_id (str): A Media Service Content Key Authorization Policy Options . ams_redirected_re...
def link_contentkey_authorization_policy(access_token, ckap_id, options_id, \ ams_redirected_rest_endpoint): path = '/ContentKeyAuthorizationPolicies' full_path = ''.join([path, "('", ckap_id, "')", "/$links/Options"]) full_path_encoded = urllib.parse.quote(full_path, safe='') endpoint = ''.join([a...
608,022
Add Media Service Authorization Policy. Args: access_token (str): A valid Azure authentication token. ck_id (str): A Media Service Asset Content Key ID. options_id (str): A Media Service OID. Returns: HTTP response. JSON body.
def add_authorization_policy(access_token, ck_id, oid): path = '/ContentKeys' body = '{"AuthorizationPolicyId":"' + oid + '"}' return helper_add(access_token, ck_id, path, body)
608,023
Update Media Service Asset File. Args: access_token (str): A valid Azure authentication token. parent_asset_id (str): A Media Service Asset Parent Asset ID. asset_id (str): A Media Service Asset Asset ID. content_length (str): A Media Service Asset Content Length. name (str)...
def update_media_assetfile(access_token, parent_asset_id, asset_id, content_length, name): path = '/Files' full_path = ''.join([path, "('", asset_id, "')"]) full_path_encoded = urllib.parse.quote(full_path, safe='') endpoint = ''.join([ams_rest_endpoint, full_path_encoded]) body = '{ \ "Conte...
608,024
Get Media Services Key Delivery URL. Args: access_token (str): A valid Azure authentication token. ck_id (str): A Media Service Content Key ID. key_type (str): A Media Service key Type. Returns: HTTP response. JSON body.
def get_key_delivery_url(access_token, ck_id, key_type): path = '/ContentKeys' full_path = ''.join([path, "('", ck_id, "')", "/GetKeyDeliveryUrl"]) endpoint = ''.join([ams_rest_endpoint, full_path]) body = '{"keyDeliveryType": "' + key_type + '"}' return do_ams_post(endpoint, full_path, body, a...
608,025
Get Media Service Encode Mezanine Asset. Args: access_token (str): A valid Azure authentication token. processor_id (str): A Media Service Processor ID. asset_id (str): A Media Service Asset ID. output_assetname (str): A Media Service Asset Name. json_profile (str): A Media ...
def encode_mezzanine_asset(access_token, processor_id, asset_id, output_assetname, json_profile): path = '/Jobs' endpoint = ''.join([ams_rest_endpoint, path]) assets_path = ''.join(["/Assets", "('", asset_id, "')"]) assets_path_encoded = urllib.parse.quote(assets_path, safe='') endpoint_assets ...
608,026
Helper Function to add strings to a URL path. Args: access_token (str): A valid Azure authentication token. ck_id (str): A CK ID. path (str): A URL Path. body (str): A Body. Returns: HTTP response. JSON body.
def helper_add(access_token, ck_id, path, body): full_path = ''.join([path, "('", ck_id, "')"]) full_path_encoded = urllib.parse.quote(full_path, safe='') endpoint = ''.join([ams_rest_endpoint, full_path_encoded]) return do_ams_put(endpoint, full_path_encoded, body, access_token, "json_only", "1.0;...
608,027
Helper Function to list a URL path. Args: access_token (str): A valid Azure authentication token. oid (str): An OID. path (str): A URL Path. Returns: HTTP response. JSON body.
def helper_list(access_token, oid, path): if oid != "": path = ''.join([path, "('", oid, "')"]) endpoint = ''.join([ams_rest_endpoint, path]) return do_ams_get(endpoint, path, access_token)
608,028
Helper Function to delete a Object at a URL path. Args: access_token (str): A valid Azure authentication token. oid (str): An OID. path (str): A URL Path. Returns: HTTP response. JSON body.
def helper_delete(access_token, oid, path): full_path = ''.join([path, "('", oid, "')"]) full_path_encoded = urllib.parse.quote(full_path, safe='') endpoint = ''.join([ams_rest_endpoint, full_path_encoded]) return do_ams_delete(endpoint, full_path_encoded, access_token)
608,029
AUX Function to translate the (numeric) state of a Job. Args: nr (int): A valid number to translate. Returns: HTTP response. JSON body.
def translate_job_state(code): code_description = "" if code == "0": code_description = "Queued" if code == "1": code_description = "Scheduled" if code == "2": code_description = "Processing" if code == "3": code_description = "Finished" if code == "4": ...
608,030
List all operations involved in a given deployment. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rg_name (str): Azure resource group name. Returns: HTTP response. JSON body.
def list_deployment_operations(access_token, subscription_id, rg_name, deployment_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rg_name, '/providers/Microsoft.Resources/deployments/',...
608,031
Create network security group (use create_nsg_rule() to add rules to it). Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. nsg_name (str): Name of the new NSG. locatio...
def create_nsg(access_token, subscription_id, resource_group, nsg_name, location): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkSecurity...
608,034
Create a public ip address. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. public_ip_name (str): Name of the new public ip address resource. dns_label (str): DNS lab...
def create_public_ip(access_token, subscription_id, resource_group, public_ip_name, dns_label, location): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '...
608,036
Delete a load balancer. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. lb_name (str): Name of the load balancer. Returns: HTTP response.
def delete_load_balancer(access_token, subscription_id, resource_group, lb_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalancers/',...
608,038
Delete a network interface. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. nic_name (str): Name of the NIC. Returns: HTTP response.
def delete_nic(access_token, subscription_id, resource_group, nic_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkInterfaces/', nic_...
608,039
Delete network security group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. nsg_name (str): Name of the NSG. Returns: HTTP response.
def delete_nsg(access_token, subscription_id, resource_group, nsg_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkSecurityGroups/', ...
608,040
Delete network security group rule. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. nsg_name (str): Name of the Network Security Group. nsg_rule_name (str): Name of t...
def delete_nsg_rule(access_token, subscription_id, resource_group, nsg_name, nsg_rule_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/netwo...
608,041
Delete a public ip addresses associated with a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. public_ip_name (str): Name of the public ip address resource. ...
def delete_public_ip(access_token, subscription_id, resource_group, public_ip_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/publicIPAddre...
608,042
Delete a virtual network. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. name (str): Name of the VNet. Returns: HTTP response. VNet JSON body.
def delete_vnet(access_token, subscription_id, resource_group, name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/virtualNetworks/', name, ...
608,043
Get details about a load balancer inbound NAT rule. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. lb_name (str): Name of the load balancer. rule_name (str): Name of...
def get_lb_nat_rule(access_token, subscription_id, resource_group, lb_name, rule_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalanc...
608,044
List network usage and limits for a location. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. location (str): Azure data center location. E.g. westus. Returns: HTTP response. JSON body of network usage.
def get_network_usage(access_token, subscription_id, location): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/locations/', location, '/usages?api-version=', NETWORK_API]) retur...
608,045
Get details about a network interface. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. nic_name (str): Name of the NIC. Returns: HTTP response. NIC JSON body.
def get_nic(access_token, subscription_id, resource_group, nic_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkInterfaces/', nic_nam...
608,046
Get details about the named public ip address. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. public_ip_name (str): Name of the public ip address resource. Returns: ...
def get_public_ip(access_token, subscription_id, resource_group, ip_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/', ...
608,047
Get details about the named virtual network. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vnet_name (str): Name of the VNet. Returns: HTTP response. VNet JSON...
def get_vnet(access_token, subscription_id, resource_group, vnet_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/virtualNetworks/', vnet_na...
608,048
Get details about the application security groups for a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. Returns: HTTP response. ASG JSON body.
def list_asgs(access_token, subscription_id, resource_group): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/virtualNetworks/', ...
608,049
Get details about the application security groups for a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. ASG JSON body.
def list_asgs_all(access_token, subscription_id): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/virtualNetworks/', '?api-version=', NETWORK_API]) return do_get(endpoint, access...
608,050
List the inbound NAT rules for a load balancer. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. lb_name (str): Name of the load balancer. Returns: HTTP response....
def list_lb_nat_rules(access_token, subscription_id, resource_group, lb_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalancers/', lb...
608,051
List the load balancers in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of load balancer list with properties.
def list_load_balancers(access_token, subscription_id): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/', '/loadBalancers?api-version=', NETWORK_API]) return do_get(endpoint, ac...
608,052
List the network interfaces in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of NICs list with properties.
def list_nics(access_token, subscription_id): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/', '/networkInterfaces?api-version=', NETWORK_API]) return do_get(endpoint, access_t...
608,053
List all network security groups in a subscription. Args: access_token (str): a valid Azure Authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of all network security groups in a subscription.
def list_nsgs_all(access_token, subscription_id): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/', 'networkSEcurityGroups?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
608,054
List the VNETs in a subscription . Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of VNets list with properties.
def list_vnets(access_token, subscription_id): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/', '/virtualNetworks?api-version=', NETWORK_API]) return do_get(endpoint, access_to...
608,055
Updates a load balancer model, i.e. PUT an updated LB body. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. lb_name (str): Name of the new load balancer. body (str): ...
def update_load_balancer(access_token, subscription_id, resource_group, lb_name, body): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalanc...
608,056
Delete availability set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. as_name (str): Name of the availability set. Returns: HTTP response.
def delete_as(access_token, subscription_id, resource_group, as_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/availabilitySets/', as_name...
608,068
Delete a virtual machine. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vm_name (str): Name of the virtual machine. Returns: HTTP response.
def delete_vm(access_token, subscription_id, resource_group, vm_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachines/', vm_name,...
608,069
Delete a virtual machine scale set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of the virtual machine scale set. Returns: HTTP respons...
def delete_vmss(access_token, subscription_id, resource_group, vmss_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets...
608,070
Delete a VM in a VM Scale Set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of the virtual machine scale set. vm_ids (str): String representa...
def delete_vmss_vms(access_token, subscription_id, resource_group, vmss_name, vm_ids): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMach...
608,071
List compute usage and limits for a location. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. location (str): Azure data center location. E.g. westus. Returns: HTTP response. JSON body of Compute usage and limits data.
def get_compute_usage(access_token, subscription_id, location): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.compute/locations/', location, '/usages?api-version=', COMP_API]) return d...
608,072
Get virtual machine details. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vm_name (str): Name of the virtual machine. Returns: HTTP response. JSON body of VM ...
def get_vm(access_token, subscription_id, resource_group, vm_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachines/', vm_name, ...
608,073
Get details about a VM extension. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vm_name (str): Name of the virtual machine. extension_name (str): VM extension name....
def get_vm_extension(access_token, subscription_id, resource_group, vm_name, extension_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virt...
608,074
Get virtual machine scale set details. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of the virtual machine scale set. Returns: HTTP resp...
def get_vmss(access_token, subscription_id, resource_group, vmss_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets/',...
608,075
Get individual VMSS VM details. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of the virtual machine scale set. instance_id (int): VM ID of th...
def get_vmss_vm(access_token, subscription_id, resource_group, vmss_name, instance_id): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMac...
608,076
Get availability set details. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. as_name (str): Name of the new availability set. Returns: HTTP response. JSON body ...
def get_as(access_token, subscription_id, resource_group, as_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/availabilitySets/', as_name, ...
608,077
List availability sets in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of the list of availability set properties.
def list_as_sub(access_token, subscription_id): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Compute/availabilitySets', '?api-version=', COMP_API]) return do_get_next(endpoint, access...
608,078
List VM images in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of a list of VM images.
def list_vm_images_sub(access_token, subscription_id): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Compute/images', '?api-version=', COMP_API]) return do_get_next(endpoint, access_to...
608,079
List VMs in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. Returns: HTTP response. JSON body of a list of VM model views.
def list_vms(access_token, subscription_id, resource_group): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachines', ...
608,080
List VMs in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of a list of VM model views.
def list_vms_sub(access_token, subscription_id): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Compute/virtualMachines', '?api-version=', COMP_API]) return do_get_next(endpoint, access...
608,081
List VM Scale Sets in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. Returns: HTTP response. JSON body of a list of scale set model views.
def list_vmss(access_token, subscription_id, resource_group): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets', ...
608,082
List the VM skus available for a VM Scale Set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of the virtual machine scale set. Returns: H...
def list_vmss_skus(access_token, subscription_id, resource_group, vmss_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleS...
608,083
List VM Scale Sets in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of VM scale sets.
def list_vmss_sub(access_token, subscription_id): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Compute/virtualMachineScaleSets', '?api-version=', COMP_API]) return do_get_next(endpoin...
608,084
Gets one page of a paginated list of scale set VM instance views. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of the virtual machine scale set. ...
def list_vmss_vm_instance_view_pg(access_token, subscription_id, resource_group, vmss_name, link=None): if link is None: endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/...
608,085
Power off all the VMs in a virtual machine scale set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of the virtual machine scale set. Returns: ...
def poweroff_vmss(access_token, subscription_id, resource_group, vmss_name): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSe...
608,086
Poweroff all the VMs in a virtual machine scale set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of the virtual machine scale set. instance_...
def poweroff_vmss_vms(access_token, subscription_id, resource_group, vmss_name, instance_ids): endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/vir...
608,087