id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
51
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
6,500
opentok/Opentok-Python-SDK
opentok/opentok.py
OpenTok.stop_broadcast
def stop_broadcast(self, broadcast_id): """ Use this method to stop a live broadcast of an OpenTok session :param String broadcast_id: The ID of the broadcast you want to stop :rtype A Broadcast object, which contains information of the broadcast: id, sessionId projectId, createdAt, updatedAt and resolution """ endpoint = self.endpoints.broadcast_url(broadcast_id, stop=True) response = requests.post( endpoint, headers=self.json_headers(), proxies=self.proxies, timeout=self.timeout ) if response.status_code == 200: return Broadcast(response.json()) elif response.status_code == 400: raise BroadcastError( 'Invalid request. This response may indicate that data in your request ' 'data is invalid JSON.') elif response.status_code == 403: raise AuthError('Authentication error.') elif response.status_code == 409: raise BroadcastError( 'The broadcast (with the specified ID) was not found or it has already ' 'stopped.') else: raise RequestError('OpenTok server error.', response.status_code)
python
def stop_broadcast(self, broadcast_id): endpoint = self.endpoints.broadcast_url(broadcast_id, stop=True) response = requests.post( endpoint, headers=self.json_headers(), proxies=self.proxies, timeout=self.timeout ) if response.status_code == 200: return Broadcast(response.json()) elif response.status_code == 400: raise BroadcastError( 'Invalid request. This response may indicate that data in your request ' 'data is invalid JSON.') elif response.status_code == 403: raise AuthError('Authentication error.') elif response.status_code == 409: raise BroadcastError( 'The broadcast (with the specified ID) was not found or it has already ' 'stopped.') else: raise RequestError('OpenTok server error.', response.status_code)
[ "def", "stop_broadcast", "(", "self", ",", "broadcast_id", ")", ":", "endpoint", "=", "self", ".", "endpoints", ".", "broadcast_url", "(", "broadcast_id", ",", "stop", "=", "True", ")", "response", "=", "requests", ".", "post", "(", "endpoint", ",", "heade...
Use this method to stop a live broadcast of an OpenTok session :param String broadcast_id: The ID of the broadcast you want to stop :rtype A Broadcast object, which contains information of the broadcast: id, sessionId projectId, createdAt, updatedAt and resolution
[ "Use", "this", "method", "to", "stop", "a", "live", "broadcast", "of", "an", "OpenTok", "session" ]
ffc6714e76be0d29e6b56aff8cbf7509b71a8b2c
https://github.com/opentok/Opentok-Python-SDK/blob/ffc6714e76be0d29e6b56aff8cbf7509b71a8b2c/opentok/opentok.py#L834-L864
6,501
opentok/Opentok-Python-SDK
opentok/opentok.py
OpenTok.get_broadcast
def get_broadcast(self, broadcast_id): """ Use this method to get details on a broadcast that is in-progress. :param String broadcast_id: The ID of the broadcast you want to stop :rtype A Broadcast object, which contains information of the broadcast: id, sessionId projectId, createdAt, updatedAt, resolution, broadcastUrls and status """ endpoint = self.endpoints.broadcast_url(broadcast_id) response = requests.get( endpoint, headers=self.json_headers(), proxies=self.proxies, timeout=self.timeout ) if response.status_code == 200: return Broadcast(response.json()) elif response.status_code == 400: raise BroadcastError( 'Invalid request. This response may indicate that data in your request ' 'data is invalid JSON.') elif response.status_code == 403: raise AuthError('Authentication error.') elif response.status_code == 409: raise BroadcastError('No matching broadcast found (with the specified ID).') else: raise RequestError('OpenTok server error.', response.status_code)
python
def get_broadcast(self, broadcast_id): endpoint = self.endpoints.broadcast_url(broadcast_id) response = requests.get( endpoint, headers=self.json_headers(), proxies=self.proxies, timeout=self.timeout ) if response.status_code == 200: return Broadcast(response.json()) elif response.status_code == 400: raise BroadcastError( 'Invalid request. This response may indicate that data in your request ' 'data is invalid JSON.') elif response.status_code == 403: raise AuthError('Authentication error.') elif response.status_code == 409: raise BroadcastError('No matching broadcast found (with the specified ID).') else: raise RequestError('OpenTok server error.', response.status_code)
[ "def", "get_broadcast", "(", "self", ",", "broadcast_id", ")", ":", "endpoint", "=", "self", ".", "endpoints", ".", "broadcast_url", "(", "broadcast_id", ")", "response", "=", "requests", ".", "get", "(", "endpoint", ",", "headers", "=", "self", ".", "json...
Use this method to get details on a broadcast that is in-progress. :param String broadcast_id: The ID of the broadcast you want to stop :rtype A Broadcast object, which contains information of the broadcast: id, sessionId projectId, createdAt, updatedAt, resolution, broadcastUrls and status
[ "Use", "this", "method", "to", "get", "details", "on", "a", "broadcast", "that", "is", "in", "-", "progress", "." ]
ffc6714e76be0d29e6b56aff8cbf7509b71a8b2c
https://github.com/opentok/Opentok-Python-SDK/blob/ffc6714e76be0d29e6b56aff8cbf7509b71a8b2c/opentok/opentok.py#L866-L894
6,502
opentok/Opentok-Python-SDK
opentok/opentok.py
OpenTok.set_broadcast_layout
def set_broadcast_layout(self, broadcast_id, layout_type, stylesheet=None): """ Use this method to change the layout type of a live streaming broadcast :param String broadcast_id: The ID of the broadcast that will be updated :param String layout_type: The layout type for the broadcast. Valid values are: 'bestFit', 'custom', 'horizontalPresentation', 'pip' and 'verticalPresentation' :param String stylesheet optional: CSS used to style the custom layout. Specify this only if you set the type property to 'custom' """ payload = { 'type': layout_type, } if layout_type == 'custom': if stylesheet is not None: payload['stylesheet'] = stylesheet endpoint = self.endpoints.broadcast_url(broadcast_id, layout=True) response = requests.put( endpoint, data=json.dumps(payload), headers=self.json_headers(), proxies=self.proxies, timeout=self.timeout ) if response.status_code == 200: pass elif response.status_code == 400: raise BroadcastError( 'Invalid request. This response may indicate that data in your request data is ' 'invalid JSON. It may also indicate that you passed in invalid layout options.') elif response.status_code == 403: raise AuthError('Authentication error.') else: raise RequestError('OpenTok server error.', response.status_code)
python
def set_broadcast_layout(self, broadcast_id, layout_type, stylesheet=None): payload = { 'type': layout_type, } if layout_type == 'custom': if stylesheet is not None: payload['stylesheet'] = stylesheet endpoint = self.endpoints.broadcast_url(broadcast_id, layout=True) response = requests.put( endpoint, data=json.dumps(payload), headers=self.json_headers(), proxies=self.proxies, timeout=self.timeout ) if response.status_code == 200: pass elif response.status_code == 400: raise BroadcastError( 'Invalid request. This response may indicate that data in your request data is ' 'invalid JSON. It may also indicate that you passed in invalid layout options.') elif response.status_code == 403: raise AuthError('Authentication error.') else: raise RequestError('OpenTok server error.', response.status_code)
[ "def", "set_broadcast_layout", "(", "self", ",", "broadcast_id", ",", "layout_type", ",", "stylesheet", "=", "None", ")", ":", "payload", "=", "{", "'type'", ":", "layout_type", ",", "}", "if", "layout_type", "==", "'custom'", ":", "if", "stylesheet", "is", ...
Use this method to change the layout type of a live streaming broadcast :param String broadcast_id: The ID of the broadcast that will be updated :param String layout_type: The layout type for the broadcast. Valid values are: 'bestFit', 'custom', 'horizontalPresentation', 'pip' and 'verticalPresentation' :param String stylesheet optional: CSS used to style the custom layout. Specify this only if you set the type property to 'custom'
[ "Use", "this", "method", "to", "change", "the", "layout", "type", "of", "a", "live", "streaming", "broadcast" ]
ffc6714e76be0d29e6b56aff8cbf7509b71a8b2c
https://github.com/opentok/Opentok-Python-SDK/blob/ffc6714e76be0d29e6b56aff8cbf7509b71a8b2c/opentok/opentok.py#L896-L934
6,503
mdorn/pyinstapaper
pyinstapaper/instapaper.py
Instapaper.login
def login(self, username, password): '''Authenticate using XAuth variant of OAuth. :param str username: Username or email address for the relevant account :param str password: Password for the account ''' response = self.request( ACCESS_TOKEN, { 'x_auth_mode': 'client_auth', 'x_auth_username': username, 'x_auth_password': password }, returns_json=False ) token = dict(parse_qsl(response['data'].decode())) self.token = oauth.Token( token['oauth_token'], token['oauth_token_secret']) self.oauth_client = oauth.Client(self.consumer, self.token)
python
def login(self, username, password): '''Authenticate using XAuth variant of OAuth. :param str username: Username or email address for the relevant account :param str password: Password for the account ''' response = self.request( ACCESS_TOKEN, { 'x_auth_mode': 'client_auth', 'x_auth_username': username, 'x_auth_password': password }, returns_json=False ) token = dict(parse_qsl(response['data'].decode())) self.token = oauth.Token( token['oauth_token'], token['oauth_token_secret']) self.oauth_client = oauth.Client(self.consumer, self.token)
[ "def", "login", "(", "self", ",", "username", ",", "password", ")", ":", "response", "=", "self", ".", "request", "(", "ACCESS_TOKEN", ",", "{", "'x_auth_mode'", ":", "'client_auth'", ",", "'x_auth_username'", ":", "username", ",", "'x_auth_password'", ":", ...
Authenticate using XAuth variant of OAuth. :param str username: Username or email address for the relevant account :param str password: Password for the account
[ "Authenticate", "using", "XAuth", "variant", "of", "OAuth", "." ]
94f5f61ccd07079ba3967f788c555aea1a81cca5
https://github.com/mdorn/pyinstapaper/blob/94f5f61ccd07079ba3967f788c555aea1a81cca5/pyinstapaper/instapaper.py#L34-L52
6,504
mdorn/pyinstapaper
pyinstapaper/instapaper.py
Instapaper.request
def request(self, path, params=None, returns_json=True, method='POST', api_version=API_VERSION): '''Process a request using the OAuth client's request method. :param str path: Path fragment to the API endpoint, e.g. "resource/ID" :param dict params: Parameters to pass to request :param str method: Optional HTTP method, normally POST for Instapaper :param str api_version: Optional alternative API version :returns: response headers and body :retval: dict ''' time.sleep(REQUEST_DELAY_SECS) full_path = '/'.join([BASE_URL, 'api/%s' % api_version, path]) params = urlencode(params) if params else None log.debug('URL: %s', full_path) request_kwargs = {'method': method} if params: request_kwargs['body'] = params response, content = self.oauth_client.request( full_path, **request_kwargs) log.debug('CONTENT: %s ...', content[:50]) if returns_json: try: data = json.loads(content) if isinstance(data, list) and len(data) == 1: # ugly -- API always returns a list even when you expect # only one item if data[0]['type'] == 'error': raise Exception('Instapaper error %d: %s' % ( data[0]['error_code'], data[0]['message']) ) # TODO: PyInstapaperException custom class? except ValueError: # Instapaper API can be unpredictable/inconsistent, e.g. # bookmarks/get_text doesn't return JSON data = content else: data = content return { 'response': response, 'data': data }
python
def request(self, path, params=None, returns_json=True, method='POST', api_version=API_VERSION): '''Process a request using the OAuth client's request method. :param str path: Path fragment to the API endpoint, e.g. "resource/ID" :param dict params: Parameters to pass to request :param str method: Optional HTTP method, normally POST for Instapaper :param str api_version: Optional alternative API version :returns: response headers and body :retval: dict ''' time.sleep(REQUEST_DELAY_SECS) full_path = '/'.join([BASE_URL, 'api/%s' % api_version, path]) params = urlencode(params) if params else None log.debug('URL: %s', full_path) request_kwargs = {'method': method} if params: request_kwargs['body'] = params response, content = self.oauth_client.request( full_path, **request_kwargs) log.debug('CONTENT: %s ...', content[:50]) if returns_json: try: data = json.loads(content) if isinstance(data, list) and len(data) == 1: # ugly -- API always returns a list even when you expect # only one item if data[0]['type'] == 'error': raise Exception('Instapaper error %d: %s' % ( data[0]['error_code'], data[0]['message']) ) # TODO: PyInstapaperException custom class? except ValueError: # Instapaper API can be unpredictable/inconsistent, e.g. # bookmarks/get_text doesn't return JSON data = content else: data = content return { 'response': response, 'data': data }
[ "def", "request", "(", "self", ",", "path", ",", "params", "=", "None", ",", "returns_json", "=", "True", ",", "method", "=", "'POST'", ",", "api_version", "=", "API_VERSION", ")", ":", "time", ".", "sleep", "(", "REQUEST_DELAY_SECS", ")", "full_path", "...
Process a request using the OAuth client's request method. :param str path: Path fragment to the API endpoint, e.g. "resource/ID" :param dict params: Parameters to pass to request :param str method: Optional HTTP method, normally POST for Instapaper :param str api_version: Optional alternative API version :returns: response headers and body :retval: dict
[ "Process", "a", "request", "using", "the", "OAuth", "client", "s", "request", "method", "." ]
94f5f61ccd07079ba3967f788c555aea1a81cca5
https://github.com/mdorn/pyinstapaper/blob/94f5f61ccd07079ba3967f788c555aea1a81cca5/pyinstapaper/instapaper.py#L54-L96
6,505
mdorn/pyinstapaper
pyinstapaper/instapaper.py
Instapaper.get_bookmarks
def get_bookmarks(self, folder='unread', limit=25, have=None): """Return list of user's bookmarks. :param str folder: Optional. Possible values are unread (default), starred, archive, or a folder_id value. :param int limit: Optional. A number between 1 and 500, default 25. :param list have: Optional. A list of IDs to exclude from results :returns: List of user's bookmarks :rtype: list """ path = 'bookmarks/list' params = {'folder_id': folder, 'limit': limit} if have: have_concat = ','.join(str(id_) for id_ in have) params['have'] = have_concat response = self.request(path, params) items = response['data'] bookmarks = [] for item in items: if item.get('type') == 'error': raise Exception(item.get('message')) elif item.get('type') == 'bookmark': bookmarks.append(Bookmark(self, **item)) return bookmarks
python
def get_bookmarks(self, folder='unread', limit=25, have=None): path = 'bookmarks/list' params = {'folder_id': folder, 'limit': limit} if have: have_concat = ','.join(str(id_) for id_ in have) params['have'] = have_concat response = self.request(path, params) items = response['data'] bookmarks = [] for item in items: if item.get('type') == 'error': raise Exception(item.get('message')) elif item.get('type') == 'bookmark': bookmarks.append(Bookmark(self, **item)) return bookmarks
[ "def", "get_bookmarks", "(", "self", ",", "folder", "=", "'unread'", ",", "limit", "=", "25", ",", "have", "=", "None", ")", ":", "path", "=", "'bookmarks/list'", "params", "=", "{", "'folder_id'", ":", "folder", ",", "'limit'", ":", "limit", "}", "if"...
Return list of user's bookmarks. :param str folder: Optional. Possible values are unread (default), starred, archive, or a folder_id value. :param int limit: Optional. A number between 1 and 500, default 25. :param list have: Optional. A list of IDs to exclude from results :returns: List of user's bookmarks :rtype: list
[ "Return", "list", "of", "user", "s", "bookmarks", "." ]
94f5f61ccd07079ba3967f788c555aea1a81cca5
https://github.com/mdorn/pyinstapaper/blob/94f5f61ccd07079ba3967f788c555aea1a81cca5/pyinstapaper/instapaper.py#L98-L121
6,506
mdorn/pyinstapaper
pyinstapaper/instapaper.py
Instapaper.get_folders
def get_folders(self): """Return list of user's folders. :rtype: list """ path = 'folders/list' response = self.request(path) items = response['data'] folders = [] for item in items: if item.get('type') == 'error': raise Exception(item.get('message')) elif item.get('type') == 'folder': folders.append(Folder(self, **item)) return folders
python
def get_folders(self): path = 'folders/list' response = self.request(path) items = response['data'] folders = [] for item in items: if item.get('type') == 'error': raise Exception(item.get('message')) elif item.get('type') == 'folder': folders.append(Folder(self, **item)) return folders
[ "def", "get_folders", "(", "self", ")", ":", "path", "=", "'folders/list'", "response", "=", "self", ".", "request", "(", "path", ")", "items", "=", "response", "[", "'data'", "]", "folders", "=", "[", "]", "for", "item", "in", "items", ":", "if", "i...
Return list of user's folders. :rtype: list
[ "Return", "list", "of", "user", "s", "folders", "." ]
94f5f61ccd07079ba3967f788c555aea1a81cca5
https://github.com/mdorn/pyinstapaper/blob/94f5f61ccd07079ba3967f788c555aea1a81cca5/pyinstapaper/instapaper.py#L123-L137
6,507
mdorn/pyinstapaper
pyinstapaper/instapaper.py
InstapaperObject.add
def add(self): '''Save an object to Instapaper after instantiating it. Example:: folder = Folder(instapaper, title='stuff') result = folder.add() ''' # TODO validation per object type submit_attribs = {} for attrib in self.ATTRIBUTES: val = getattr(self, attrib, None) if val: submit_attribs[attrib] = val path = '/'.join([self.RESOURCE, 'add']) result = self.client.request(path, submit_attribs) return result
python
def add(self): '''Save an object to Instapaper after instantiating it. Example:: folder = Folder(instapaper, title='stuff') result = folder.add() ''' # TODO validation per object type submit_attribs = {} for attrib in self.ATTRIBUTES: val = getattr(self, attrib, None) if val: submit_attribs[attrib] = val path = '/'.join([self.RESOURCE, 'add']) result = self.client.request(path, submit_attribs) return result
[ "def", "add", "(", "self", ")", ":", "# TODO validation per object type", "submit_attribs", "=", "{", "}", "for", "attrib", "in", "self", ".", "ATTRIBUTES", ":", "val", "=", "getattr", "(", "self", ",", "attrib", ",", "None", ")", "if", "val", ":", "subm...
Save an object to Instapaper after instantiating it. Example:: folder = Folder(instapaper, title='stuff') result = folder.add()
[ "Save", "an", "object", "to", "Instapaper", "after", "instantiating", "it", "." ]
94f5f61ccd07079ba3967f788c555aea1a81cca5
https://github.com/mdorn/pyinstapaper/blob/94f5f61ccd07079ba3967f788c555aea1a81cca5/pyinstapaper/instapaper.py#L173-L189
6,508
mdorn/pyinstapaper
pyinstapaper/instapaper.py
InstapaperObject._simple_action
def _simple_action(self, action=None): '''Issue a request for an API method whose only param is the obj ID. :param str action: The name of the action for the resource :returns: Response from the API :rtype: dict ''' if not action: raise Exception('No simple action defined') path = "/".join([self.RESOURCE, action]) response = self.client.request( path, {self.RESOURCE_ID_ATTRIBUTE: self.object_id} ) return response
python
def _simple_action(self, action=None): '''Issue a request for an API method whose only param is the obj ID. :param str action: The name of the action for the resource :returns: Response from the API :rtype: dict ''' if not action: raise Exception('No simple action defined') path = "/".join([self.RESOURCE, action]) response = self.client.request( path, {self.RESOURCE_ID_ATTRIBUTE: self.object_id} ) return response
[ "def", "_simple_action", "(", "self", ",", "action", "=", "None", ")", ":", "if", "not", "action", ":", "raise", "Exception", "(", "'No simple action defined'", ")", "path", "=", "\"/\"", ".", "join", "(", "[", "self", ".", "RESOURCE", ",", "action", "]"...
Issue a request for an API method whose only param is the obj ID. :param str action: The name of the action for the resource :returns: Response from the API :rtype: dict
[ "Issue", "a", "request", "for", "an", "API", "method", "whose", "only", "param", "is", "the", "obj", "ID", "." ]
94f5f61ccd07079ba3967f788c555aea1a81cca5
https://github.com/mdorn/pyinstapaper/blob/94f5f61ccd07079ba3967f788c555aea1a81cca5/pyinstapaper/instapaper.py#L191-L204
6,509
mdorn/pyinstapaper
pyinstapaper/instapaper.py
Bookmark.get_highlights
def get_highlights(self): '''Get highlights for Bookmark instance. :return: list of ``Highlight`` objects :rtype: list ''' # NOTE: all Instapaper API methods use POST except this one! path = '/'.join([self.RESOURCE, str(self.object_id), 'highlights']) response = self.client.request(path, method='GET', api_version='1.1') items = response['data'] highlights = [] for item in items: if item.get('type') == 'error': raise Exception(item.get('message')) elif item.get('type') == 'highlight': highlights.append(Highlight(self, **item)) return highlights
python
def get_highlights(self): '''Get highlights for Bookmark instance. :return: list of ``Highlight`` objects :rtype: list ''' # NOTE: all Instapaper API methods use POST except this one! path = '/'.join([self.RESOURCE, str(self.object_id), 'highlights']) response = self.client.request(path, method='GET', api_version='1.1') items = response['data'] highlights = [] for item in items: if item.get('type') == 'error': raise Exception(item.get('message')) elif item.get('type') == 'highlight': highlights.append(Highlight(self, **item)) return highlights
[ "def", "get_highlights", "(", "self", ")", ":", "# NOTE: all Instapaper API methods use POST except this one!", "path", "=", "'/'", ".", "join", "(", "[", "self", ".", "RESOURCE", ",", "str", "(", "self", ".", "object_id", ")", ",", "'highlights'", "]", ")", "...
Get highlights for Bookmark instance. :return: list of ``Highlight`` objects :rtype: list
[ "Get", "highlights", "for", "Bookmark", "instance", "." ]
94f5f61ccd07079ba3967f788c555aea1a81cca5
https://github.com/mdorn/pyinstapaper/blob/94f5f61ccd07079ba3967f788c555aea1a81cca5/pyinstapaper/instapaper.py#L242-L258
6,510
Jetsetter/graphyte
graphyte.py
Sender.build_message
def build_message(self, metric, value, timestamp, tags={}): """Build a Graphite message to send and return it as a byte string.""" if not metric or metric.split(None, 1)[0] != metric: raise ValueError('"metric" must not have whitespace in it') if not isinstance(value, (int, float)): raise TypeError('"value" must be an int or a float, not a {}'.format( type(value).__name__)) tags_suffix = ''.join(';{}={}'.format(x[0], x[1]) for x in sorted(tags.items())) message = u'{}{}{} {} {}\n'.format( self.prefix + '.' if self.prefix else '', metric, tags_suffix, value, int(round(timestamp)) ) message = message.encode('utf-8') return message
python
def build_message(self, metric, value, timestamp, tags={}): if not metric or metric.split(None, 1)[0] != metric: raise ValueError('"metric" must not have whitespace in it') if not isinstance(value, (int, float)): raise TypeError('"value" must be an int or a float, not a {}'.format( type(value).__name__)) tags_suffix = ''.join(';{}={}'.format(x[0], x[1]) for x in sorted(tags.items())) message = u'{}{}{} {} {}\n'.format( self.prefix + '.' if self.prefix else '', metric, tags_suffix, value, int(round(timestamp)) ) message = message.encode('utf-8') return message
[ "def", "build_message", "(", "self", ",", "metric", ",", "value", ",", "timestamp", ",", "tags", "=", "{", "}", ")", ":", "if", "not", "metric", "or", "metric", ".", "split", "(", "None", ",", "1", ")", "[", "0", "]", "!=", "metric", ":", "raise"...
Build a Graphite message to send and return it as a byte string.
[ "Build", "a", "Graphite", "message", "to", "send", "and", "return", "it", "as", "a", "byte", "string", "." ]
200781c5105140df32b8e18bbec497cc0be5d40e
https://github.com/Jetsetter/graphyte/blob/200781c5105140df32b8e18bbec497cc0be5d40e/graphyte.py#L67-L85
6,511
gbowerman/azurerm
examples/list_vmss_nics.py
get_rg_from_id
def get_rg_from_id(vmss_id): '''get a resource group name from a VMSS ID string''' rgname = re.search('Groups/(.+?)/providers', vmss_id).group(1) print('Resource group: ' + rgname) return rgname
python
def get_rg_from_id(vmss_id): '''get a resource group name from a VMSS ID string''' rgname = re.search('Groups/(.+?)/providers', vmss_id).group(1) print('Resource group: ' + rgname) return rgname
[ "def", "get_rg_from_id", "(", "vmss_id", ")", ":", "rgname", "=", "re", ".", "search", "(", "'Groups/(.+?)/providers'", ",", "vmss_id", ")", ".", "group", "(", "1", ")", "print", "(", "'Resource group: '", "+", "rgname", ")", "return", "rgname" ]
get a resource group name from a VMSS ID string
[ "get", "a", "resource", "group", "name", "from", "a", "VMSS", "ID", "string" ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/list_vmss_nics.py#L9-L13
6,512
gbowerman/azurerm
azurerm/restfns.py
get_user_agent
def get_user_agent(): '''User-Agent Header. Sends library identification to Azure endpoint. ''' version = pkg_resources.require("azurerm")[0].version user_agent = "python/{} ({}) requests/{} azurerm/{}".format( platform.python_version(), platform.platform(), requests.__version__, version) return user_agent
python
def get_user_agent(): '''User-Agent Header. Sends library identification to Azure endpoint. ''' version = pkg_resources.require("azurerm")[0].version user_agent = "python/{} ({}) requests/{} azurerm/{}".format( platform.python_version(), platform.platform(), requests.__version__, version) return user_agent
[ "def", "get_user_agent", "(", ")", ":", "version", "=", "pkg_resources", ".", "require", "(", "\"azurerm\"", ")", "[", "0", "]", ".", "version", "user_agent", "=", "\"python/{} ({}) requests/{} azurerm/{}\"", ".", "format", "(", "platform", ".", "python_version", ...
User-Agent Header. Sends library identification to Azure endpoint.
[ "User", "-", "Agent", "Header", ".", "Sends", "library", "identification", "to", "Azure", "endpoint", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/restfns.py#L9-L18
6,513
gbowerman/azurerm
azurerm/restfns.py
do_get_next
def do_get_next(endpoint, access_token): '''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. ''' 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 get_return: return get_return if not 'nextLink' in get_return: looping = False else: endpoint = get_return['nextLink'] value_list += get_return['value'] vm_dict['value'] = value_list return vm_dict
python
def do_get_next(endpoint, access_token): '''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. ''' 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 get_return: return get_return if not 'nextLink' in get_return: looping = False else: endpoint = get_return['nextLink'] value_list += get_return['value'] vm_dict['value'] = value_list return vm_dict
[ "def", "do_get_next", "(", "endpoint", ",", "access_token", ")", ":", "headers", "=", "{", "\"Authorization\"", ":", "'Bearer '", "+", "access_token", "}", "headers", "[", "'User-Agent'", "]", "=", "get_user_agent", "(", ")", "looping", "=", "True", "value_lis...
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.
[ "Do", "an", "HTTP", "GET", "request", "follow", "the", "nextLink", "chain", "and", "return", "JSON", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/restfns.py#L35-L60
6,514
gbowerman/azurerm
azurerm/restfns.py
do_patch
def do_patch(endpoint, body, access_token): '''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. ''' headers = {"content-type": "application/json", "Authorization": 'Bearer ' + access_token} headers['User-Agent'] = get_user_agent() return requests.patch(endpoint, data=body, headers=headers)
python
def do_patch(endpoint, body, access_token): '''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. ''' headers = {"content-type": "application/json", "Authorization": 'Bearer ' + access_token} headers['User-Agent'] = get_user_agent() return requests.patch(endpoint, data=body, headers=headers)
[ "def", "do_patch", "(", "endpoint", ",", "body", ",", "access_token", ")", ":", "headers", "=", "{", "\"content-type\"", ":", "\"application/json\"", ",", "\"Authorization\"", ":", "'Bearer '", "+", "access_token", "}", "headers", "[", "'User-Agent'", "]", "=", ...
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.
[ "Do", "an", "HTTP", "PATCH", "request", "and", "return", "JSON", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/restfns.py#L78-L91
6,515
gbowerman/azurerm
azurerm/restfns.py
do_post
def do_post(endpoint, body, access_token): '''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. ''' headers = {"content-type": "application/json", "Authorization": 'Bearer ' + access_token} headers['User-Agent'] = get_user_agent() return requests.post(endpoint, data=body, headers=headers)
python
def do_post(endpoint, body, access_token): '''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. ''' headers = {"content-type": "application/json", "Authorization": 'Bearer ' + access_token} headers['User-Agent'] = get_user_agent() return requests.post(endpoint, data=body, headers=headers)
[ "def", "do_post", "(", "endpoint", ",", "body", ",", "access_token", ")", ":", "headers", "=", "{", "\"content-type\"", ":", "\"application/json\"", ",", "\"Authorization\"", ":", "'Bearer '", "+", "access_token", "}", "headers", "[", "'User-Agent'", "]", "=", ...
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.
[ "Do", "an", "HTTP", "POST", "request", "and", "return", "JSON", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/restfns.py#L94-L107
6,516
gbowerman/azurerm
azurerm/restfns.py
do_put
def do_put(endpoint, body, access_token): '''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. ''' headers = {"content-type": "application/json", "Authorization": 'Bearer ' + access_token} headers['User-Agent'] = get_user_agent() return requests.put(endpoint, data=body, headers=headers)
python
def do_put(endpoint, body, access_token): '''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. ''' headers = {"content-type": "application/json", "Authorization": 'Bearer ' + access_token} headers['User-Agent'] = get_user_agent() return requests.put(endpoint, data=body, headers=headers)
[ "def", "do_put", "(", "endpoint", ",", "body", ",", "access_token", ")", ":", "headers", "=", "{", "\"content-type\"", ":", "\"application/json\"", ",", "\"Authorization\"", ":", "'Bearer '", "+", "access_token", "}", "headers", "[", "'User-Agent'", "]", "=", ...
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.
[ "Do", "an", "HTTP", "PUT", "request", "and", "return", "JSON", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/restfns.py#L110-L123
6,517
gbowerman/azurerm
examples/vip_swap.py
handle_bad_update
def handle_bad_update(operation, ret): '''report error for bad update''' print("Error " + operation) sys.exit('Return code: ' + str(ret.status_code) + ' Error: ' + ret.text)
python
def handle_bad_update(operation, ret): '''report error for bad update''' print("Error " + operation) sys.exit('Return code: ' + str(ret.status_code) + ' Error: ' + ret.text)
[ "def", "handle_bad_update", "(", "operation", ",", "ret", ")", ":", "print", "(", "\"Error \"", "+", "operation", ")", "sys", ".", "exit", "(", "'Return code: '", "+", "str", "(", "ret", ".", "status_code", ")", "+", "' Error: '", "+", "ret", ".", "text"...
report error for bad update
[ "report", "error", "for", "bad", "update" ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/vip_swap.py#L12-L15
6,518
gbowerman/azurerm
docs/py2md.py
extract_code
def extract_code(end_mark, current_str, str_array, line_num): '''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 current offset into the array. Returns: Extended string up to line with end marker. ''' 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 else: line_num += 1 current_str += next_line clean_str = current_str.split(end_mark)[0] return {'current_str': clean_str, 'line_num': line_num}
python
def extract_code(end_mark, current_str, str_array, line_num): '''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 current offset into the array. Returns: Extended string up to line with end marker. ''' 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 else: line_num += 1 current_str += next_line clean_str = current_str.split(end_mark)[0] return {'current_str': clean_str, 'line_num': line_num}
[ "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_...
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 current offset into the array. Returns: Extended string up to line with end marker.
[ "Extract", "a", "multi", "-", "line", "string", "from", "a", "string", "array", "up", "to", "a", "specified", "end", "marker", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/docs/py2md.py#L7-L30
6,519
gbowerman/azurerm
docs/py2md.py
process_output
def process_output(meta_file, outfile_name, code_links): '''Create a markdown format documentation file. Args: meta_file (dict): Dictionary with documentation metadata. outfile_name (str): Markdown file to write to. ''' # 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 module (i.e. more than one # source file) if len(meta_file['modules']) > 1: doc_str += "## Contents\n" chapter_num = 1 for meta_doc in meta_file['modules']: chapter_name = meta_doc['summary_comment'] chapter_link = chapter_name.lstrip().replace('.', '').replace(' ', '-').lower() doc_str += str(chapter_num) + \ '. [' + chapter_name + '](#' + chapter_link + ')\n' chapter_num += 1 # Document each meta-file for meta_doc in meta_file['modules']: doc_str += '## ' + meta_doc['summary_comment'] + '\n' doc_str += '[source file](' + meta_doc['source_file'] + ')' + '\n' for function_info in meta_doc['functions']: doc_str += '### ' + function_info['name'] + '\n' doc_str += function_info['definition'] + '\n\n' if 'comments' in function_info: doc_str += '```\n' + function_info['comments'] + '\n```\n\n' # write the markdown to file print('Writing file: ' + outfile_name) out_file = open(outfile_name, 'w') out_file.write(doc_str) out_file.close()
python
def process_output(meta_file, outfile_name, code_links): '''Create a markdown format documentation file. Args: meta_file (dict): Dictionary with documentation metadata. outfile_name (str): Markdown file to write to. ''' # 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 module (i.e. more than one # source file) if len(meta_file['modules']) > 1: doc_str += "## Contents\n" chapter_num = 1 for meta_doc in meta_file['modules']: chapter_name = meta_doc['summary_comment'] chapter_link = chapter_name.lstrip().replace('.', '').replace(' ', '-').lower() doc_str += str(chapter_num) + \ '. [' + chapter_name + '](#' + chapter_link + ')\n' chapter_num += 1 # Document each meta-file for meta_doc in meta_file['modules']: doc_str += '## ' + meta_doc['summary_comment'] + '\n' doc_str += '[source file](' + meta_doc['source_file'] + ')' + '\n' for function_info in meta_doc['functions']: doc_str += '### ' + function_info['name'] + '\n' doc_str += function_info['definition'] + '\n\n' if 'comments' in function_info: doc_str += '```\n' + function_info['comments'] + '\n```\n\n' # write the markdown to file print('Writing file: ' + outfile_name) out_file = open(outfile_name, 'w') out_file.write(doc_str) out_file.close()
[ "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...
Create a markdown format documentation file. Args: meta_file (dict): Dictionary with documentation metadata. outfile_name (str): Markdown file to write to.
[ "Create", "a", "markdown", "format", "documentation", "file", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/docs/py2md.py#L83-L123
6,520
gbowerman/azurerm
azurerm/acs.py
create_container_service
def create_container_service(access_token, subscription_id, resource_group, service_name, \ agent_count, agent_vm_size, agent_dns, master_dns, admin_user, location, public_key=None,\ master_count=3, orchestrator='DCOS', app_id=None, app_secret=None, admin_password=None, \ ostype='Linux'): '''Create a new container service - include app_id and app_secret if using Kubernetes. 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. agent_count (int): The number of agent VMs. agent_vm_size (str): VM size of agents, e.g. Standard_D1_v2. agent_dns (str): A unique DNS string for the agent DNS. master_dns (str): A unique string for the master DNS. admin_user (str): Admin user name. location (str): Azure data center location, e.g. westus. public_key (str): RSA public key (utf-8). master_count (int): Number of master VMs. orchestrator (str): Container orchestrator. E.g. DCOS, Kubernetes. app_id (str): Application ID for Kubernetes. app_secret (str): Application secret for Kubernetes. admin_password (str): Admin user password. ostype (str): Operating system. Windows of Linux. Returns: HTTP response. Container service JSON model. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', resource_group, '/providers/Microsoft.ContainerService/ContainerServices/', service_name, '?api-version=', ACS_API]) acs_body = {'location': location} properties = {'orchestratorProfile': {'orchestratorType': orchestrator}} properties['masterProfile'] = {'count': master_count, 'dnsPrefix': master_dns} ap_profile = {'name': 'AgentPool1'} ap_profile['count'] = agent_count ap_profile['vmSize'] = agent_vm_size ap_profile['dnsPrefix'] = agent_dns properties['agentPoolProfiles'] = [ap_profile] if ostype == 'Linux': linux_profile = {'adminUsername': admin_user} linux_profile['ssh'] = {'publicKeys': [{'keyData': public_key}]} properties['linuxProfile'] = linux_profile else: # Windows windows_profile = {'adminUsername': admin_user, 'adminPassword': admin_password} properties['windowsProfile'] = windows_profile if orchestrator == 'Kubernetes': sp_profile = {'ClientID': app_id} sp_profile['Secret'] = app_secret properties['servicePrincipalProfile'] = sp_profile acs_body['properties'] = properties body = json.dumps(acs_body) return do_put(endpoint, body, access_token)
python
def create_container_service(access_token, subscription_id, resource_group, service_name, \ agent_count, agent_vm_size, agent_dns, master_dns, admin_user, location, public_key=None,\ master_count=3, orchestrator='DCOS', app_id=None, app_secret=None, admin_password=None, \ ostype='Linux'): '''Create a new container service - include app_id and app_secret if using Kubernetes. 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. agent_count (int): The number of agent VMs. agent_vm_size (str): VM size of agents, e.g. Standard_D1_v2. agent_dns (str): A unique DNS string for the agent DNS. master_dns (str): A unique string for the master DNS. admin_user (str): Admin user name. location (str): Azure data center location, e.g. westus. public_key (str): RSA public key (utf-8). master_count (int): Number of master VMs. orchestrator (str): Container orchestrator. E.g. DCOS, Kubernetes. app_id (str): Application ID for Kubernetes. app_secret (str): Application secret for Kubernetes. admin_password (str): Admin user password. ostype (str): Operating system. Windows of Linux. Returns: HTTP response. Container service JSON model. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', resource_group, '/providers/Microsoft.ContainerService/ContainerServices/', service_name, '?api-version=', ACS_API]) acs_body = {'location': location} properties = {'orchestratorProfile': {'orchestratorType': orchestrator}} properties['masterProfile'] = {'count': master_count, 'dnsPrefix': master_dns} ap_profile = {'name': 'AgentPool1'} ap_profile['count'] = agent_count ap_profile['vmSize'] = agent_vm_size ap_profile['dnsPrefix'] = agent_dns properties['agentPoolProfiles'] = [ap_profile] if ostype == 'Linux': linux_profile = {'adminUsername': admin_user} linux_profile['ssh'] = {'publicKeys': [{'keyData': public_key}]} properties['linuxProfile'] = linux_profile else: # Windows windows_profile = {'adminUsername': admin_user, 'adminPassword': admin_password} properties['windowsProfile'] = windows_profile if orchestrator == 'Kubernetes': sp_profile = {'ClientID': app_id} sp_profile['Secret'] = app_secret properties['servicePrincipalProfile'] = sp_profile acs_body['properties'] = properties body = json.dumps(acs_body) return do_put(endpoint, body, access_token)
[ "def", "create_container_service", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "service_name", ",", "agent_count", ",", "agent_vm_size", ",", "agent_dns", ",", "master_dns", ",", "admin_user", ",", "location", ",", "public_key", "=", "No...
Create a new container service - include app_id and app_secret if using Kubernetes. 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. agent_count (int): The number of agent VMs. agent_vm_size (str): VM size of agents, e.g. Standard_D1_v2. agent_dns (str): A unique DNS string for the agent DNS. master_dns (str): A unique string for the master DNS. admin_user (str): Admin user name. location (str): Azure data center location, e.g. westus. public_key (str): RSA public key (utf-8). master_count (int): Number of master VMs. orchestrator (str): Container orchestrator. E.g. DCOS, Kubernetes. app_id (str): Application ID for Kubernetes. app_secret (str): Application secret for Kubernetes. admin_password (str): Admin user password. ostype (str): Operating system. Windows of Linux. Returns: HTTP response. Container service JSON model.
[ "Create", "a", "new", "container", "service", "-", "include", "app_id", "and", "app_secret", "if", "using", "Kubernetes", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/acs.py#L7-L61
6,521
gbowerman/azurerm
azurerm/acs.py
delete_container_service
def delete_container_service(access_token, subscription_id, resource_group, service_name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', resource_group, '/providers/Microsoft.ContainerService/ContainerServices/', service_name, '?api-version=', ACS_API]) return do_delete(endpoint, access_token)
python
def delete_container_service(access_token, subscription_id, resource_group, service_name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', resource_group, '/providers/Microsoft.ContainerService/ContainerServices/', service_name, '?api-version=', ACS_API]) return do_delete(endpoint, access_token)
[ "def", "delete_container_service", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "service_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", ...
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.
[ "Delete", "a", "named", "container", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/acs.py#L64-L81
6,522
gbowerman/azurerm
azurerm/acs.py
get_container_service
def get_container_service(access_token, subscription_id, resource_group, service_name): '''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. JSON model. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', resource_group, '/providers/Microsoft.ContainerService/ContainerServices/', service_name, '?api-version=', ACS_API]) return do_get(endpoint, access_token)
python
def get_container_service(access_token, subscription_id, resource_group, service_name): '''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. JSON model. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', resource_group, '/providers/Microsoft.ContainerService/ContainerServices/', service_name, '?api-version=', ACS_API]) return do_get(endpoint, access_token)
[ "def", "get_container_service", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "service_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "...
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. JSON model.
[ "Get", "details", "about", "an", "Azure", "Container", "Server" ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/acs.py#L84-L101
6,523
gbowerman/azurerm
azurerm/acs.py
list_container_services
def list_container_services(access_token, subscription_id, resource_group): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', resource_group, '/providers/Microsoft.ContainerService/ContainerServices', '?api-version=', ACS_API]) return do_get(endpoint, access_token)
python
def list_container_services(access_token, subscription_id, resource_group): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', resource_group, '/providers/Microsoft.ContainerService/ContainerServices', '?api-version=', ACS_API]) return do_get(endpoint, access_token)
[ "def", "list_container_services", "(", "access_token", ",", "subscription_id", ",", "resource_group", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourcegroups/'", ...
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.
[ "List", "the", "container", "services", "in", "a", "resource", "group", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/acs.py#L119-L135
6,524
gbowerman/azurerm
azurerm/acs.py
list_container_services_sub
def list_container_services_sub(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.ContainerService/ContainerServices', '?api-version=', ACS_API]) return do_get(endpoint, access_token)
python
def list_container_services_sub(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.ContainerService/ContainerServices', '?api-version=', ACS_API]) return do_get(endpoint, access_token)
[ "def", "list_container_services_sub", "(", "access_token", ",", "subscription_id", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/Microsoft.ContainerService/Contain...
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.
[ "List", "the", "container", "services", "in", "a", "subscription", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/acs.py#L138-L152
6,525
gbowerman/azurerm
azurerm/storagerp.py
create_storage_account
def create_storage_account(access_token, subscription_id, rgname, account_name, location, storage_type='Standard_LRS'): '''Create a new storage account in the named resource group, with the named location. 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. location (str): Azure data center location. E.g. westus. storage_type (str): Premium or Standard, local or globally redundant. Defaults to Standard_LRS. Returns: HTTP response. JSON body of storage account properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', account_name, '?api-version=', STORAGE_API]) storage_body = {'location': location} storage_body['sku'] = {'name': storage_type} storage_body['kind'] = 'Storage' body = json.dumps(storage_body) return do_put(endpoint, body, access_token)
python
def create_storage_account(access_token, subscription_id, rgname, account_name, location, storage_type='Standard_LRS'): '''Create a new storage account in the named resource group, with the named location. 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. location (str): Azure data center location. E.g. westus. storage_type (str): Premium or Standard, local or globally redundant. Defaults to Standard_LRS. Returns: HTTP response. JSON body of storage account properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', account_name, '?api-version=', STORAGE_API]) storage_body = {'location': location} storage_body['sku'] = {'name': storage_type} storage_body['kind'] = 'Storage' body = json.dumps(storage_body) return do_put(endpoint, body, access_token)
[ "def", "create_storage_account", "(", "access_token", ",", "subscription_id", ",", "rgname", ",", "account_name", ",", "location", ",", "storage_type", "=", "'Standard_LRS'", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ...
Create a new storage account in the named resource group, with the named location. 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. location (str): Azure data center location. E.g. westus. storage_type (str): Premium or Standard, local or globally redundant. Defaults to Standard_LRS. Returns: HTTP response. JSON body of storage account properties.
[ "Create", "a", "new", "storage", "account", "in", "the", "named", "resource", "group", "with", "the", "named", "location", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/storagerp.py#L7-L33
6,526
gbowerman/azurerm
azurerm/storagerp.py
delete_storage_account
def delete_storage_account(access_token, subscription_id, rgname, account_name): '''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: HTTP response. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', account_name, '?api-version=', STORAGE_API]) return do_delete(endpoint, access_token)
python
def delete_storage_account(access_token, subscription_id, rgname, account_name): '''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: HTTP response. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', account_name, '?api-version=', STORAGE_API]) return do_delete(endpoint, access_token)
[ "def", "delete_storage_account", "(", "access_token", ",", "subscription_id", ",", "rgname", ",", "account_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resou...
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: HTTP response.
[ "Delete", "a", "storage", "account", "in", "the", "specified", "resource", "group", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/storagerp.py#L36-L53
6,527
gbowerman/azurerm
azurerm/storagerp.py
get_storage_account
def get_storage_account(access_token, subscription_id, rgname, account_name): '''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 response. JSON body of storage account properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', account_name, '?api-version=', STORAGE_API]) return do_get(endpoint, access_token)
python
def get_storage_account(access_token, subscription_id, rgname, account_name): '''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 response. JSON body of storage account properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', account_name, '?api-version=', STORAGE_API]) return do_get(endpoint, access_token)
[ "def", "get_storage_account", "(", "access_token", ",", "subscription_id", ",", "rgname", ",", "account_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resource...
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 response. JSON body of storage account properties.
[ "Get", "the", "properties", "for", "the", "named", "storage", "account", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/storagerp.py#L56-L73
6,528
gbowerman/azurerm
azurerm/storagerp.py
get_storage_account_keys
def get_storage_account_keys(access_token, subscription_id, rgname, account_name): '''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 response. JSON body of storage account keys. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', account_name, '/listKeys', '?api-version=', STORAGE_API]) return do_post(endpoint, '', access_token)
python
def get_storage_account_keys(access_token, subscription_id, rgname, account_name): '''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 response. JSON body of storage account keys. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', account_name, '/listKeys', '?api-version=', STORAGE_API]) return do_post(endpoint, '', access_token)
[ "def", "get_storage_account_keys", "(", "access_token", ",", "subscription_id", ",", "rgname", ",", "account_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/res...
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 response. JSON body of storage account keys.
[ "Get", "the", "access", "keys", "for", "the", "specified", "storage", "account", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/storagerp.py#L76-L94
6,529
gbowerman/azurerm
azurerm/storagerp.py
get_storage_usage
def get_storage_usage(access_token, subscription_id, location): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Storage/locations/', location, '/usages', '?api-version=', STORAGE_API]) return do_get(endpoint, access_token)
python
def get_storage_usage(access_token, subscription_id, location): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Storage/locations/', location, '/usages', '?api-version=', STORAGE_API]) return do_get(endpoint, access_token)
[ "def", "get_storage_usage", "(", "access_token", ",", "subscription_id", ",", "location", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/Microsoft.Storage/locat...
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.
[ "Returns", "storage", "usage", "and", "quota", "information", "for", "the", "specified", "subscription", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/storagerp.py#L97-L112
6,530
gbowerman/azurerm
azurerm/storagerp.py
list_storage_accounts_rg
def list_storage_accounts_rg(access_token, subscription_id, rgname): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts', '?api-version=', STORAGE_API]) return do_get(endpoint, access_token)
python
def list_storage_accounts_rg(access_token, subscription_id, rgname): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts', '?api-version=', STORAGE_API]) return do_get(endpoint, access_token)
[ "def", "list_storage_accounts_rg", "(", "access_token", ",", "subscription_id", ",", "rgname", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourcegroups/'", ",", ...
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.
[ "List", "the", "storage", "accounts", "in", "the", "specified", "resource", "group", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/storagerp.py#L115-L131
6,531
gbowerman/azurerm
azurerm/storagerp.py
list_storage_accounts_sub
def list_storage_accounts_sub(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Storage/storageAccounts', '?api-version=', STORAGE_API]) return do_get(endpoint, access_token)
python
def list_storage_accounts_sub(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Storage/storageAccounts', '?api-version=', STORAGE_API]) return do_get(endpoint, access_token)
[ "def", "list_storage_accounts_sub", "(", "access_token", ",", "subscription_id", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/Microsoft.Storage/storageAccounts'",...
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.
[ "List", "the", "storage", "accounts", "in", "the", "specified", "subscription", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/storagerp.py#L134-L148
6,532
gbowerman/azurerm
examples/list_storage.py
rgfromid
def rgfromid(idstr): '''get resource group name from the id string''' rgidx = idstr.find('resourceGroups/') providx = idstr.find('/providers/') return idstr[rgidx + 15:providx]
python
def rgfromid(idstr): '''get resource group name from the id string''' rgidx = idstr.find('resourceGroups/') providx = idstr.find('/providers/') return idstr[rgidx + 15:providx]
[ "def", "rgfromid", "(", "idstr", ")", ":", "rgidx", "=", "idstr", ".", "find", "(", "'resourceGroups/'", ")", "providx", "=", "idstr", ".", "find", "(", "'/providers/'", ")", "return", "idstr", "[", "rgidx", "+", "15", ":", "providx", "]" ]
get resource group name from the id string
[ "get", "resource", "group", "name", "from", "the", "id", "string" ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/list_storage.py#L8-L12
6,533
gbowerman/azurerm
azurerm/amsrp.py
check_media_service_name_availability
def check_media_service_name_availability(access_token, subscription_id, msname): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/microsoft.media/CheckNameAvailability?', 'api-version=', MEDIA_API]) ms_body = {'name': msname} ms_body['type'] = 'mediaservices' body = json.dumps(ms_body) return do_post(endpoint, body, access_token)
python
def check_media_service_name_availability(access_token, subscription_id, msname): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/microsoft.media/CheckNameAvailability?', 'api-version=', MEDIA_API]) ms_body = {'name': msname} ms_body['type'] = 'mediaservices' body = json.dumps(ms_body) return do_post(endpoint, body, access_token)
[ "def", "check_media_service_name_availability", "(", "access_token", ",", "subscription_id", ",", "msname", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/micro...
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.
[ "Check", "media", "service", "name", "availability", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L9-L27
6,534
gbowerman/azurerm
azurerm/amsrp.py
create_media_service_rg
def create_media_service_rg(access_token, subscription_id, rgname, location, stoname, msname): '''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 storage account name. msname (str): Media service name. Returns: HTTP response. JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', rgname, '/providers/microsoft.media/mediaservices/', msname, '?api-version=', MEDIA_API]) ms_body = {'name': msname} ms_body['location'] = location sub_id_str = '/subscriptions/' + subscription_id + '/resourceGroups/' + rgname + \ '/providers/Microsoft.Storage/storageAccounts/' + stoname storage_account = {'id': sub_id_str} storage_account['isPrimary'] = True properties = {'storageAccounts': [storage_account]} ms_body['properties'] = properties body = json.dumps(ms_body) return do_put(endpoint, body, access_token)
python
def create_media_service_rg(access_token, subscription_id, rgname, location, stoname, msname): '''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 storage account name. msname (str): Media service name. Returns: HTTP response. JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', rgname, '/providers/microsoft.media/mediaservices/', msname, '?api-version=', MEDIA_API]) ms_body = {'name': msname} ms_body['location'] = location sub_id_str = '/subscriptions/' + subscription_id + '/resourceGroups/' + rgname + \ '/providers/Microsoft.Storage/storageAccounts/' + stoname storage_account = {'id': sub_id_str} storage_account['isPrimary'] = True properties = {'storageAccounts': [storage_account]} ms_body['properties'] = properties body = json.dumps(ms_body) return do_put(endpoint, body, access_token)
[ "def", "create_media_service_rg", "(", "access_token", ",", "subscription_id", ",", "rgname", ",", "location", ",", "stoname", ",", "msname", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", ...
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 storage account name. msname (str): Media service name. Returns: HTTP response. JSON body.
[ "Create", "a", "media", "service", "in", "a", "resource", "group", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L30-L58
6,535
gbowerman/azurerm
azurerm/amsrp.py
delete_media_service_rg
def delete_media_service_rg(access_token, subscription_id, rgname, msname): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', rgname, '/providers/microsoft.media/mediaservices/', msname, '?api-version=', MEDIA_API]) return do_delete(endpoint, access_token)
python
def delete_media_service_rg(access_token, subscription_id, rgname, msname): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', rgname, '/providers/microsoft.media/mediaservices/', msname, '?api-version=', MEDIA_API]) return do_delete(endpoint, access_token)
[ "def", "delete_media_service_rg", "(", "access_token", ",", "subscription_id", ",", "rgname", ",", "msname", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGr...
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.
[ "Delete", "a", "media", "service", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L61-L78
6,536
gbowerman/azurerm
azurerm/amsrp.py
list_media_endpoint_keys
def list_media_endpoint_keys(access_token, subscription_id, rgname, msname): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', rgname, '/providers/microsoft.media/', '/mediaservices/', msname, '/listKeys?api-version=', MEDIA_API]) return do_get(endpoint, access_token)
python
def list_media_endpoint_keys(access_token, subscription_id, rgname, msname): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', rgname, '/providers/microsoft.media/', '/mediaservices/', msname, '/listKeys?api-version=', MEDIA_API]) return do_get(endpoint, access_token)
[ "def", "list_media_endpoint_keys", "(", "access_token", ",", "subscription_id", ",", "rgname", ",", "msname", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceG...
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.
[ "list", "the", "media", "endpoint", "keys", "in", "a", "media", "service" ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L81-L99
6,537
gbowerman/azurerm
azurerm/amsrp.py
list_media_services
def list_media_services(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/microsoft.media/mediaservices?api-version=', MEDIA_API]) return do_get(endpoint, access_token)
python
def list_media_services(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/microsoft.media/mediaservices?api-version=', MEDIA_API]) return do_get(endpoint, access_token)
[ "def", "list_media_services", "(", "access_token", ",", "subscription_id", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/microsoft.media/mediaservices?api-version=...
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.
[ "List", "the", "media", "services", "in", "a", "subscription", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L102-L115
6,538
gbowerman/azurerm
azurerm/amsrp.py
list_media_services_rg
def list_media_services_rg(access_token, subscription_id, rgname): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', rgname, '/providers/microsoft.media/mediaservices?api-version=', MEDIA_API]) return do_get(endpoint, access_token)
python
def list_media_services_rg(access_token, subscription_id, rgname): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', rgname, '/providers/microsoft.media/mediaservices?api-version=', MEDIA_API]) return do_get(endpoint, access_token)
[ "def", "list_media_services_rg", "(", "access_token", ",", "subscription_id", ",", "rgname", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGroups/'", ",", "r...
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.
[ "List", "the", "media", "services", "in", "a", "resource", "group", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L118-L133
6,539
gbowerman/azurerm
azurerm/amsrp.py
get_ams_access_token
def get_ams_access_token(accountname, accountkey): '''Get Media Services Authentication Token. Args: accountname (str): Azure Media Services account name. accountkey (str): Azure Media Services Key. Returns: HTTP response. JSON body. ''' 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, body)
python
def get_ams_access_token(accountname, accountkey): '''Get Media Services Authentication Token. Args: accountname (str): Azure Media Services account name. accountkey (str): Azure Media Services Key. Returns: HTTP response. JSON body. ''' 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, body)
[ "def", "get_ams_access_token", "(", "accountname", ",", "accountkey", ")", ":", "accountkey_encoded", "=", "urllib", ".", "parse", ".", "quote", "(", "accountkey", ",", "safe", "=", "''", ")", "body", "=", "\"grant_type=client_credentials&client_id=\"", "+", "acco...
Get Media Services Authentication Token. Args: accountname (str): Azure Media Services account name. accountkey (str): Azure Media Services Key. Returns: HTTP response. JSON body.
[ "Get", "Media", "Services", "Authentication", "Token", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L136-L149
6,540
gbowerman/azurerm
azurerm/amsrp.py
create_media_asset
def create_media_asset(access_token, name, options="0"): '''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. ''' path = '/Assets' endpoint = ''.join([ams_rest_endpoint, path]) body = '{"Name": "' + name + '", "Options": "' + str(options) + '"}' return do_ams_post(endpoint, path, body, access_token)
python
def create_media_asset(access_token, name, options="0"): '''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. ''' path = '/Assets' endpoint = ''.join([ams_rest_endpoint, path]) body = '{"Name": "' + name + '", "Options": "' + str(options) + '"}' return do_ams_post(endpoint, path, body, access_token)
[ "def", "create_media_asset", "(", "access_token", ",", "name", ",", "options", "=", "\"0\"", ")", ":", "path", "=", "'/Assets'", "endpoint", "=", "''", ".", "join", "(", "[", "ams_rest_endpoint", ",", "path", "]", ")", "body", "=", "'{\"Name\": \"'", "+", ...
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.
[ "Create", "Media", "Service", "Asset", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L404-L418
6,541
gbowerman/azurerm
azurerm/amsrp.py
create_media_assetfile
def create_media_assetfile(access_token, parent_asset_id, name, is_primary="false", \ is_encrypted="false", encryption_scheme="None", encryptionkey_id="None"): '''Create Media Service Asset File. Args: access_token (str): A valid Azure authentication token. parent_asset_id (str): Media Service Parent Asset ID. name (str): Media Service Asset Name. is_primary (str): Media Service Primary Flag. is_encrypted (str): Media Service Encryption Flag. encryption_scheme (str): Media Service Encryption Scheme. encryptionkey_id (str): Media Service Encryption Key ID. Returns: HTTP response. JSON body. ''' path = '/Files' endpoint = ''.join([ams_rest_endpoint, path]) if encryption_scheme == "StorageEncryption": body = '{ \ "IsEncrypted": "' + is_encrypted + '", \ "EncryptionScheme": "' + encryption_scheme + '", \ "EncryptionVersion": "' + "1.0" + '", \ "EncryptionKeyId": "' + encryptionkey_id + '", \ "IsPrimary": "' + is_primary + '", \ "MimeType": "video/mp4", \ "Name": "' + name + '", \ "ParentAssetId": "' + parent_asset_id + '" \ }' else: body = '{ \ "IsPrimary": "' + is_primary + '", \ "MimeType": "video/mp4", \ "Name": "' + name + '", \ "ParentAssetId": "' + parent_asset_id + '" \ }' return do_ams_post(endpoint, path, body, access_token)
python
def create_media_assetfile(access_token, parent_asset_id, name, is_primary="false", \ is_encrypted="false", encryption_scheme="None", encryptionkey_id="None"): '''Create Media Service Asset File. Args: access_token (str): A valid Azure authentication token. parent_asset_id (str): Media Service Parent Asset ID. name (str): Media Service Asset Name. is_primary (str): Media Service Primary Flag. is_encrypted (str): Media Service Encryption Flag. encryption_scheme (str): Media Service Encryption Scheme. encryptionkey_id (str): Media Service Encryption Key ID. Returns: HTTP response. JSON body. ''' path = '/Files' endpoint = ''.join([ams_rest_endpoint, path]) if encryption_scheme == "StorageEncryption": body = '{ \ "IsEncrypted": "' + is_encrypted + '", \ "EncryptionScheme": "' + encryption_scheme + '", \ "EncryptionVersion": "' + "1.0" + '", \ "EncryptionKeyId": "' + encryptionkey_id + '", \ "IsPrimary": "' + is_primary + '", \ "MimeType": "video/mp4", \ "Name": "' + name + '", \ "ParentAssetId": "' + parent_asset_id + '" \ }' else: body = '{ \ "IsPrimary": "' + is_primary + '", \ "MimeType": "video/mp4", \ "Name": "' + name + '", \ "ParentAssetId": "' + parent_asset_id + '" \ }' return do_ams_post(endpoint, path, body, access_token)
[ "def", "create_media_assetfile", "(", "access_token", ",", "parent_asset_id", ",", "name", ",", "is_primary", "=", "\"false\"", ",", "is_encrypted", "=", "\"false\"", ",", "encryption_scheme", "=", "\"None\"", ",", "encryptionkey_id", "=", "\"None\"", ")", ":", "p...
Create Media Service Asset File. Args: access_token (str): A valid Azure authentication token. parent_asset_id (str): Media Service Parent Asset ID. name (str): Media Service Asset Name. is_primary (str): Media Service Primary Flag. is_encrypted (str): Media Service Encryption Flag. encryption_scheme (str): Media Service Encryption Scheme. encryptionkey_id (str): Media Service Encryption Key ID. Returns: HTTP response. JSON body.
[ "Create", "Media", "Service", "Asset", "File", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L421-L457
6,542
gbowerman/azurerm
azurerm/amsrp.py
create_sas_locator
def create_sas_locator(access_token, asset_id, accesspolicy_id): '''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. ''' 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)
python
def create_sas_locator(access_token, asset_id, accesspolicy_id): '''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. ''' 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)
[ "def", "create_sas_locator", "(", "access_token", ",", "asset_id", ",", "accesspolicy_id", ")", ":", "path", "=", "'/Locators'", "endpoint", "=", "''", ".", "join", "(", "[", "ams_rest_endpoint", ",", "path", "]", ")", "body", "=", "'{ \\\n\t\t\"AccessPolicyId\"...
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.
[ "Create", "Media", "Service", "SAS", "Locator", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L460-L478
6,543
gbowerman/azurerm
azurerm/amsrp.py
create_asset_delivery_policy
def create_asset_delivery_policy(access_token, ams_account, key_delivery_url): '''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. ''' path = '/AssetDeliveryPolicies' endpoint = ''.join([ams_rest_endpoint, path]) body = '{ \ "Name":"AssetDeliveryPolicy", \ "AssetDeliveryProtocol":"4", \ "AssetDeliveryPolicyType":"3", \ "AssetDeliveryConfiguration":"[{ \ \\"Key\\":\\"2\\", \ \\"Value\\":\\"' + key_delivery_url + '\\"}]" \ }' return do_ams_post(endpoint, path, body, access_token)
python
def create_asset_delivery_policy(access_token, ams_account, key_delivery_url): '''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. ''' path = '/AssetDeliveryPolicies' endpoint = ''.join([ams_rest_endpoint, path]) body = '{ \ "Name":"AssetDeliveryPolicy", \ "AssetDeliveryProtocol":"4", \ "AssetDeliveryPolicyType":"3", \ "AssetDeliveryConfiguration":"[{ \ \\"Key\\":\\"2\\", \ \\"Value\\":\\"' + key_delivery_url + '\\"}]" \ }' return do_ams_post(endpoint, path, body, access_token)
[ "def", "create_asset_delivery_policy", "(", "access_token", ",", "ams_account", ",", "key_delivery_url", ")", ":", "path", "=", "'/AssetDeliveryPolicies'", "endpoint", "=", "''", ".", "join", "(", "[", "ams_rest_endpoint", ",", "path", "]", ")", "body", "=", "'{...
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.
[ "Create", "Media", "Service", "Asset", "Delivery", "Policy", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L481-L501
6,544
gbowerman/azurerm
azurerm/amsrp.py
create_contentkey_authorization_policy
def create_contentkey_authorization_policy(access_token, content): '''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. ''' path = '/ContentKeyAuthorizationPolicies' endpoint = ''.join([ams_rest_endpoint, path]) body = content return do_ams_post(endpoint, path, body, access_token)
python
def create_contentkey_authorization_policy(access_token, content): '''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. ''' path = '/ContentKeyAuthorizationPolicies' endpoint = ''.join([ams_rest_endpoint, path]) body = content return do_ams_post(endpoint, path, body, access_token)
[ "def", "create_contentkey_authorization_policy", "(", "access_token", ",", "content", ")", ":", "path", "=", "'/ContentKeyAuthorizationPolicies'", "endpoint", "=", "''", ".", "join", "(", "[", "ams_rest_endpoint", ",", "path", "]", ")", "body", "=", "content", "re...
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.
[ "Create", "Media", "Service", "Content", "Key", "Authorization", "Policy", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L504-L517
6,545
gbowerman/azurerm
azurerm/amsrp.py
create_contentkey_authorization_policy_options
def create_contentkey_authorization_policy_options(access_token, key_delivery_type="2", \ name="HLS Open Authorization Policy", key_restriction_type="0"): '''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. key_restiction_type (str): A Media Service Contenty Key Restriction Type. Returns: HTTP response. JSON body. ''' path = '/ContentKeyAuthorizationPolicyOptions' endpoint = ''.join([ams_rest_endpoint, path]) body = '{ \ "Name":"policy",\ "KeyDeliveryType":"' + key_delivery_type + '", \ "KeyDeliveryConfiguration":"", \ "Restrictions":[{ \ "Name":"' + name + '", \ "KeyRestrictionType":"' + key_restriction_type + '", \ "Requirements":null \ }] \ }' return do_ams_post(endpoint, path, body, access_token, "json_only")
python
def create_contentkey_authorization_policy_options(access_token, key_delivery_type="2", \ name="HLS Open Authorization Policy", key_restriction_type="0"): '''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. key_restiction_type (str): A Media Service Contenty Key Restriction Type. Returns: HTTP response. JSON body. ''' path = '/ContentKeyAuthorizationPolicyOptions' endpoint = ''.join([ams_rest_endpoint, path]) body = '{ \ "Name":"policy",\ "KeyDeliveryType":"' + key_delivery_type + '", \ "KeyDeliveryConfiguration":"", \ "Restrictions":[{ \ "Name":"' + name + '", \ "KeyRestrictionType":"' + key_restriction_type + '", \ "Requirements":null \ }] \ }' return do_ams_post(endpoint, path, body, access_token, "json_only")
[ "def", "create_contentkey_authorization_policy_options", "(", "access_token", ",", "key_delivery_type", "=", "\"2\"", ",", "name", "=", "\"HLS Open Authorization Policy\"", ",", "key_restriction_type", "=", "\"0\"", ")", ":", "path", "=", "'/ContentKeyAuthorizationPolicyOptio...
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. key_restiction_type (str): A Media Service Contenty Key Restriction Type. Returns: HTTP response. JSON body.
[ "Create", "Media", "Service", "Content", "Key", "Authorization", "Policy", "Options", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L520-L545
6,546
gbowerman/azurerm
azurerm/amsrp.py
create_ondemand_streaming_locator
def create_ondemand_streaming_locator(access_token, encoded_asset_id, pid, starttime=None): '''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 response. JSON body. ''' path = '/Locators' endpoint = ''.join([ams_rest_endpoint, path]) if starttime is None: body = '{ \ "AccessPolicyId":"' + pid + '", \ "AssetId":"' + encoded_asset_id + '", \ "Type": "2" \ }' else: body = '{ \ "AccessPolicyId":"' + pid + '", \ "AssetId":"' + encoded_asset_id + '", \ "StartTime":"' + str(starttime) + '", \ "Type": "2" \ }' return do_ams_post(endpoint, path, body, access_token, "json_only")
python
def create_ondemand_streaming_locator(access_token, encoded_asset_id, pid, starttime=None): '''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 response. JSON body. ''' path = '/Locators' endpoint = ''.join([ams_rest_endpoint, path]) if starttime is None: body = '{ \ "AccessPolicyId":"' + pid + '", \ "AssetId":"' + encoded_asset_id + '", \ "Type": "2" \ }' else: body = '{ \ "AccessPolicyId":"' + pid + '", \ "AssetId":"' + encoded_asset_id + '", \ "StartTime":"' + str(starttime) + '", \ "Type": "2" \ }' return do_ams_post(endpoint, path, body, access_token, "json_only")
[ "def", "create_ondemand_streaming_locator", "(", "access_token", ",", "encoded_asset_id", ",", "pid", ",", "starttime", "=", "None", ")", ":", "path", "=", "'/Locators'", "endpoint", "=", "''", ".", "join", "(", "[", "ams_rest_endpoint", ",", "path", "]", ")",...
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 response. JSON body.
[ "Create", "Media", "Service", "OnDemand", "Streaming", "Locator", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L548-L575
6,547
gbowerman/azurerm
azurerm/amsrp.py
create_asset_accesspolicy
def create_asset_accesspolicy(access_token, name, duration, permission="1"): '''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. JSON body. ''' path = '/AccessPolicies' endpoint = ''.join([ams_rest_endpoint, path]) body = '{ \ "Name": "' + str(name) + '", \ "DurationInMinutes": "' + duration + '", \ "Permissions": "' + permission + '" \ }' return do_ams_post(endpoint, path, body, access_token)
python
def create_asset_accesspolicy(access_token, name, duration, permission="1"): '''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. JSON body. ''' path = '/AccessPolicies' endpoint = ''.join([ams_rest_endpoint, path]) body = '{ \ "Name": "' + str(name) + '", \ "DurationInMinutes": "' + duration + '", \ "Permissions": "' + permission + '" \ }' return do_ams_post(endpoint, path, body, access_token)
[ "def", "create_asset_accesspolicy", "(", "access_token", ",", "name", ",", "duration", ",", "permission", "=", "\"1\"", ")", ":", "path", "=", "'/AccessPolicies'", "endpoint", "=", "''", ".", "join", "(", "[", "ams_rest_endpoint", ",", "path", "]", ")", "bod...
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. JSON body.
[ "Create", "Media", "Service", "Asset", "Access", "Policy", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L578-L597
6,548
gbowerman/azurerm
azurerm/amsrp.py
create_streaming_endpoint
def create_streaming_endpoint(access_token, name, description="New Streaming Endpoint", \ scale_units="1"): '''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. Returns: HTTP response. JSON body. ''' path = '/StreamingEndpoints' endpoint = ''.join([ams_rest_endpoint, path]) body = '{ \ "Id":null, \ "Name":"' + name + '", \ "Description":"' + description + '", \ "Created":"0001-01-01T00:00:00", \ "LastModified":"0001-01-01T00:00:00", \ "State":null, \ "HostName":null, \ "ScaleUnits":"' + scale_units + '", \ "CrossSiteAccessPolicies":{ \ "ClientAccessPolicy":"<access-policy><cross-domain-access><policy><allow-from http-request-headers=\\"*\\"><domain uri=\\"http://*\\" /></allow-from><grant-to><resource path=\\"/\\" include-subpaths=\\"false\\" /></grant-to></policy></cross-domain-access></access-policy>", \ "CrossDomainPolicy":"<?xml version=\\"1.0\\"?><!DOCTYPE cross-domain-policy SYSTEM \\"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\\"><cross-domain-policy><allow-access-from domain=\\"*\\" /></cross-domain-policy>" \ } \ }' return do_ams_post(endpoint, path, body, access_token)
python
def create_streaming_endpoint(access_token, name, description="New Streaming Endpoint", \ scale_units="1"): '''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. Returns: HTTP response. JSON body. ''' path = '/StreamingEndpoints' endpoint = ''.join([ams_rest_endpoint, path]) body = '{ \ "Id":null, \ "Name":"' + name + '", \ "Description":"' + description + '", \ "Created":"0001-01-01T00:00:00", \ "LastModified":"0001-01-01T00:00:00", \ "State":null, \ "HostName":null, \ "ScaleUnits":"' + scale_units + '", \ "CrossSiteAccessPolicies":{ \ "ClientAccessPolicy":"<access-policy><cross-domain-access><policy><allow-from http-request-headers=\\"*\\"><domain uri=\\"http://*\\" /></allow-from><grant-to><resource path=\\"/\\" include-subpaths=\\"false\\" /></grant-to></policy></cross-domain-access></access-policy>", \ "CrossDomainPolicy":"<?xml version=\\"1.0\\"?><!DOCTYPE cross-domain-policy SYSTEM \\"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\\"><cross-domain-policy><allow-access-from domain=\\"*\\" /></cross-domain-policy>" \ } \ }' return do_ams_post(endpoint, path, body, access_token)
[ "def", "create_streaming_endpoint", "(", "access_token", ",", "name", ",", "description", "=", "\"New Streaming Endpoint\"", ",", "scale_units", "=", "\"1\"", ")", ":", "path", "=", "'/StreamingEndpoints'", "endpoint", "=", "''", ".", "join", "(", "[", "ams_rest_e...
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. Returns: HTTP response. JSON body.
[ "Create", "Media", "Service", "Streaming", "Endpoint", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L600-L629
6,549
gbowerman/azurerm
azurerm/amsrp.py
scale_streaming_endpoint
def scale_streaming_endpoint(access_token, streaming_endpoint_id, scale_units): '''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. ''' 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]) body = '{"scaleUnits": "' + str(scale_units) + '"}' return do_ams_post(endpoint, full_path_encoded, body, access_token)
python
def scale_streaming_endpoint(access_token, streaming_endpoint_id, scale_units): '''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. ''' 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]) body = '{"scaleUnits": "' + str(scale_units) + '"}' return do_ams_post(endpoint, full_path_encoded, body, access_token)
[ "def", "scale_streaming_endpoint", "(", "access_token", ",", "streaming_endpoint_id", ",", "scale_units", ")", ":", "path", "=", "'/StreamingEndpoints'", "full_path", "=", "''", ".", "join", "(", "[", "path", ",", "\"('\"", ",", "streaming_endpoint_id", ",", "\"')...
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.
[ "Scale", "Media", "Service", "Streaming", "Endpoint", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L632-L648
6,550
gbowerman/azurerm
azurerm/amsrp.py
link_asset_content_key
def link_asset_content_key(access_token, asset_id, encryptionkey_id, ams_redirected_rest_endpoint): '''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: HTTP response. JSON body. ''' 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_encoded]) uri = ''.join([ams_redirected_rest_endpoint, 'ContentKeys', "('", encryptionkey_id, "')"]) body = '{"uri": "' + uri + '"}' return do_ams_post(endpoint, full_path_encoded, body, access_token)
python
def link_asset_content_key(access_token, asset_id, encryptionkey_id, ams_redirected_rest_endpoint): '''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: HTTP response. JSON body. ''' 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_encoded]) uri = ''.join([ams_redirected_rest_endpoint, 'ContentKeys', "('", encryptionkey_id, "')"]) body = '{"uri": "' + uri + '"}' return do_ams_post(endpoint, full_path_encoded, body, access_token)
[ "def", "link_asset_content_key", "(", "access_token", ",", "asset_id", ",", "encryptionkey_id", ",", "ams_redirected_rest_endpoint", ")", ":", "path", "=", "'/Assets'", "full_path", "=", "''", ".", "join", "(", "[", "path", ",", "\"('\"", ",", "asset_id", ",", ...
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: HTTP response. JSON body.
[ "Link", "Media", "Service", "Asset", "and", "Content", "Key", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L651-L669
6,551
gbowerman/azurerm
azurerm/amsrp.py
link_contentkey_authorization_policy
def link_contentkey_authorization_policy(access_token, ckap_id, options_id, \ ams_redirected_rest_endpoint): '''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_rest_endpoint (str): A Media Service Redirected Endpoint. Returns: HTTP response. JSON body. ''' path = '/ContentKeyAuthorizationPolicies' full_path = ''.join([path, "('", ckap_id, "')", "/$links/Options"]) full_path_encoded = urllib.parse.quote(full_path, safe='') endpoint = ''.join([ams_rest_endpoint, full_path_encoded]) uri = ''.join([ams_redirected_rest_endpoint, 'ContentKeyAuthorizationPolicyOptions', \ "('", options_id, "')"]) body = '{"uri": "' + uri + '"}' return do_ams_post(endpoint, full_path_encoded, body, access_token, "json_only", "1.0;NetFx")
python
def link_contentkey_authorization_policy(access_token, ckap_id, options_id, \ ams_redirected_rest_endpoint): '''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_rest_endpoint (str): A Media Service Redirected Endpoint. Returns: HTTP response. JSON body. ''' path = '/ContentKeyAuthorizationPolicies' full_path = ''.join([path, "('", ckap_id, "')", "/$links/Options"]) full_path_encoded = urllib.parse.quote(full_path, safe='') endpoint = ''.join([ams_rest_endpoint, full_path_encoded]) uri = ''.join([ams_redirected_rest_endpoint, 'ContentKeyAuthorizationPolicyOptions', \ "('", options_id, "')"]) body = '{"uri": "' + uri + '"}' return do_ams_post(endpoint, full_path_encoded, body, access_token, "json_only", "1.0;NetFx")
[ "def", "link_contentkey_authorization_policy", "(", "access_token", ",", "ckap_id", ",", "options_id", ",", "ams_redirected_rest_endpoint", ")", ":", "path", "=", "'/ContentKeyAuthorizationPolicies'", "full_path", "=", "''", ".", "join", "(", "[", "path", ",", "\"('\"...
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_rest_endpoint (str): A Media Service Redirected Endpoint. Returns: HTTP response. JSON body.
[ "Link", "Media", "Service", "Content", "Key", "Authorization", "Policy", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L693-L713
6,552
gbowerman/azurerm
azurerm/amsrp.py
add_authorization_policy
def add_authorization_policy(access_token, ck_id, oid): '''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. ''' path = '/ContentKeys' body = '{"AuthorizationPolicyId":"' + oid + '"}' return helper_add(access_token, ck_id, path, body)
python
def add_authorization_policy(access_token, ck_id, oid): '''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. ''' path = '/ContentKeys' body = '{"AuthorizationPolicyId":"' + oid + '"}' return helper_add(access_token, ck_id, path, body)
[ "def", "add_authorization_policy", "(", "access_token", ",", "ck_id", ",", "oid", ")", ":", "path", "=", "'/ContentKeys'", "body", "=", "'{\"AuthorizationPolicyId\":\"'", "+", "oid", "+", "'\"}'", "return", "helper_add", "(", "access_token", ",", "ck_id", ",", "...
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.
[ "Add", "Media", "Service", "Authorization", "Policy", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L716-L729
6,553
gbowerman/azurerm
azurerm/amsrp.py
update_media_assetfile
def update_media_assetfile(access_token, parent_asset_id, asset_id, content_length, name): '''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): A Media Service Asset name. Returns: HTTP response. JSON body. ''' 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 = '{ \ "ContentFileSize": "' + str(content_length) + '", \ "Id": "' + asset_id + '", \ "MimeType": "video/mp4", \ "Name": "' + name + '", \ "ParentAssetId": "' + parent_asset_id + '" \ }' return do_ams_patch(endpoint, full_path_encoded, body, access_token)
python
def update_media_assetfile(access_token, parent_asset_id, asset_id, content_length, name): '''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): A Media Service Asset name. Returns: HTTP response. JSON body. ''' 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 = '{ \ "ContentFileSize": "' + str(content_length) + '", \ "Id": "' + asset_id + '", \ "MimeType": "video/mp4", \ "Name": "' + name + '", \ "ParentAssetId": "' + parent_asset_id + '" \ }' return do_ams_patch(endpoint, full_path_encoded, body, access_token)
[ "def", "update_media_assetfile", "(", "access_token", ",", "parent_asset_id", ",", "asset_id", ",", "content_length", ",", "name", ")", ":", "path", "=", "'/Files'", "full_path", "=", "''", ".", "join", "(", "[", "path", ",", "\"('\"", ",", "asset_id", ",", ...
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): A Media Service Asset name. Returns: HTTP response. JSON body.
[ "Update", "Media", "Service", "Asset", "File", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L732-L756
6,554
gbowerman/azurerm
azurerm/amsrp.py
get_key_delivery_url
def get_key_delivery_url(access_token, ck_id, key_type): '''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. ''' 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, access_token)
python
def get_key_delivery_url(access_token, ck_id, key_type): '''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. ''' 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, access_token)
[ "def", "get_key_delivery_url", "(", "access_token", ",", "ck_id", ",", "key_type", ")", ":", "path", "=", "'/ContentKeys'", "full_path", "=", "''", ".", "join", "(", "[", "path", ",", "\"('\"", ",", "ck_id", ",", "\"')\"", ",", "\"/GetKeyDeliveryUrl\"", "]",...
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.
[ "Get", "Media", "Services", "Key", "Delivery", "URL", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L759-L774
6,555
gbowerman/azurerm
azurerm/amsrp.py
encode_mezzanine_asset
def encode_mezzanine_asset(access_token, processor_id, asset_id, output_assetname, json_profile): '''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 Service JSON Profile. Returns: HTTP response. JSON body. ''' 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 = ''.join([ams_rest_endpoint, assets_path_encoded]) body = '{ \ "Name":"' + output_assetname + '", \ "InputMediaAssets":[{ \ "__metadata":{ \ "uri":"' + endpoint_assets + '" \ } \ }], \ "Tasks":[{ \ "Configuration":\'' + json_profile + '\', \ "MediaProcessorId":"' + processor_id + '", \ "TaskBody":"<?xml version=\\"1.0\\" encoding=\\"utf-16\\"?><taskBody><inputAsset>JobInputAsset(0)</inputAsset><outputAsset assetCreationOptions=\\"0\\" assetName=\\"' + output_assetname + '\\">JobOutputAsset(0)</outputAsset></taskBody>" \ }] \ }' return do_ams_post(endpoint, path, body, access_token)
python
def encode_mezzanine_asset(access_token, processor_id, asset_id, output_assetname, json_profile): '''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 Service JSON Profile. Returns: HTTP response. JSON body. ''' 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 = ''.join([ams_rest_endpoint, assets_path_encoded]) body = '{ \ "Name":"' + output_assetname + '", \ "InputMediaAssets":[{ \ "__metadata":{ \ "uri":"' + endpoint_assets + '" \ } \ }], \ "Tasks":[{ \ "Configuration":\'' + json_profile + '\', \ "MediaProcessorId":"' + processor_id + '", \ "TaskBody":"<?xml version=\\"1.0\\" encoding=\\"utf-16\\"?><taskBody><inputAsset>JobInputAsset(0)</inputAsset><outputAsset assetCreationOptions=\\"0\\" assetName=\\"' + output_assetname + '\\">JobOutputAsset(0)</outputAsset></taskBody>" \ }] \ }' return do_ams_post(endpoint, path, body, access_token)
[ "def", "encode_mezzanine_asset", "(", "access_token", ",", "processor_id", ",", "asset_id", ",", "output_assetname", ",", "json_profile", ")", ":", "path", "=", "'/Jobs'", "endpoint", "=", "''", ".", "join", "(", "[", "ams_rest_endpoint", ",", "path", "]", ")"...
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 Service JSON Profile. Returns: HTTP response. JSON body.
[ "Get", "Media", "Service", "Encode", "Mezanine", "Asset", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L777-L808
6,556
gbowerman/azurerm
azurerm/amsrp.py
helper_add
def helper_add(access_token, ck_id, path, body): '''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. ''' 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;NetFx")
python
def helper_add(access_token, ck_id, path, body): '''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. ''' 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;NetFx")
[ "def", "helper_add", "(", "access_token", ",", "ck_id", ",", "path", ",", "body", ")", ":", "full_path", "=", "''", ".", "join", "(", "[", "path", ",", "\"('\"", ",", "ck_id", ",", "\"')\"", "]", ")", "full_path_encoded", "=", "urllib", ".", "parse", ...
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.
[ "Helper", "Function", "to", "add", "strings", "to", "a", "URL", "path", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L844-L859
6,557
gbowerman/azurerm
azurerm/amsrp.py
helper_list
def helper_list(access_token, oid, path): '''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. ''' if oid != "": path = ''.join([path, "('", oid, "')"]) endpoint = ''.join([ams_rest_endpoint, path]) return do_ams_get(endpoint, path, access_token)
python
def helper_list(access_token, oid, path): '''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. ''' if oid != "": path = ''.join([path, "('", oid, "')"]) endpoint = ''.join([ams_rest_endpoint, path]) return do_ams_get(endpoint, path, access_token)
[ "def", "helper_list", "(", "access_token", ",", "oid", ",", "path", ")", ":", "if", "oid", "!=", "\"\"", ":", "path", "=", "''", ".", "join", "(", "[", "path", ",", "\"('\"", ",", "oid", ",", "\"')\"", "]", ")", "endpoint", "=", "''", ".", "join"...
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.
[ "Helper", "Function", "to", "list", "a", "URL", "path", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L862-L876
6,558
gbowerman/azurerm
azurerm/amsrp.py
helper_delete
def helper_delete(access_token, oid, path): '''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. ''' 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)
python
def helper_delete(access_token, oid, path): '''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. ''' 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)
[ "def", "helper_delete", "(", "access_token", ",", "oid", ",", "path", ")", ":", "full_path", "=", "''", ".", "join", "(", "[", "path", ",", "\"('\"", ",", "oid", ",", "\"')\"", "]", ")", "full_path_encoded", "=", "urllib", ".", "parse", ".", "quote", ...
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.
[ "Helper", "Function", "to", "delete", "a", "Object", "at", "a", "URL", "path", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L879-L893
6,559
gbowerman/azurerm
azurerm/deployments.py
list_deployment_operations
def list_deployment_operations(access_token, subscription_id, rg_name, deployment_name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rg_name, '/providers/Microsoft.Resources/deployments/', deployment_name, '/operations', '?api-version=', BASE_API]) return do_get(endpoint, access_token)
python
def list_deployment_operations(access_token, subscription_id, rg_name, deployment_name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourcegroups/', rg_name, '/providers/Microsoft.Resources/deployments/', deployment_name, '/operations', '?api-version=', BASE_API]) return do_get(endpoint, access_token)
[ "def", "list_deployment_operations", "(", "access_token", ",", "subscription_id", ",", "rg_name", ",", "deployment_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", ...
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.
[ "List", "all", "operations", "involved", "in", "a", "given", "deployment", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/deployments.py#L7-L24
6,560
gbowerman/azurerm
azurerm/networkrp.py
create_lb_with_nat_pool
def create_lb_with_nat_pool(access_token, subscription_id, resource_group, lb_name, public_ip_id, fe_start_port, fe_end_port, backend_port, location): '''Create a load balancer with inbound NAT pools. 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. public_ip_id (str): Public IP address resource id. fe_start_port (int): Start of front-end port range. fe_end_port (int): End of front-end port range. backend_port (int): Back end port for VMs. location (str): Azure data center location. E.g. westus. Returns: HTTP response. Load Balancer JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalancers/', lb_name, '?api-version=', NETWORK_API]) lb_body = {'location': location} frontendipcconfig = {'name': 'LoadBalancerFrontEnd'} fipc_properties = {'publicIPAddress': {'id': public_ip_id}} frontendipcconfig['properties'] = fipc_properties properties = {'frontendIPConfigurations': [frontendipcconfig]} properties['backendAddressPools'] = [{'name': 'bepool'}] inbound_natpool = {'name': 'natpool'} lbfe_id = '/subscriptions/' + subscription_id + '/resourceGroups/' + resource_group + \ '/providers/Microsoft.Network/loadBalancers/' + lb_name + \ '/frontendIPConfigurations/LoadBalancerFrontEnd' ibnp_properties = {'frontendIPConfiguration': {'id': lbfe_id}} ibnp_properties['protocol'] = 'tcp' ibnp_properties['frontendPortRangeStart'] = fe_start_port ibnp_properties['frontendPortRangeEnd'] = fe_end_port ibnp_properties['backendPort'] = backend_port inbound_natpool['properties'] = ibnp_properties properties['inboundNatPools'] = [inbound_natpool] lb_body['properties'] = properties body = json.dumps(lb_body) return do_put(endpoint, body, access_token)
python
def create_lb_with_nat_pool(access_token, subscription_id, resource_group, lb_name, public_ip_id, fe_start_port, fe_end_port, backend_port, location): '''Create a load balancer with inbound NAT pools. 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. public_ip_id (str): Public IP address resource id. fe_start_port (int): Start of front-end port range. fe_end_port (int): End of front-end port range. backend_port (int): Back end port for VMs. location (str): Azure data center location. E.g. westus. Returns: HTTP response. Load Balancer JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalancers/', lb_name, '?api-version=', NETWORK_API]) lb_body = {'location': location} frontendipcconfig = {'name': 'LoadBalancerFrontEnd'} fipc_properties = {'publicIPAddress': {'id': public_ip_id}} frontendipcconfig['properties'] = fipc_properties properties = {'frontendIPConfigurations': [frontendipcconfig]} properties['backendAddressPools'] = [{'name': 'bepool'}] inbound_natpool = {'name': 'natpool'} lbfe_id = '/subscriptions/' + subscription_id + '/resourceGroups/' + resource_group + \ '/providers/Microsoft.Network/loadBalancers/' + lb_name + \ '/frontendIPConfigurations/LoadBalancerFrontEnd' ibnp_properties = {'frontendIPConfiguration': {'id': lbfe_id}} ibnp_properties['protocol'] = 'tcp' ibnp_properties['frontendPortRangeStart'] = fe_start_port ibnp_properties['frontendPortRangeEnd'] = fe_end_port ibnp_properties['backendPort'] = backend_port inbound_natpool['properties'] = ibnp_properties properties['inboundNatPools'] = [inbound_natpool] lb_body['properties'] = properties body = json.dumps(lb_body) return do_put(endpoint, body, access_token)
[ "def", "create_lb_with_nat_pool", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "lb_name", ",", "public_ip_id", ",", "fe_start_port", ",", "fe_end_port", ",", "backend_port", ",", "location", ")", ":", "endpoint", "=", "''", ".", "join",...
Create a load balancer with inbound NAT pools. 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. public_ip_id (str): Public IP address resource id. fe_start_port (int): Start of front-end port range. fe_end_port (int): End of front-end port range. backend_port (int): Back end port for VMs. location (str): Azure data center location. E.g. westus. Returns: HTTP response. Load Balancer JSON body.
[ "Create", "a", "load", "balancer", "with", "inbound", "NAT", "pools", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L7-L49
6,561
gbowerman/azurerm
azurerm/networkrp.py
create_nic
def create_nic(access_token, subscription_id, resource_group, nic_name, public_ip_id, subnet_id, location, nsg_id=None): '''Create a network interface with an associated 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. nic_name (str): Name of the new NIC. public_ip_id (str): Public IP address resource id. subnetid (str): Subnet resource id. location (str): Azure data center location. E.g. westus. nsg_id (str): Optional Network Secruity Group resource id. Returns: HTTP response. NIC JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkInterfaces/', nic_name, '?api-version=', NETWORK_API]) nic_body = {'location': location} ipconfig = {'name': 'ipconfig1'} ipc_properties = {'privateIPAllocationMethod': 'Dynamic'} ipc_properties['publicIPAddress'] = {'id': public_ip_id} ipc_properties['subnet'] = {'id': subnet_id} ipconfig['properties'] = ipc_properties properties = {'ipConfigurations': [ipconfig]} if nsg_id is not None: properties['networkSecurityGroup'] = {'id': nsg_id} nic_body['properties'] = properties body = json.dumps(nic_body) return do_put(endpoint, body, access_token)
python
def create_nic(access_token, subscription_id, resource_group, nic_name, public_ip_id, subnet_id, location, nsg_id=None): '''Create a network interface with an associated 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. nic_name (str): Name of the new NIC. public_ip_id (str): Public IP address resource id. subnetid (str): Subnet resource id. location (str): Azure data center location. E.g. westus. nsg_id (str): Optional Network Secruity Group resource id. Returns: HTTP response. NIC JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkInterfaces/', nic_name, '?api-version=', NETWORK_API]) nic_body = {'location': location} ipconfig = {'name': 'ipconfig1'} ipc_properties = {'privateIPAllocationMethod': 'Dynamic'} ipc_properties['publicIPAddress'] = {'id': public_ip_id} ipc_properties['subnet'] = {'id': subnet_id} ipconfig['properties'] = ipc_properties properties = {'ipConfigurations': [ipconfig]} if nsg_id is not None: properties['networkSecurityGroup'] = {'id': nsg_id} nic_body['properties'] = properties body = json.dumps(nic_body) return do_put(endpoint, body, access_token)
[ "def", "create_nic", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "nic_name", ",", "public_ip_id", ",", "subnet_id", ",", "location", ",", "nsg_id", "=", "None", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endp...
Create a network interface with an associated 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. nic_name (str): Name of the new NIC. public_ip_id (str): Public IP address resource id. subnetid (str): Subnet resource id. location (str): Azure data center location. E.g. westus. nsg_id (str): Optional Network Secruity Group resource id. Returns: HTTP response. NIC JSON body.
[ "Create", "a", "network", "interface", "with", "an", "associated", "public", "ip", "address", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L52-L85
6,562
gbowerman/azurerm
azurerm/networkrp.py
create_nsg_rule
def create_nsg_rule(access_token, subscription_id, resource_group, nsg_name, nsg_rule_name, description, protocol='Tcp', source_range='*', destination_range='*', source_prefix='*', destination_prefix='*', access='Allow', priority=100, direction='Inbound'): '''Create 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 the new rule. description (str): Description. protocol (str): Optional protocol. Default Tcp. source_range (str): Optional source IP range. Default '*'. destination_range (str): Destination IP range. Default *'. source_prefix (str): Source DNS prefix. Default '*'. destination_prefix (str): Destination prefix. Default '*'. access (str): Allow or deny rule. Default Allow. priority: Relative priority. Default 100. direction: Inbound or Outbound. Default Inbound. Returns: HTTP response. NSG JSON rule body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkSecurityGroups/', nsg_name, '/securityRules/', nsg_rule_name, '?api-version=', NETWORK_API]) properties = {'description': description} properties['protocol'] = protocol properties['sourcePortRange'] = source_range properties['destinationPortRange'] = destination_range properties['sourceAddressPrefix'] = source_prefix properties['destinationAddressPrefix'] = destination_prefix properties['access'] = access properties['priority'] = priority properties['direction'] = direction ip_body = {'properties': properties} body = json.dumps(ip_body) return do_put(endpoint, body, access_token)
python
def create_nsg_rule(access_token, subscription_id, resource_group, nsg_name, nsg_rule_name, description, protocol='Tcp', source_range='*', destination_range='*', source_prefix='*', destination_prefix='*', access='Allow', priority=100, direction='Inbound'): '''Create 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 the new rule. description (str): Description. protocol (str): Optional protocol. Default Tcp. source_range (str): Optional source IP range. Default '*'. destination_range (str): Destination IP range. Default *'. source_prefix (str): Source DNS prefix. Default '*'. destination_prefix (str): Destination prefix. Default '*'. access (str): Allow or deny rule. Default Allow. priority: Relative priority. Default 100. direction: Inbound or Outbound. Default Inbound. Returns: HTTP response. NSG JSON rule body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkSecurityGroups/', nsg_name, '/securityRules/', nsg_rule_name, '?api-version=', NETWORK_API]) properties = {'description': description} properties['protocol'] = protocol properties['sourcePortRange'] = source_range properties['destinationPortRange'] = destination_range properties['sourceAddressPrefix'] = source_prefix properties['destinationAddressPrefix'] = destination_prefix properties['access'] = access properties['priority'] = priority properties['direction'] = direction ip_body = {'properties': properties} body = json.dumps(ip_body) return do_put(endpoint, body, access_token)
[ "def", "create_nsg_rule", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "nsg_name", ",", "nsg_rule_name", ",", "description", ",", "protocol", "=", "'Tcp'", ",", "source_range", "=", "'*'", ",", "destination_range", "=", "'*'", ",", "s...
Create 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 the new rule. description (str): Description. protocol (str): Optional protocol. Default Tcp. source_range (str): Optional source IP range. Default '*'. destination_range (str): Destination IP range. Default *'. source_prefix (str): Source DNS prefix. Default '*'. destination_prefix (str): Destination prefix. Default '*'. access (str): Allow or deny rule. Default Allow. priority: Relative priority. Default 100. direction: Inbound or Outbound. Default Inbound. Returns: HTTP response. NSG JSON rule body.
[ "Create", "network", "security", "group", "rule", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L111-L153
6,563
gbowerman/azurerm
azurerm/networkrp.py
create_public_ip
def create_public_ip(access_token, subscription_id, resource_group, public_ip_name, dns_label, location): '''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 label to apply to the IP address. location (str): Azure data center location. E.g. westus. Returns: HTTP response. Public IP address JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/publicIPAddresses/', public_ip_name, '?api-version=', NETWORK_API]) ip_body = {'location': location} properties = {'publicIPAllocationMethod': 'Dynamic'} properties['dnsSettings'] = {'domainNameLabel': dns_label} ip_body['properties'] = properties body = json.dumps(ip_body) return do_put(endpoint, body, access_token)
python
def create_public_ip(access_token, subscription_id, resource_group, public_ip_name, dns_label, location): '''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 label to apply to the IP address. location (str): Azure data center location. E.g. westus. Returns: HTTP response. Public IP address JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/publicIPAddresses/', public_ip_name, '?api-version=', NETWORK_API]) ip_body = {'location': location} properties = {'publicIPAllocationMethod': 'Dynamic'} properties['dnsSettings'] = {'domainNameLabel': dns_label} ip_body['properties'] = properties body = json.dumps(ip_body) return do_put(endpoint, body, access_token)
[ "def", "create_public_ip", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "public_ip_name", ",", "dns_label", ",", "location", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'"...
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 label to apply to the IP address. location (str): Azure data center location. E.g. westus. Returns: HTTP response. Public IP address JSON body.
[ "Create", "a", "public", "ip", "address", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L156-L181
6,564
gbowerman/azurerm
azurerm/networkrp.py
create_vnet
def create_vnet(access_token, subscription_id, resource_group, name, location, address_prefix='10.0.0.0/16', subnet_prefix='10.0.0.0/16', nsg_id=None): '''Create a VNet with specified name and location. Optional subnet address prefix.. 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 new VNet. location (str): Azure data center location. E.g. westus. address_prefix (str): Optional VNet address prefix. Default '10.0.0.0/16'. subnet_prefix (str): Optional subnet address prefix. Default '10.0.0.0/16'. nsg_id (str): Optional Netwrok Security Group resource Id. Default None. Returns: HTTP response. VNet JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/virtualNetworks/', name, '?api-version=', NETWORK_API]) vnet_body = {'location': location} properties = {'addressSpace': {'addressPrefixes': [address_prefix]}} subnet = {'name': 'subnet'} subnet['properties'] = {'addressPrefix': subnet_prefix} if nsg_id is not None: subnet['properties']['networkSecurityGroup'] = {'id': nsg_id} properties['subnets'] = [subnet] vnet_body['properties'] = properties body = json.dumps(vnet_body) return do_put(endpoint, body, access_token)
python
def create_vnet(access_token, subscription_id, resource_group, name, location, address_prefix='10.0.0.0/16', subnet_prefix='10.0.0.0/16', nsg_id=None): '''Create a VNet with specified name and location. Optional subnet address prefix.. 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 new VNet. location (str): Azure data center location. E.g. westus. address_prefix (str): Optional VNet address prefix. Default '10.0.0.0/16'. subnet_prefix (str): Optional subnet address prefix. Default '10.0.0.0/16'. nsg_id (str): Optional Netwrok Security Group resource Id. Default None. Returns: HTTP response. VNet JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/virtualNetworks/', name, '?api-version=', NETWORK_API]) vnet_body = {'location': location} properties = {'addressSpace': {'addressPrefixes': [address_prefix]}} subnet = {'name': 'subnet'} subnet['properties'] = {'addressPrefix': subnet_prefix} if nsg_id is not None: subnet['properties']['networkSecurityGroup'] = {'id': nsg_id} properties['subnets'] = [subnet] vnet_body['properties'] = properties body = json.dumps(vnet_body) return do_put(endpoint, body, access_token)
[ "def", "create_vnet", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "name", ",", "location", ",", "address_prefix", "=", "'10.0.0.0/16'", ",", "subnet_prefix", "=", "'10.0.0.0/16'", ",", "nsg_id", "=", "None", ")", ":", "endpoint", "="...
Create a VNet with specified name and location. Optional subnet address prefix.. 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 new VNet. location (str): Azure data center location. E.g. westus. address_prefix (str): Optional VNet address prefix. Default '10.0.0.0/16'. subnet_prefix (str): Optional subnet address prefix. Default '10.0.0.0/16'. nsg_id (str): Optional Netwrok Security Group resource Id. Default None. Returns: HTTP response. VNet JSON body.
[ "Create", "a", "VNet", "with", "specified", "name", "and", "location", ".", "Optional", "subnet", "address", "prefix", ".." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L184-L216
6,565
gbowerman/azurerm
azurerm/networkrp.py
delete_load_balancer
def delete_load_balancer(access_token, subscription_id, resource_group, lb_name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalancers/', lb_name, '?api-version=', NETWORK_API]) return do_delete(endpoint, access_token)
python
def delete_load_balancer(access_token, subscription_id, resource_group, lb_name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalancers/', lb_name, '?api-version=', NETWORK_API]) return do_delete(endpoint, access_token)
[ "def", "delete_load_balancer", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "lb_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/reso...
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.
[ "Delete", "a", "load", "balancer", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L219-L236
6,566
gbowerman/azurerm
azurerm/networkrp.py
delete_nsg
def delete_nsg(access_token, subscription_id, resource_group, nsg_name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkSecurityGroups/', nsg_name, '?api-version=', NETWORK_API]) return do_delete(endpoint, access_token)
python
def delete_nsg(access_token, subscription_id, resource_group, nsg_name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkSecurityGroups/', nsg_name, '?api-version=', NETWORK_API]) return do_delete(endpoint, access_token)
[ "def", "delete_nsg", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "nsg_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGroup...
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.
[ "Delete", "network", "security", "group", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L259-L276
6,567
gbowerman/azurerm
azurerm/networkrp.py
delete_nsg_rule
def delete_nsg_rule(access_token, subscription_id, resource_group, nsg_name, nsg_rule_name): '''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 the NSG rule. Returns: HTTP response. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkSecurityGroups/', nsg_name, '/securityRules/', nsg_rule_name, '?api-version=', NETWORK_API]) return do_delete(endpoint, access_token)
python
def delete_nsg_rule(access_token, subscription_id, resource_group, nsg_name, nsg_rule_name): '''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 the NSG rule. Returns: HTTP response. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkSecurityGroups/', nsg_name, '/securityRules/', nsg_rule_name, '?api-version=', NETWORK_API]) return do_delete(endpoint, access_token)
[ "def", "delete_nsg_rule", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "nsg_name", ",", "nsg_rule_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription...
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 the NSG rule. Returns: HTTP response.
[ "Delete", "network", "security", "group", "rule", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L279-L298
6,568
gbowerman/azurerm
azurerm/networkrp.py
delete_public_ip
def delete_public_ip(access_token, subscription_id, resource_group, public_ip_name): '''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. Returns: HTTP response. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/publicIPAddresses/', public_ip_name, '?api-version=', NETWORK_API]) return do_delete(endpoint, access_token)
python
def delete_public_ip(access_token, subscription_id, resource_group, public_ip_name): '''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. Returns: HTTP response. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/publicIPAddresses/', public_ip_name, '?api-version=', NETWORK_API]) return do_delete(endpoint, access_token)
[ "def", "delete_public_ip", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "public_ip_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/r...
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. Returns: HTTP response.
[ "Delete", "a", "public", "ip", "addresses", "associated", "with", "a", "resource", "group", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L301-L318
6,569
gbowerman/azurerm
azurerm/networkrp.py
delete_vnet
def delete_vnet(access_token, subscription_id, resource_group, name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/virtualNetworks/', name, '?api-version=', NETWORK_API]) return do_delete(endpoint, access_token)
python
def delete_vnet(access_token, subscription_id, resource_group, name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/virtualNetworks/', name, '?api-version=', NETWORK_API]) return do_delete(endpoint, access_token)
[ "def", "delete_vnet", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGroups/'...
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.
[ "Delete", "a", "virtual", "network", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L321-L338
6,570
gbowerman/azurerm
azurerm/networkrp.py
get_lb_nat_rule
def get_lb_nat_rule(access_token, subscription_id, resource_group, lb_name, rule_name): '''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 the NAT rule. Returns: HTTP response. JSON body of rule. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalancers/', lb_name, '/inboundNatRules/', rule_name, '?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
python
def get_lb_nat_rule(access_token, subscription_id, resource_group, lb_name, rule_name): '''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 the NAT rule. Returns: HTTP response. JSON body of rule. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalancers/', lb_name, '/inboundNatRules/', rule_name, '?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
[ "def", "get_lb_nat_rule", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "lb_name", ",", "rule_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id",...
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 the NAT rule. Returns: HTTP response. JSON body of rule.
[ "Get", "details", "about", "a", "load", "balancer", "inbound", "NAT", "rule", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L341-L360
6,571
gbowerman/azurerm
azurerm/networkrp.py
get_network_usage
def get_network_usage(access_token, subscription_id, location): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/locations/', location, '/usages?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
python
def get_network_usage(access_token, subscription_id, location): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/locations/', location, '/usages?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
[ "def", "get_network_usage", "(", "access_token", ",", "subscription_id", ",", "location", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/Microsoft.Network/locat...
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.
[ "List", "network", "usage", "and", "limits", "for", "a", "location", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L383-L398
6,572
gbowerman/azurerm
azurerm/networkrp.py
get_nic
def get_nic(access_token, subscription_id, resource_group, nic_name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkInterfaces/', nic_name, '?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
python
def get_nic(access_token, subscription_id, resource_group, nic_name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/networkInterfaces/', nic_name, '?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
[ "def", "get_nic", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "nic_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGroups/'...
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.
[ "Get", "details", "about", "a", "network", "interface", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L401-L418
6,573
gbowerman/azurerm
azurerm/networkrp.py
get_public_ip
def get_public_ip(access_token, subscription_id, resource_group, ip_name): '''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: HTTP response. Public IP address JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/', 'publicIPAddresses/', ip_name, '?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
python
def get_public_ip(access_token, subscription_id, resource_group, ip_name): '''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: HTTP response. Public IP address JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/', 'publicIPAddresses/', ip_name, '?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
[ "def", "get_public_ip", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "ip_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGro...
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: HTTP response. Public IP address JSON body.
[ "Get", "details", "about", "the", "named", "public", "ip", "address", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L421-L439
6,574
gbowerman/azurerm
azurerm/networkrp.py
get_vnet
def get_vnet(access_token, subscription_id, resource_group, vnet_name): '''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 body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/virtualNetworks/', vnet_name, '?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
python
def get_vnet(access_token, subscription_id, resource_group, vnet_name): '''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 body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/virtualNetworks/', vnet_name, '?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
[ "def", "get_vnet", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "vnet_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGroups...
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 body.
[ "Get", "details", "about", "the", "named", "virtual", "network", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L442-L459
6,575
gbowerman/azurerm
azurerm/networkrp.py
list_lb_nat_rules
def list_lb_nat_rules(access_token, subscription_id, resource_group, lb_name): '''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. JSON body of load balancer NAT rules. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalancers/', lb_name, 'inboundNatRules?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
python
def list_lb_nat_rules(access_token, subscription_id, resource_group, lb_name): '''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. JSON body of load balancer NAT rules. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalancers/', lb_name, 'inboundNatRules?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
[ "def", "list_lb_nat_rules", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "lb_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourc...
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. JSON body of load balancer NAT rules.
[ "List", "the", "inbound", "NAT", "rules", "for", "a", "load", "balancer", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L498-L515
6,576
gbowerman/azurerm
azurerm/networkrp.py
list_load_balancers
def list_load_balancers(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/', '/loadBalancers?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
python
def list_load_balancers(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/', '/loadBalancers?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
[ "def", "list_load_balancers", "(", "access_token", ",", "subscription_id", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/Microsoft.Network/'", ",", "'/loadBala...
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.
[ "List", "the", "load", "balancers", "in", "a", "subscription", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L518-L532
6,577
gbowerman/azurerm
azurerm/networkrp.py
list_nics
def list_nics(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/', '/networkInterfaces?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
python
def list_nics(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/', '/networkInterfaces?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
[ "def", "list_nics", "(", "access_token", ",", "subscription_id", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/Microsoft.Network/'", ",", "'/networkInterfaces?...
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.
[ "List", "the", "network", "interfaces", "in", "a", "subscription", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L554-L568
6,578
gbowerman/azurerm
azurerm/networkrp.py
list_vnets
def list_vnets(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/', '/virtualNetworks?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
python
def list_vnets(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Network/', '/virtualNetworks?api-version=', NETWORK_API]) return do_get(endpoint, access_token)
[ "def", "list_vnets", "(", "access_token", ",", "subscription_id", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/Microsoft.Network/'", ",", "'/virtualNetworks?a...
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.
[ "List", "the", "VNETs", "in", "a", "subscription", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L643-L657
6,579
gbowerman/azurerm
azurerm/networkrp.py
update_load_balancer
def update_load_balancer(access_token, subscription_id, resource_group, lb_name, body): '''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): JSON body of an updated load balancer. Returns: HTTP response. Load Balancer JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalancers/', lb_name, '?api-version=', NETWORK_API]) return do_put(endpoint, body, access_token)
python
def update_load_balancer(access_token, subscription_id, resource_group, lb_name, body): '''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): JSON body of an updated load balancer. Returns: HTTP response. Load Balancer JSON body. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Network/loadBalancers/', lb_name, '?api-version=', NETWORK_API]) return do_put(endpoint, body, access_token)
[ "def", "update_load_balancer", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "lb_name", ",", "body", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id",...
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): JSON body of an updated load balancer. Returns: HTTP response. Load Balancer JSON body.
[ "Updates", "a", "load", "balancer", "model", "i", ".", "e", ".", "PUT", "an", "updated", "LB", "body", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L679-L697
6,580
gbowerman/azurerm
examples/list_quota.py
print_region_quota
def print_region_quota(access_token, sub_id, region): '''Print the Compute usage quota for a specific region''' print(region + ':') quota = azurerm.get_compute_usage(access_token, sub_id, region) if SUMMARY is False: print(json.dumps(quota, sort_keys=False, indent=2, separators=(',', ': '))) try: for resource in quota['value']: if resource['name']['value'] == 'cores': print(' Current: ' + str(resource['currentValue']) + ', limit: ' + str(resource['limit'])) break except KeyError: print('Invalid data for region: ' + region)
python
def print_region_quota(access_token, sub_id, region): '''Print the Compute usage quota for a specific region''' print(region + ':') quota = azurerm.get_compute_usage(access_token, sub_id, region) if SUMMARY is False: print(json.dumps(quota, sort_keys=False, indent=2, separators=(',', ': '))) try: for resource in quota['value']: if resource['name']['value'] == 'cores': print(' Current: ' + str(resource['currentValue']) + ', limit: ' + str(resource['limit'])) break except KeyError: print('Invalid data for region: ' + region)
[ "def", "print_region_quota", "(", "access_token", ",", "sub_id", ",", "region", ")", ":", "print", "(", "region", "+", "':'", ")", "quota", "=", "azurerm", ".", "get_compute_usage", "(", "access_token", ",", "sub_id", ",", "region", ")", "if", "SUMMARY", "...
Print the Compute usage quota for a specific region
[ "Print", "the", "Compute", "usage", "quota", "for", "a", "specific", "region" ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/list_quota.py#L9-L22
6,581
gbowerman/azurerm
azurerm/computerp.py
create_as
def create_as(access_token, subscription_id, resource_group, as_name, update_domains, fault_domains, location): '''Create 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 new availability set. update_domains (int): Number of update domains. fault_domains (int): Number of fault domains. location (str): Azure data center location. E.g. westus. Returns: HTTP response. JSON body of the availability set properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/availabilitySets/', as_name, '?api-version=', COMP_API]) as_body = {'location': location} properties = {'platformUpdateDomainCount': update_domains} properties['platformFaultDomainCount'] = fault_domains as_body['properties'] = properties body = json.dumps(as_body) return do_put(endpoint, body, access_token)
python
def create_as(access_token, subscription_id, resource_group, as_name, update_domains, fault_domains, location): '''Create 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 new availability set. update_domains (int): Number of update domains. fault_domains (int): Number of fault domains. location (str): Azure data center location. E.g. westus. Returns: HTTP response. JSON body of the availability set properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/availabilitySets/', as_name, '?api-version=', COMP_API]) as_body = {'location': location} properties = {'platformUpdateDomainCount': update_domains} properties['platformFaultDomainCount'] = fault_domains as_body['properties'] = properties body = json.dumps(as_body) return do_put(endpoint, body, access_token)
[ "def", "create_as", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "as_name", ",", "update_domains", ",", "fault_domains", ",", "location", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'...
Create 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 new availability set. update_domains (int): Number of update domains. fault_domains (int): Number of fault domains. location (str): Azure data center location. E.g. westus. Returns: HTTP response. JSON body of the availability set properties.
[ "Create", "availability", "set", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L9-L35
6,582
gbowerman/azurerm
azurerm/computerp.py
create_vm
def create_vm(access_token, subscription_id, resource_group, vm_name, vm_size, publisher, offer, sku, version, nic_id, location, storage_type='Standard_LRS', osdisk_name=None, username='azure', password=None, public_key=None): '''Create a new Azure 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 new virtual machine. vm_size (str): Size of virtual machine, e.g. 'Standard_D1_v2'. publisher (str): VM image publisher. E.g. 'MicrosoftWindowsServer'. offer (str): VM image offer. E.g. 'WindowsServer'. sku (str): VM image sku. E.g. '2016-Datacenter'. version (str): VM image version. E.g. 'latest'. nic_id (str): Resource id of a NIC. location (str): Azure data center location. E.g. westus. storage_type (str): Optional storage type. Default 'Standard_LRS'. osdisk_name (str): Optional OS disk name. Default is None. username (str): Optional user name. Default is 'azure'. password (str): Optional password. Default is None (not required if using public_key). public_key (str): Optional public key. Default is None (not required if using password, e.g. on Windows). Returns: HTTP response. JSON body of the virtual machine properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachines/', vm_name, '?api-version=', COMP_API]) if osdisk_name is None: osdisk_name = vm_name + 'osdisk' vm_body = {'name': vm_name} vm_body['location'] = location properties = {'hardwareProfile': {'vmSize': vm_size}} image_reference = {'publisher': publisher, 'offer': offer, 'sku': sku, 'version': version} storage_profile = {'imageReference': image_reference} os_disk = {'name': osdisk_name} os_disk['managedDisk'] = {'storageAccountType': storage_type} os_disk['caching'] = 'ReadWrite' os_disk['createOption'] = 'fromImage' storage_profile['osDisk'] = os_disk properties['storageProfile'] = storage_profile os_profile = {'computerName': vm_name} os_profile['adminUsername'] = username if password is not None: os_profile['adminPassword'] = password if public_key is not None: if password is None: disable_pswd = True else: disable_pswd = False linux_config = {'disablePasswordAuthentication': disable_pswd} pub_key = {'path': '/home/' + username + '/.ssh/authorized_keys'} pub_key['keyData'] = public_key linux_config['ssh'] = {'publicKeys': [pub_key]} os_profile['linuxConfiguration'] = linux_config properties['osProfile'] = os_profile network_profile = {'networkInterfaces': [ {'id': nic_id, 'properties': {'primary': True}}]} properties['networkProfile'] = network_profile vm_body['properties'] = properties body = json.dumps(vm_body) return do_put(endpoint, body, access_token)
python
def create_vm(access_token, subscription_id, resource_group, vm_name, vm_size, publisher, offer, sku, version, nic_id, location, storage_type='Standard_LRS', osdisk_name=None, username='azure', password=None, public_key=None): '''Create a new Azure 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 new virtual machine. vm_size (str): Size of virtual machine, e.g. 'Standard_D1_v2'. publisher (str): VM image publisher. E.g. 'MicrosoftWindowsServer'. offer (str): VM image offer. E.g. 'WindowsServer'. sku (str): VM image sku. E.g. '2016-Datacenter'. version (str): VM image version. E.g. 'latest'. nic_id (str): Resource id of a NIC. location (str): Azure data center location. E.g. westus. storage_type (str): Optional storage type. Default 'Standard_LRS'. osdisk_name (str): Optional OS disk name. Default is None. username (str): Optional user name. Default is 'azure'. password (str): Optional password. Default is None (not required if using public_key). public_key (str): Optional public key. Default is None (not required if using password, e.g. on Windows). Returns: HTTP response. JSON body of the virtual machine properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachines/', vm_name, '?api-version=', COMP_API]) if osdisk_name is None: osdisk_name = vm_name + 'osdisk' vm_body = {'name': vm_name} vm_body['location'] = location properties = {'hardwareProfile': {'vmSize': vm_size}} image_reference = {'publisher': publisher, 'offer': offer, 'sku': sku, 'version': version} storage_profile = {'imageReference': image_reference} os_disk = {'name': osdisk_name} os_disk['managedDisk'] = {'storageAccountType': storage_type} os_disk['caching'] = 'ReadWrite' os_disk['createOption'] = 'fromImage' storage_profile['osDisk'] = os_disk properties['storageProfile'] = storage_profile os_profile = {'computerName': vm_name} os_profile['adminUsername'] = username if password is not None: os_profile['adminPassword'] = password if public_key is not None: if password is None: disable_pswd = True else: disable_pswd = False linux_config = {'disablePasswordAuthentication': disable_pswd} pub_key = {'path': '/home/' + username + '/.ssh/authorized_keys'} pub_key['keyData'] = public_key linux_config['ssh'] = {'publicKeys': [pub_key]} os_profile['linuxConfiguration'] = linux_config properties['osProfile'] = os_profile network_profile = {'networkInterfaces': [ {'id': nic_id, 'properties': {'primary': True}}]} properties['networkProfile'] = network_profile vm_body['properties'] = properties body = json.dumps(vm_body) return do_put(endpoint, body, access_token)
[ "def", "create_vm", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "vm_name", ",", "vm_size", ",", "publisher", ",", "offer", ",", "sku", ",", "version", ",", "nic_id", ",", "location", ",", "storage_type", "=", "'Standard_LRS'", ",",...
Create a new Azure 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 new virtual machine. vm_size (str): Size of virtual machine, e.g. 'Standard_D1_v2'. publisher (str): VM image publisher. E.g. 'MicrosoftWindowsServer'. offer (str): VM image offer. E.g. 'WindowsServer'. sku (str): VM image sku. E.g. '2016-Datacenter'. version (str): VM image version. E.g. 'latest'. nic_id (str): Resource id of a NIC. location (str): Azure data center location. E.g. westus. storage_type (str): Optional storage type. Default 'Standard_LRS'. osdisk_name (str): Optional OS disk name. Default is None. username (str): Optional user name. Default is 'azure'. password (str): Optional password. Default is None (not required if using public_key). public_key (str): Optional public key. Default is None (not required if using password, e.g. on Windows). Returns: HTTP response. JSON body of the virtual machine properties.
[ "Create", "a", "new", "Azure", "virtual", "machine", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L38-L104
6,583
gbowerman/azurerm
azurerm/computerp.py
create_vmss
def create_vmss(access_token, subscription_id, resource_group, vmss_name, vm_size, capacity, publisher, offer, sku, version, subnet_id, location, be_pool_id=None, lb_pool_id=None, storage_type='Standard_LRS', username='azure', password=None, public_key=None, overprovision=True, upgrade_policy='Manual', public_ip_per_vm=False): '''Create 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 new scale set. vm_size (str): Size of virtual machine, e.g. 'Standard_D1_v2'. capacity (int): Number of VMs in the scale set. 0-1000. publisher (str): VM image publisher. E.g. 'MicrosoftWindowsServer'. offer (str): VM image offer. E.g. 'WindowsServer'. sku (str): VM image sku. E.g. '2016-Datacenter'. version (str): VM image version. E.g. 'latest'. subnet_id (str): Resource id of a subnet. location (str): Azure data center location. E.g. westus. be_pool_id (str): Resource id of a backend NAT pool. lb_pool_id (str): Resource id of a load balancer pool. storage_type (str): Optional storage type. Default 'Standard_LRS'. username (str): Optional user name. Default is 'azure'. password (str): Optional password. Default is None (not required if using public_key). public_key (str): Optional public key. Default is None (not required if using password, e.g. on Windows). overprovision (bool): Optional. Enable overprovisioning of VMs. Default True. upgrade_policy (str): Optional. Set upgrade policy to Automatic, Manual or Rolling. Default 'Manual'. public_ip_per_vm (bool): Optional. Set public IP per VM. Default False. Returns: HTTP response. JSON body of the virtual machine scale set properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets/', vmss_name, '?api-version=', COMP_API]) vmss_body = {'location': location} vmss_sku = {'name': vm_size, 'tier': 'Standard', 'capacity': capacity} vmss_body['sku'] = vmss_sku properties = {'overprovision': overprovision} properties['upgradePolicy'] = {'mode': upgrade_policy} os_profile = {'computerNamePrefix': vmss_name} os_profile['adminUsername'] = username if password is not None: os_profile['adminPassword'] = password if public_key is not None: if password is None: disable_pswd = True else: disable_pswd = False linux_config = {'disablePasswordAuthentication': disable_pswd} pub_key = {'path': '/home/' + username + '/.ssh/authorized_keys'} pub_key['keyData'] = public_key linux_config['ssh'] = {'publicKeys': [pub_key]} os_profile['linuxConfiguration'] = linux_config vm_profile = {'osProfile': os_profile} os_disk = {'createOption': 'fromImage'} os_disk['managedDisk'] = {'storageAccountType': storage_type} os_disk['caching'] = 'ReadWrite' storage_profile = {'osDisk': os_disk} storage_profile['imageReference'] = \ {'publisher': publisher, 'offer': offer, 'sku': sku, 'version': version} vm_profile['storageProfile'] = storage_profile nic = {'name': vmss_name} ip_config = {'name': vmss_name} ip_properties = {'subnet': {'id': subnet_id}} if be_pool_id is not None: ip_properties['loadBalancerBackendAddressPools'] = [{'id': be_pool_id}] if lb_pool_id is not None: ip_properties['loadBalancerInboundNatPools'] = [{'id': lb_pool_id}] if public_ip_per_vm is True: ip_properties['publicIpAddressConfiguration'] = { 'name': 'pubip', 'properties': {'idleTimeoutInMinutes': 15}} ip_config['properties'] = ip_properties nic['properties'] = {'primary': True, 'ipConfigurations': [ip_config]} network_profile = {'networkInterfaceConfigurations': [nic]} vm_profile['networkProfile'] = network_profile properties['virtualMachineProfile'] = vm_profile vmss_body['properties'] = properties body = json.dumps(vmss_body) return do_put(endpoint, body, access_token)
python
def create_vmss(access_token, subscription_id, resource_group, vmss_name, vm_size, capacity, publisher, offer, sku, version, subnet_id, location, be_pool_id=None, lb_pool_id=None, storage_type='Standard_LRS', username='azure', password=None, public_key=None, overprovision=True, upgrade_policy='Manual', public_ip_per_vm=False): '''Create 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 new scale set. vm_size (str): Size of virtual machine, e.g. 'Standard_D1_v2'. capacity (int): Number of VMs in the scale set. 0-1000. publisher (str): VM image publisher. E.g. 'MicrosoftWindowsServer'. offer (str): VM image offer. E.g. 'WindowsServer'. sku (str): VM image sku. E.g. '2016-Datacenter'. version (str): VM image version. E.g. 'latest'. subnet_id (str): Resource id of a subnet. location (str): Azure data center location. E.g. westus. be_pool_id (str): Resource id of a backend NAT pool. lb_pool_id (str): Resource id of a load balancer pool. storage_type (str): Optional storage type. Default 'Standard_LRS'. username (str): Optional user name. Default is 'azure'. password (str): Optional password. Default is None (not required if using public_key). public_key (str): Optional public key. Default is None (not required if using password, e.g. on Windows). overprovision (bool): Optional. Enable overprovisioning of VMs. Default True. upgrade_policy (str): Optional. Set upgrade policy to Automatic, Manual or Rolling. Default 'Manual'. public_ip_per_vm (bool): Optional. Set public IP per VM. Default False. Returns: HTTP response. JSON body of the virtual machine scale set properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets/', vmss_name, '?api-version=', COMP_API]) vmss_body = {'location': location} vmss_sku = {'name': vm_size, 'tier': 'Standard', 'capacity': capacity} vmss_body['sku'] = vmss_sku properties = {'overprovision': overprovision} properties['upgradePolicy'] = {'mode': upgrade_policy} os_profile = {'computerNamePrefix': vmss_name} os_profile['adminUsername'] = username if password is not None: os_profile['adminPassword'] = password if public_key is not None: if password is None: disable_pswd = True else: disable_pswd = False linux_config = {'disablePasswordAuthentication': disable_pswd} pub_key = {'path': '/home/' + username + '/.ssh/authorized_keys'} pub_key['keyData'] = public_key linux_config['ssh'] = {'publicKeys': [pub_key]} os_profile['linuxConfiguration'] = linux_config vm_profile = {'osProfile': os_profile} os_disk = {'createOption': 'fromImage'} os_disk['managedDisk'] = {'storageAccountType': storage_type} os_disk['caching'] = 'ReadWrite' storage_profile = {'osDisk': os_disk} storage_profile['imageReference'] = \ {'publisher': publisher, 'offer': offer, 'sku': sku, 'version': version} vm_profile['storageProfile'] = storage_profile nic = {'name': vmss_name} ip_config = {'name': vmss_name} ip_properties = {'subnet': {'id': subnet_id}} if be_pool_id is not None: ip_properties['loadBalancerBackendAddressPools'] = [{'id': be_pool_id}] if lb_pool_id is not None: ip_properties['loadBalancerInboundNatPools'] = [{'id': lb_pool_id}] if public_ip_per_vm is True: ip_properties['publicIpAddressConfiguration'] = { 'name': 'pubip', 'properties': {'idleTimeoutInMinutes': 15}} ip_config['properties'] = ip_properties nic['properties'] = {'primary': True, 'ipConfigurations': [ip_config]} network_profile = {'networkInterfaceConfigurations': [nic]} vm_profile['networkProfile'] = network_profile properties['virtualMachineProfile'] = vm_profile vmss_body['properties'] = properties body = json.dumps(vmss_body) return do_put(endpoint, body, access_token)
[ "def", "create_vmss", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "vmss_name", ",", "vm_size", ",", "capacity", ",", "publisher", ",", "offer", ",", "sku", ",", "version", ",", "subnet_id", ",", "location", ",", "be_pool_id", "=", ...
Create 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 new scale set. vm_size (str): Size of virtual machine, e.g. 'Standard_D1_v2'. capacity (int): Number of VMs in the scale set. 0-1000. publisher (str): VM image publisher. E.g. 'MicrosoftWindowsServer'. offer (str): VM image offer. E.g. 'WindowsServer'. sku (str): VM image sku. E.g. '2016-Datacenter'. version (str): VM image version. E.g. 'latest'. subnet_id (str): Resource id of a subnet. location (str): Azure data center location. E.g. westus. be_pool_id (str): Resource id of a backend NAT pool. lb_pool_id (str): Resource id of a load balancer pool. storage_type (str): Optional storage type. Default 'Standard_LRS'. username (str): Optional user name. Default is 'azure'. password (str): Optional password. Default is None (not required if using public_key). public_key (str): Optional public key. Default is None (not required if using password, e.g. on Windows). overprovision (bool): Optional. Enable overprovisioning of VMs. Default True. upgrade_policy (str): Optional. Set upgrade policy to Automatic, Manual or Rolling. Default 'Manual'. public_ip_per_vm (bool): Optional. Set public IP per VM. Default False. Returns: HTTP response. JSON body of the virtual machine scale set properties.
[ "Create", "virtual", "machine", "scale", "set", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L107-L193
6,584
gbowerman/azurerm
azurerm/computerp.py
delete_as
def delete_as(access_token, subscription_id, resource_group, as_name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/availabilitySets/', as_name, '?api-version=', COMP_API]) return do_delete(endpoint, access_token)
python
def delete_as(access_token, subscription_id, resource_group, as_name): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/availabilitySets/', as_name, '?api-version=', COMP_API]) return do_delete(endpoint, access_token)
[ "def", "delete_as", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "as_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGroups/...
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.
[ "Delete", "availability", "set", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L217-L234
6,585
gbowerman/azurerm
azurerm/computerp.py
delete_vmss
def delete_vmss(access_token, subscription_id, resource_group, vmss_name): '''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 response. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets/', vmss_name, '?api-version=', COMP_API]) return do_delete(endpoint, access_token)
python
def delete_vmss(access_token, subscription_id, resource_group, vmss_name): '''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 response. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets/', vmss_name, '?api-version=', COMP_API]) return do_delete(endpoint, access_token)
[ "def", "delete_vmss", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "vmss_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGro...
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 response.
[ "Delete", "a", "virtual", "machine", "scale", "set", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L257-L274
6,586
gbowerman/azurerm
azurerm/computerp.py
delete_vmss_vms
def delete_vmss_vms(access_token, subscription_id, resource_group, vmss_name, vm_ids): '''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 representation of a JSON list of VM IDs. E.g. '[1,2]'. Returns: HTTP response. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets/', vmss_name, '/delete?api-version=', COMP_API]) body = '{"instanceIds" : ' + vm_ids + '}' return do_post(endpoint, body, access_token)
python
def delete_vmss_vms(access_token, subscription_id, resource_group, vmss_name, vm_ids): '''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 representation of a JSON list of VM IDs. E.g. '[1,2]'. Returns: HTTP response. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets/', vmss_name, '/delete?api-version=', COMP_API]) body = '{"instanceIds" : ' + vm_ids + '}' return do_post(endpoint, body, access_token)
[ "def", "delete_vmss_vms", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "vmss_name", ",", "vm_ids", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ...
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 representation of a JSON list of VM IDs. E.g. '[1,2]'. Returns: HTTP response.
[ "Delete", "a", "VM", "in", "a", "VM", "Scale", "Set", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L277-L296
6,587
gbowerman/azurerm
azurerm/computerp.py
get_compute_usage
def get_compute_usage(access_token, subscription_id, location): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.compute/locations/', location, '/usages?api-version=', COMP_API]) return do_get(endpoint, access_token)
python
def get_compute_usage(access_token, subscription_id, location): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.compute/locations/', location, '/usages?api-version=', COMP_API]) return do_get(endpoint, access_token)
[ "def", "get_compute_usage", "(", "access_token", ",", "subscription_id", ",", "location", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/Microsoft.compute/locat...
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.
[ "List", "compute", "usage", "and", "limits", "for", "a", "location", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L299-L314
6,588
gbowerman/azurerm
azurerm/computerp.py
get_vm
def get_vm(access_token, subscription_id, resource_group, vm_name): '''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 properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachines/', vm_name, '?api-version=', COMP_API]) return do_get(endpoint, access_token)
python
def get_vm(access_token, subscription_id, resource_group, vm_name): '''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 properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachines/', vm_name, '?api-version=', COMP_API]) return do_get(endpoint, access_token)
[ "def", "get_vm", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "vm_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGroups/'",...
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 properties.
[ "Get", "virtual", "machine", "details", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L317-L334
6,589
gbowerman/azurerm
azurerm/computerp.py
get_vm_extension
def get_vm_extension(access_token, subscription_id, resource_group, vm_name, extension_name): '''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. Returns: HTTP response. JSON body of VM extension properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachines/', vm_name, '/extensions/', extension_name, '?api-version=', COMP_API]) return do_get(endpoint, access_token)
python
def get_vm_extension(access_token, subscription_id, resource_group, vm_name, extension_name): '''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. Returns: HTTP response. JSON body of VM extension properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachines/', vm_name, '/extensions/', extension_name, '?api-version=', COMP_API]) return do_get(endpoint, access_token)
[ "def", "get_vm_extension", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "vm_name", ",", "extension_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscriptio...
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. Returns: HTTP response. JSON body of VM extension properties.
[ "Get", "details", "about", "a", "VM", "extension", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L337-L356
6,590
gbowerman/azurerm
azurerm/computerp.py
get_vmss
def get_vmss(access_token, subscription_id, resource_group, vmss_name): '''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 response. JSON body of scale set properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets/', vmss_name, '?api-version=', COMP_API]) return do_get(endpoint, access_token)
python
def get_vmss(access_token, subscription_id, resource_group, vmss_name): '''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 response. JSON body of scale set properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets/', vmss_name, '?api-version=', COMP_API]) return do_get(endpoint, access_token)
[ "def", "get_vmss", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "vmss_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGroups...
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 response. JSON body of scale set properties.
[ "Get", "virtual", "machine", "scale", "set", "details", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L379-L396
6,591
gbowerman/azurerm
azurerm/computerp.py
get_vmss_vm
def get_vmss_vm(access_token, subscription_id, resource_group, vmss_name, instance_id): '''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 the scale set VM. Returns: HTTP response. JSON body of VMSS VM model view. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets/', vmss_name, '/virtualMachines/', str(instance_id), '?api-version=', COMP_API]) return do_get(endpoint, access_token)
python
def get_vmss_vm(access_token, subscription_id, resource_group, vmss_name, instance_id): '''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 the scale set VM. Returns: HTTP response. JSON body of VMSS VM model view. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets/', vmss_name, '/virtualMachines/', str(instance_id), '?api-version=', COMP_API]) return do_get(endpoint, access_token)
[ "def", "get_vmss_vm", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "vmss_name", ",", "instance_id", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id",...
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 the scale set VM. Returns: HTTP response. JSON body of VMSS VM model view.
[ "Get", "individual", "VMSS", "VM", "details", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L479-L498
6,592
gbowerman/azurerm
azurerm/computerp.py
get_as
def get_as(access_token, subscription_id, resource_group, as_name): '''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 of the availability set properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/availabilitySets/', as_name, '?api-version=', COMP_API]) return do_get(endpoint, access_token)
python
def get_as(access_token, subscription_id, resource_group, as_name): '''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 of the availability set properties. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/availabilitySets/', as_name, '?api-version=', COMP_API]) return do_get(endpoint, access_token)
[ "def", "get_as", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "as_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGroups/'",...
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 of the availability set properties.
[ "Get", "availability", "set", "details", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L546-L563
6,593
gbowerman/azurerm
azurerm/computerp.py
list_as_sub
def list_as_sub(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Compute/availabilitySets', '?api-version=', COMP_API]) return do_get_next(endpoint, access_token)
python
def list_as_sub(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Compute/availabilitySets', '?api-version=', COMP_API]) return do_get_next(endpoint, access_token)
[ "def", "list_as_sub", "(", "access_token", ",", "subscription_id", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/Microsoft.Compute/availabilitySets'", ",", "'?...
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.
[ "List", "availability", "sets", "in", "a", "subscription", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L585-L599
6,594
gbowerman/azurerm
azurerm/computerp.py
list_vm_images_sub
def list_vm_images_sub(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Compute/images', '?api-version=', COMP_API]) return do_get_next(endpoint, access_token)
python
def list_vm_images_sub(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Compute/images', '?api-version=', COMP_API]) return do_get_next(endpoint, access_token)
[ "def", "list_vm_images_sub", "(", "access_token", ",", "subscription_id", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/Microsoft.Compute/images'", ",", "'?api...
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.
[ "List", "VM", "images", "in", "a", "subscription", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L602-L616
6,595
gbowerman/azurerm
azurerm/computerp.py
list_vms
def list_vms(access_token, subscription_id, resource_group): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachines', '?api-version=', COMP_API]) return do_get(endpoint, access_token)
python
def list_vms(access_token, subscription_id, resource_group): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachines', '?api-version=', COMP_API]) return do_get(endpoint, access_token)
[ "def", "list_vms", "(", "access_token", ",", "subscription_id", ",", "resource_group", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGroups/'", ",", "resourc...
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.
[ "List", "VMs", "in", "a", "resource", "group", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L619-L635
6,596
gbowerman/azurerm
azurerm/computerp.py
list_vms_sub
def list_vms_sub(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Compute/virtualMachines', '?api-version=', COMP_API]) return do_get_next(endpoint, access_token)
python
def list_vms_sub(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Compute/virtualMachines', '?api-version=', COMP_API]) return do_get_next(endpoint, access_token)
[ "def", "list_vms_sub", "(", "access_token", ",", "subscription_id", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/Microsoft.Compute/virtualMachines'", ",", "'?...
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.
[ "List", "VMs", "in", "a", "subscription", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L638-L652
6,597
gbowerman/azurerm
azurerm/computerp.py
list_vmss
def list_vmss(access_token, subscription_id, resource_group): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets', '?api-version=', COMP_API]) return do_get_next(endpoint, access_token)
python
def list_vmss(access_token, subscription_id, resource_group): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets', '?api-version=', COMP_API]) return do_get_next(endpoint, access_token)
[ "def", "list_vmss", "(", "access_token", ",", "subscription_id", ",", "resource_group", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGroups/'", ",", "resour...
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.
[ "List", "VM", "Scale", "Sets", "in", "a", "resource", "group", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L655-L671
6,598
gbowerman/azurerm
azurerm/computerp.py
list_vmss_skus
def list_vmss_skus(access_token, subscription_id, resource_group, vmss_name): '''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: HTTP response. JSON body of VM skus. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets/', vmss_name, '/skus', '?api-version=', COMP_API]) return do_get_next(endpoint, access_token)
python
def list_vmss_skus(access_token, subscription_id, resource_group, vmss_name): '''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: HTTP response. JSON body of VM skus. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/resourceGroups/', resource_group, '/providers/Microsoft.Compute/virtualMachineScaleSets/', vmss_name, '/skus', '?api-version=', COMP_API]) return do_get_next(endpoint, access_token)
[ "def", "list_vmss_skus", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "vmss_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resource...
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: HTTP response. JSON body of VM skus.
[ "List", "the", "VM", "skus", "available", "for", "a", "VM", "Scale", "Set", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L674-L692
6,599
gbowerman/azurerm
azurerm/computerp.py
list_vmss_sub
def list_vmss_sub(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Compute/virtualMachineScaleSets', '?api-version=', COMP_API]) return do_get_next(endpoint, access_token)
python
def list_vmss_sub(access_token, subscription_id): '''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. ''' endpoint = ''.join([get_rm_endpoint(), '/subscriptions/', subscription_id, '/providers/Microsoft.Compute/virtualMachineScaleSets', '?api-version=', COMP_API]) return do_get_next(endpoint, access_token)
[ "def", "list_vmss_sub", "(", "access_token", ",", "subscription_id", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/Microsoft.Compute/virtualMachineScaleSets'", "...
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.
[ "List", "VM", "Scale", "Sets", "in", "a", "subscription", "." ]
79d40431d3b13f8a36aadbff5029888383d72674
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L695-L709