text
stringlengths
6
947k
repo_name
stringlengths
5
100
path
stringlengths
4
231
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
score
float64
0
0.34
from sqlalchemy.schema import Column from sqlalchemy.types import Integer from sqlalchemy.sql.expression import select, func from openspending.core import db from openspending.model.attribute import Attribute from openspending.model.common import TableHandler, ALIAS_PLACEHOLDER from openspending.model.constants import DATE_CUBES_TEMPLATE from openspending.validation.data import InvalidData class Dimension(object): """ A base class for dimensions. A dimension is any property of an entry that can serve to describe it beyond its purely numeric ``Measure``. """ def __init__(self, model, name, data): self._data = data self.model = model self.name = name self.key = data.get('key', False) self.label = data.get('label', name) self.type = data.get('type', name) self.description = data.get('description', name) self.facet = data.get('facet') def join(self, from_clause): return from_clause def drop(self, bind): del self.column @property def is_compound(self): """ Test whether or not this dimension object is compound. """ return isinstance(self, CompoundDimension) def __getitem__(self, name): raise KeyError() def __repr__(self): return "<Dimension(%s)>" % self.name def as_dict(self): # FIXME: legacy support d = self._data.copy() d['key'] = self.name d['name'] = self.name return d def has_attribute(self, attribute): """ Check whether an instance has a given attribute. This methods exposes the hasattr for parts of OpenSpending where hasattr isn't accessible (e.g. in templates) """ return hasattr(self, attribute) class GeomTimeAttribute(Dimension, Attribute): """ A simple dimension that does not create its own values table but keeps its values directly as columns on the facts table. This is somewhat unusual for a star schema but appropriate for properties such as transaction identifiers whose cardinality roughly equals that of the facts table. """ def __init__(self, model, name, data): Attribute.__init__(self, model, name, data) Dimension.__init__(self, model, name, data) def __repr__(self): return "<GeomTimeAttribute(%s)>" % self.name def members(self, conditions="1=1", limit=None, offset=0): """ Get a listing of all the members of the dimension (i.e. all the distinct values) matching the filter in ``conditions``. """ query = select([self.column_alias], conditions, limit=limit, offset=offset, distinct=True) rp = self.model.bind.execute(query) while True: row = rp.fetchone() if row is None: break yield row[0] def load(self, bind, value): return {self.column.name: value} def num_entries(self, conditions="1=1"): """ Return the count of entries on the model fact table having the dimension set to a value matching the filter given by ``conditions``. """ query = select([func.count(func.distinct(self.column_alias))], conditions) rp = self.model.bind.execute(query) return rp.fetchone()[0] def to_cubes(self, mappings, joins): """ Convert this dimension to a ``cubes`` dimension. """ mappings['%s.%s' % (self.name, self.name)] = unicode(self.column) return { 'levels': [{ 'name': self.name, 'label': self.label, 'key': self.name, 'attributes': [self.name] }] } class AttributeDimension(Dimension, Attribute): """ A simple dimension that does not create its own values table but keeps its values directly as columns on the facts table. This is somewhat unusual for a star schema but appropriate for properties such as transaction identifiers whose cardinality roughly equals that of the facts table. """ def __init__(self, model, name, data): Attribute.__init__(self, model, name, data) Dimension.__init__(self, model, name, data) def __repr__(self): return "<AttributeDimension(%s)>" % self.name def members(self, conditions="1=1", limit=None, offset=0): """ Get a listing of all the members of the dimension (i.e. all the distinct values) matching the filter in ``conditions``. """ query = select([self.column_alias], conditions, limit=limit, offset=offset, distinct=True) rp = self.model.bind.execute(query) while True: row = rp.fetchone() if row is None: break yield row[0] def num_entries(self, conditions="1=1"): """ Return the count of entries on the model fact table having the dimension set to a value matching the filter given by ``conditions``. """ query = select([func.count(func.distinct(self.column_alias))], conditions) rp = self.model.bind.execute(query) return rp.fetchone()[0] def to_cubes(self, mappings, joins): """ Convert this dimension to a ``cubes`` dimension. """ mappings['%s.%s' % (self.name, self.name)] = unicode(self.column) return { 'levels': [{ 'name': self.name, 'label': self.label, 'key': self.name, 'attributes': [self.name] }] } class Measure(Attribute): """ A value on the facts table that can be subject to aggregation, and is specific to this one fact. This would typically be some financial unit, i.e. the amount associated with the transaction or a specific portion thereof (i.e. co-financed amounts). """ def __init__(self, model, name, data): Attribute.__init__(self, model, name, data) self.label = data.get('label', name) def __getitem__(self, name): raise KeyError() def join(self, from_clause): return from_clause def __repr__(self): return "<Measure(%s)>" % self.name class CompoundDimension(Dimension, TableHandler): """ A compound dimension is an outer table on the star schema, i.e. an associated table that is referenced from the fact table. It can have any number of attributes but in the case of OpenSpending it will not have sub-dimensions (i.e. snowflake schema). """ def __init__(self, model, name, data): Dimension.__init__(self, model, name, data) self.taxonomy = data.get('taxonomy', name) self.attributes = [] for name, attr in data.get('attributes', {}).items(): self.attributes.append(Attribute(self, name, attr)) # TODO: possibly use a LRU later on? self._pk_cache = {} def join(self, from_clause): """ This will return a query fragment that can be used to establish an aliased join between the fact table and the dimension table. """ return from_clause.join( self.alias, self.alias.c.id == self.column_alias) def drop(self, bind): """ Drop the dimension table and all data within it. """ self._drop(bind) del self.column @property def column_alias(self): """ This an aliased pointer to the FK column on the fact table. """ return self.model.alias.c[self.column.name] @property def selectable(self): return self.alias def __getitem__(self, name): for attr in self.attributes: if attr.name == name: return attr raise KeyError() def init(self, meta, fact_table, make_table=True): column = Column(self.name + '_id', Integer, index=True) fact_table.append_column(column) if make_table is True: self._init_table(meta, self.model.source.dataset.name, self.name) for attr in self.attributes: attr.column = attr.init(meta, self.table) alias_name = self.name.replace('_', ALIAS_PLACEHOLDER) self.alias = self.table.alias(alias_name) return column def generate(self, meta, entry_table): """ Create the table and column associated with this dimension if it does not already exist and propagate this call to the associated attributes. """ for attr in self.attributes: attr.generate(meta, self.table) self._generate_table() def load(self, bind, row): """ Load a row of data into this dimension by upserting the attribute values. """ dim = dict() for attr in self.attributes: attr_data = row[attr.name] dim.update(attr.load(bind, attr_data)) name = dim['name'] if name in self._pk_cache: pk = self._pk_cache[name] else: pk = self._upsert(bind, dim, ['name']) self._pk_cache[name] = pk return {self.column.name: pk} def members(self, conditions="1=1", limit=None, offset=0): """ Get a listing of all the members of the dimension (i.e. all the distinct values) matching the filter in ``conditions``. This can also be used to find a single individual member, e.g. a dimension value identified by its name. """ query = select([self.alias], conditions, limit=limit, offset=offset, distinct=True) rp = self.model.bind.execute(query) while True: row = rp.fetchone() if row is None: break member = dict(row.items()) member['taxonomy'] = self.taxonomy yield member def num_entries(self, conditions="1=1"): """ Return the count of entries on the model fact table having the dimension set to a value matching the filter given by ``conditions``. """ joins = self.join(self.model.alias) query = select([func.count(func.distinct(self.column_alias))], conditions, joins) rp = self.model.bind.execute(query) return rp.fetchone()[0] def to_cubes(self, mappings, joins): """ Convert this dimension to a ``cubes`` dimension. """ attributes = ['id'] + [a.name for a in self.attributes] fact_table = self.model.table.name joins.append({ 'master': '%s.%s' % (fact_table, self.name + '_id'), 'detail': '%s.id' % self.table.name }) for a in attributes: mappings['%s.%s' % (self.name, a)] = '%s.%s' % (self.table.name, a) return { 'levels': [{ 'name': self.name, 'label': self.label, 'key': 'name', 'attributes': attributes }] } def __len__(self): rp = self.model.bind.execute(self.alias.count()) return rp.fetchone()[0] def __repr__(self): return "<CompoundDimension(%s:%s)>" % (self.name, self.attributes) #this needs to be done class GeometryDimension(Dimension, TableHandler): """ A compound dimension is an outer table on the star schema, i.e. an associated table that is referenced from the fact table. It can have any number of attributes but in the case of OpenSpending it will not have sub-dimensions (i.e. snowflake schema). """ def __init__(self, model, name, data): Dimension.__init__(self, model, name, data) self.taxonomy = data.get('taxonomy', name) self.attributes = [] for name, attr in data.get('attributes', {}).items(): self.attributes.append(Attribute(self, name, attr)) # TODO: possibly use a LRU later on? self._pk_cache = {} def join(self, from_clause): """ This will return a query fragment that can be used to establish an aliased join between the fact table and the dimension table. """ return from_clause.join( self.alias, self.alias.c.id == self.column_alias) def drop(self, bind): """ Drop the dimension table and all data within it. """ self._drop(bind) del self.column @property def column_alias(self): """ This an aliased pointer to the FK column on the fact table. """ return self.model.alias.c[self.column.name] @property def selectable(self): return self.alias def __getitem__(self, name): for attr in self.attributes: if attr.name == name: return attr raise KeyError() def init(self, meta, fact_table, make_table=True): column = Column(self.name + '_id', Integer, index=True) fact_table.append_column(column) if make_table is True: self._init_table(meta, self.model.source.dataset.name, self.name) for attr in self.attributes: attr.column = attr.init(meta, self.table) alias_name = self.name.replace('_', ALIAS_PLACEHOLDER) self.alias = self.table.alias(alias_name) return column def generate(self, meta, entry_table): """ Create the table and column associated with this dimension if it does not already exist and propagate this call to the associated attributes. """ for attr in self.attributes: attr.generate(meta, self.table) self._generate_table() def load(self, bind, row): """ Load a row of data into this dimension by upserting the attribute values. """ dim = dict() for attr in self.attributes: attr_data = row[attr.name] dim.update(attr.load(bind, attr_data)) name = dim['name'] dim = self._match_countries(dim) if name in self._pk_cache: pk = self._pk_cache[name] else: pk = self._upsert(bind, dim, ['name']) self._pk_cache[name] = pk return {self.column.name: pk} def _match_countries(self, dim): #comes in as this {'name': u'anguilla', 'label': u'Anguilla'} #need to go out tlike this {'name': u'anguilla', 'label': u'Anguilla', 'countryid': '1'} searchstring = dim['label'].replace("'", "''") result = db.engine.execute("SELECT country_level0.gid as gid \ FROM public.geometry__country_level0 as country_level0 \ WHERE country_level0.name_long = '%s' \ OR country_level0.short_name = '%s' \ OR country_level0.label = '%s' \ OR country_level0.formal_en = '%s';" %(searchstring, searchstring,searchstring, searchstring,)) resultitem = result.first() if not resultitem: result = db.engine.execute("SELECT \ geometry__country_level0.gid\ FROM \ public.geometry__alt_names, \ public.geometry__country_level0\ WHERE \ geometry__alt_names.country_level0_id = geometry__country_level0.gid AND\ (geometry__alt_names.altname IN ('%s','%s'));" %(searchstring, searchstring.lower(),)) resultitem = result.first() #check the altnames table for an item if resultitem: countrygid_val = resultitem[0] else: countrygid_val = 0 # if not resultitem: # raise InvalidData("country_level0", "country name", # "geometry", dim['label'], "Could not find the column") dim['countryid'] = countrygid_val return dim def members(self, conditions="1=1", limit=None, offset=0): """ Get a listing of all the members of the dimension (i.e. all the distinct values) matching the filter in ``conditions``. This can also be used to find a single individual member, e.g. a dimension value identified by its name. """ query = select([self.alias], conditions, limit=limit, offset=offset, distinct=True) rp = self.model.bind.execute(query) while True: row = rp.fetchone() if row is None: break member = dict(row.items()) member['taxonomy'] = self.taxonomy yield member def num_entries(self, conditions="1=1"): """ Return the count of entries on the model fact table having the dimension set to a value matching the filter given by ``conditions``. """ joins = self.join(self.model.alias) query = select([func.count(func.distinct(self.column_alias))], conditions, joins) rp = self.model.bind.execute(query) return rp.fetchone()[0] def to_cubes(self, mappings, joins): """ Convert this dimension to a ``cubes`` dimension. """ attributes = ['id'] + [a.name for a in self.attributes] fact_table = self.model.table.name joins.append({ 'master': '%s.%s' % (fact_table, self.name + '_id'), 'detail': '%s.id' % self.table.name }) for a in attributes: mappings['%s.%s' % (self.name, a)] = '%s.%s' % (self.table.name, a) return { 'levels': [{ 'name': self.name, 'label': self.label, 'key': 'name', 'attributes': attributes }] } def __len__(self): rp = self.model.bind.execute(self.alias.count()) return rp.fetchone()[0] def __repr__(self): return "<GeometryDimension(%s:%s)>" % (self.name, self.attributes) class DateDimension(CompoundDimension): """ DateDimensions are closely related to :py:class:`CompoundDimensions` but the value is set up from a Python date object to automatically contain several properties of the date in their own attributes (e.g. year, month, quarter, day). """ DATE_ATTRIBUTES = { 'name': {'datatype': 'string'}, 'label': {'datatype': 'string'}, 'year': {'datatype': 'string'}, 'quarter': {'datatype': 'string'}, 'month': {'datatype': 'string'}, 'week': {'datatype': 'string'}, 'day': {'datatype': 'string'}, # legacy query support: 'yearmonth': {'datatype': 'string'}, } def __init__(self, model, name, data): Dimension.__init__(self, model, name, data) self.taxonomy = name self.attributes = [] for name, attr in self.DATE_ATTRIBUTES.items(): self.attributes.append(Attribute(self, name, attr)) self._pk_cache = {} def load(self, bind, value): """ Given a Python datetime.date, generate a date dimension with the following attributes automatically set: * name - a human-redable representation * year - the year only (e.g. 2011) * quarter - a number to identify the quarter of the year (zero-based) * month - the month of the date (e.g. 01) * week - calendar week of the year (e.g. 42) * day - day of the month (e.g. 8) * yearmonth - combined year and month (e.g. 201112) """ data = { 'name': value.isoformat(), 'label': value.strftime("%d. %B %Y"), 'year': value.strftime('%Y'), 'quarter': str(value.month / 4), 'month': value.strftime('%m'), 'week': value.strftime('%W'), 'day': value.strftime('%d'), 'yearmonth': value.strftime('%Y%m') } return super(DateDimension, self).load(bind, data) def to_cubes(self, mappings, joins): """ Convert this dimension to a ``cubes`` dimension. """ fact_table = self.model.table.name joins.append({ 'master': '%s.%s' % (fact_table, self.name + '_id'), 'detail': '%s.id' % self.table.name }) for a in ['year']: mappings['%s.%s' % (self.name, a)] = '%s.%s' % (self.table.name, a) return DATE_CUBES_TEMPLATE.copy() def __repr__(self): return "<DateDimension(%s:%s)>" % (self.name, self.attributes)
USStateDept/FPA_Core
openspending/model/dimension.py
Python
agpl-3.0
20,686
0.00116
import os, h5py, numpy from scipy.sparse import csc_matrix import ml2h5.task from ml2h5 import VERSION_MLDATA from ml2h5.converter import ALLOWED_SEPERATORS class BaseHandler(object): """Base handler class. It is the base for classes to handle different data formats. It implicitely handles HDF5. @cvar str_type: string type to be used for variable length strings in h5py @type str_type: numpy.dtype @ivar fname: name of file to handle @type fname: string @ivar seperator: seperator to seperate variables in examples @type seperator: string """ str_type = h5py.new_vlen(numpy.str) def __init__(self, fname, seperator=None, compression=None, merge=False): """ @param fname: name of in-file @type fname: string @param seperator: seperator used to seperate examples @type seperator: string """ self.fname = fname self.compression = compression self.set_seperator(seperator) self.merge = merge def set_seperator(self, seperator): """Set the seperator to seperate variables in examples. @param seperator: seperator to use @type seperator: string """ if seperator in ALLOWED_SEPERATORS: self.seperator = seperator else: raise AttributeError(_("Seperator '%s' not allowed!" % seperator)) def warn(self, msg): """Print a warning message. @param msg: message to print @type msg: string """ return print('WARNING: ' + msg) def _convert_to_ndarray(self,path,val): """converts a attribut to a set of ndarrays depending on the datatype @param path: path of the attribute in the h5 file @type path: string @param val: data of the attribute @type val: csc_matrix/ndarray @rtype: list of (string,ndarray) tuples """ A=val out=[] dt = h5py.special_dtype(vlen=str) if type(A)==csc_matrix: # sparse out.append((path+'_indices', A.indices)) out.append((path+'_indptr', A.indptr)) out.append((path, A.data)) elif type(A)==list and len(A)>0 and type(A[0])==str: out.append((path, numpy.array(A, dtype=dt))) else: # dense out.append((path, numpy.array(A))) return out def get_data_as_list(self,data): """ this needs to `transpose' the data """ dl=[] group=self.get_data_group(data) lengths=dict() for o in data['ordering']: x=data[group][o] #if numpy.issubdtype(x.dtype, numpy.int): # data[group][o]=x.astype(numpy.float64) try: lengths[o]=data[group][o].shape[1] except (AttributeError, IndexError): lengths[o]=len(data[group][o]) l=set(lengths.values()) assert(len(l)==1) l=l.pop() for i in range(l): line=[] for o in data['ordering']: try: line.extend(data[group][o][:,i]) except: line.append(data[group][o][i]) dl.append(line) return dl def get_name(self): """Get dataset name from non-HDF5 file @return: comment @rtype: string """ # without str() it might barf return str(os.path.basename(self.fname).split('.')[0]) def get_data_group(self, data): if data and 'group' in data: return data['group'] else: return 'data' def get_descr_group(self, data): if data and 'group' in data: return data['group'] + '_descr' else: return 'data_descr' def get_datatype(self, values): """Get data type of given values. @param values: list of values to check @type values: list @return: data type to use for conversion @rtype: numpy.int32/numpy.double/self.str_type """ dtype = None for v in values: if isinstance(v, int): dtype = numpy.int32 elif isinstance(v, float): dtype = numpy.double else: # maybe int/double in string try: tmp = int(v) if not dtype: # a previous nan might set it to double dtype = numpy.int32 except ValueError: try: tmp = float(v) dtype = numpy.double except ValueError: return self.str_type return dtype def read(self): """Get data and description in-memory Retrieve contents from file. @return: example names, ordering and the examples @rtype: dict of: list of names, list of ordering and dict of examples """ # we want the exception handled elsewhere if not h5py.is_hdf5(self.fname): return h5 = h5py.File(self.fname, 'r') contents = { 'name': h5.attrs['name'], 'comment': h5.attrs['comment'], 'mldata': h5.attrs['mldata'], } if contents['comment']=='Task file': contents['task']=dict() contents['ordering']=list() group='task' for field in ml2h5.task.task_data_fields: if field in h5[group]: contents['ordering'].append(field) else: contents['data']=dict() contents['ordering']=h5['/data_descr/ordering'][...].tolist() group='data' contents['group']=group if '/%s_descr/names' % group in h5: contents['names']=h5['/%s_descr/names' % group][...].tolist() if '/%s_descr/types' % group in h5: contents['types'] = h5['/%s_descr/types' % group ][...] for name in contents['ordering']: vname='/%s/%s' % (group, name) sp_indices=vname+'_indices' sp_indptr=vname+'_indptr' if sp_indices in h5['/%s' % group] and sp_indptr in h5['/%s' % group]: contents[group][name] = csc_matrix((h5[vname], h5[sp_indices], h5[sp_indptr]) ) else: d = numpy.array(h5[vname],order='F') try: d=d['vlen'] except: pass contents[group][name] = d h5.close() return contents def read_data_as_array(self): """Read data from file, and return an array @return: an array with all data @rtype: numpy ndarray """ contents = self.read() #group = self.get_data_group(data) data = contents['data'] ordering = contents['ordering'] if len(data[ordering[0]].shape)>1: num_examples = data[ordering[0]].shape[1] else: num_examples = len(data[ordering[0]]) data_array = numpy.zeros((0, num_examples)) for cur_feat in ordering: data_array = numpy.vstack([data_array, data[cur_feat]]) return data_array.T def _get_merged(self, data): """Merge given data where appropriate. String arrays are not merged, but all int and all double are merged into one matrix. @param data: data structure as returned by read() @type data: dict @return: merged data structure @rtype: dict """ merged = {} ordering = [] path = '' idx = 0 merging = None group = self.get_data_group(data) for name in data['ordering']: val = data[group][name] if type(val) == csc_matrix: merging = None path = name merged[path] = val ordering.append(path) continue if name.endswith('_indices') or name.endswith('_indptr'): merging = None path = name merged[path] = val continue if len(val) < 1: continue t = type(val[0]) if t in [numpy.int32, numpy.int64]: if merging == 'int': merged[path].append(val) else: merging = 'int' path = 'int' + str(idx) ordering.append(path) merged[path] = [val] idx += 1 elif t == numpy.double: if merging == 'double': merged[path].append(val) else: merging = 'double' path = 'double' + str(idx) ordering.append(path) merged[path] = [val] idx += 1 else: # string or matrix merging = None if name.find('/') != -1: # / sep belongs to hdf5 path path = name.replace('/', '+') data['ordering'][data['ordering'].index(name)] = path else: path = name ordering.append(path) merged[path] = val data[group] = {} for k in merged: if len(merged[k])==1: merged[k] = merged[k][0] data[group][k] = numpy.array(merged[k]) data['ordering'] = ordering return data def write(self, data): """Write given data to HDF5 file. @param data: data to write to HDF5 file. @type data: dict of lists """ # we want the exception handled elsewhere h5 = h5py.File(self.fname, 'w') h5.attrs['name'] = data['name'] h5.attrs['mldata'] = VERSION_MLDATA h5.attrs['comment'] = data['comment'] data_group = self.get_data_group(data) descr_group = self.get_descr_group(data) try: group = h5.create_group('/%s' % data_group) for path, val in data[data_group].items(): for path, val in self._convert_to_ndarray(path,val): group.create_dataset(path, data=val, compression=self.compression) group = h5.create_group('/%s' % descr_group) names = numpy.array(data['names']).astype(self.str_type) if names.size > 0: # simple 'if names' throws exception if array group.create_dataset('names', data=names, compression=self.compression) ordering = numpy.array(data['ordering']).astype(self.str_type) if ordering.size > 0: group.create_dataset('ordering', data=ordering, compression=self.compression) if 'types' in data: types = numpy.array(data['types']).astype(self.str_type) group.create_dataset('types', data=types, compression=self.compression) except: # just do some clean-up h5.close() os.remove(self.fname) raise else: h5.close()
open-machine-learning/mldata-utils
ml2h5/converter/basehandler.py
Python
gpl-3.0
11,241
0.006939
"""Tomography with TV regularization using the ProxImaL solver. Solves the optimization problem min_{0 <= x <= 1} ||A(x) - g||_2^2 + 0.2 || |grad(x)| ||_1 Where ``A`` is a parallel beam forward projector, ``grad`` the spatial gradient and ``g`` is given noisy data. """ import numpy as np import odl import proximal # --- Set up the forward operator (ray transform) --- # # Reconstruction space: discretized functions on the rectangle # [-20, 20]^2 with 300 samples per dimension. reco_space = odl.uniform_discr( min_pt=[-20, -20], max_pt=[20, 20], shape=[300, 300], dtype='float32') # Make a parallel beam geometry with flat detector # Angles: uniformly spaced, n = 360, min = 0, max = pi angle_partition = odl.uniform_partition(0, np.pi, 360) # Detector: uniformly sampled, n = 512, min = -30, max = 30 detector_partition = odl.uniform_partition(-30, 30, 512) geometry = odl.tomo.Parallel2dGeometry(angle_partition, detector_partition) # Initialize the ray transform (forward projection). ray_trafo = odl.tomo.RayTransform(reco_space, geometry) # Convert ray transform to proximal language operator proximal_lang_ray_trafo = odl.as_proximal_lang_operator(ray_trafo) # Create sinogram of forward projected phantom with noise phantom = odl.phantom.shepp_logan(reco_space, modified=True) phantom.show('phantom') data = ray_trafo(phantom) data += odl.phantom.white_noise(ray_trafo.range) * np.mean(data) * 0.1 data.show('noisy data') # Convert to array for ProxImaL rhs_arr = data.asarray() # Set up optimization problem # Note that proximal is not aware of the underlying space and only works with # matrices. Hence the norm in proximal does not match the norm in the ODL space # exactly. x = proximal.Variable(reco_space.shape) funcs = [proximal.sum_squares(proximal_lang_ray_trafo(x) - rhs_arr), 0.2 * proximal.norm1(proximal.grad(x)), proximal.nonneg(x), proximal.nonneg(1 - x)] # Solve the problem using ProxImaL prob = proximal.Problem(funcs) prob.solve(verbose=True) # Convert back to odl and display result result_odl = reco_space.element(x.value) result_odl.show('ProxImaL result', force_show=True)
kohr-h/odl
examples/solvers/proximal_lang_tomography.py
Python
mpl-2.0
2,158
0
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root@localhost:3306/microblog' SQLALCHEMY_TRACK_MODIFICATIONS = False REDIS_HOST = 'localhost' REDIS_PORT = 6379 DEBUG = False
yejianye/microblog
asura/conf/dev.py
Python
mit
170
0
import sqlite3 from datetime import datetime from pprint import pprint import sys import numpy as np conn = sqlite3.connect('C:/projects/dbs/SP2_data.db') c = conn.cursor() #sp2b_file TEXT, eg 20120405x001.sp2b #file_index INT, #instr TEXT, eg UBCSP2, ECSP2 #instr_locn TEXT, eg WHI, DMT, POLAR6 #particle_type TEXT, eg PSL, nonincand, incand, Aquadag #particle_dia FLOAT, #unix_ts_utc FLOAT, #actual_scat_amp FLOAT, #actual_peak_pos INT, #FF_scat_amp FLOAT, #FF_peak_pos INT, #FF_gauss_width FLOAT, #zeroX_to_peak FLOAT, #LF_scat_amp FLOAT, #incand_amp FLOAT, #lag_time_fit_to_incand FLOAT, #LF_baseline_pct_diff FLOAT, #rBC_mass_fg FLOAT, #coat_thickness_nm FLOAT, #zero_crossing_posn FLOAT, #coat_thickness_from_actual_scat_amp FLOAT, #FF_fit_function TEXT, #LF_fit_function TEXT, #zeroX_to_LEO_limit FLOAT #UNIQUE (sp2b_file, file_index, instr) #)''') #c.execute('''ALTER TABLE SP2_coating_analysis ADD COLUMN FF_fit_function TEXT''') #c.execute('''ALTER TABLE SP2_coating_analysis ADD COLUMN zeroX_to_LEO_limit FLOAT''') #c.execute('''CREATE INDEX SP2_coating_analysis_index1 ON SP2_coating_analysis(instr,instr_locn,particle_type,unix_ts_utc,unix_ts_utc,FF_gauss_width,zeroX_to_peak)''') #c.execute('''SELECT * FROM SP2_coating_analysis''') c.execute('''DELETE FROM SP2_coating_analysis WHERE instr=? and instr_locn=? and particle_type=?''', ('UBCSP2', 'POLAR6','nonincand' )) #names = [description[0] for description in c.description] #pprint(names) #print c.fetchone() # conn.close()
annahs/atmos_research
sqlite_test.py
Python
mit
1,520
0.028289
"""The tests for the notify yessssms platform.""" import logging import unittest from unittest.mock import patch import pytest import requests_mock from homeassistant.components.yessssms.const import CONF_PROVIDER import homeassistant.components.yessssms.notify as yessssms from homeassistant.const import CONF_PASSWORD, CONF_RECIPIENT, CONF_USERNAME from homeassistant.setup import async_setup_component @pytest.fixture(name="config") def config_data(): """Set valid config data.""" config = { "notify": { "platform": "yessssms", "name": "sms", CONF_USERNAME: "06641234567", CONF_PASSWORD: "secretPassword", CONF_RECIPIENT: "06509876543", CONF_PROVIDER: "educom", } } return config @pytest.fixture(name="valid_settings") def init_valid_settings(hass, config): """Initialize component with valid settings.""" return async_setup_component(hass, "notify", config) @pytest.fixture(name="invalid_provider_settings") def init_invalid_provider_settings(hass, config): """Set invalid provider data and initalize component.""" config["notify"][CONF_PROVIDER] = "FantasyMobile" # invalid provider return async_setup_component(hass, "notify", config) @pytest.fixture(name="invalid_login_data") def mock_invalid_login_data(): """Mock invalid login data.""" path = "homeassistant.components.yessssms.notify.YesssSMS.login_data_valid" with patch(path, return_value=False): yield @pytest.fixture(name="valid_login_data") def mock_valid_login_data(): """Mock valid login data.""" path = "homeassistant.components.yessssms.notify.YesssSMS.login_data_valid" with patch(path, return_value=True): yield @pytest.fixture(name="connection_error") def mock_connection_error(): """Mock a connection error.""" path = "homeassistant.components.yessssms.notify.YesssSMS.login_data_valid" with patch(path, side_effect=yessssms.YesssSMS.ConnectionError()): yield async def test_unsupported_provider_error(hass, caplog, invalid_provider_settings): """Test for error on unsupported provider.""" await invalid_provider_settings for record in caplog.records: if ( record.levelname == "ERROR" and record.name == "homeassistant.components.yessssms.notify" ): assert ( "Unknown provider: provider (fantasymobile) is not known to YesssSMS" in record.message ) assert ( "Unknown provider: provider (fantasymobile) is not known to YesssSMS" in caplog.text ) assert not hass.services.has_service("notify", "sms") async def test_false_login_data_error(hass, caplog, valid_settings, invalid_login_data): """Test login data check error.""" await valid_settings assert not hass.services.has_service("notify", "sms") for record in caplog.records: if ( record.levelname == "ERROR" and record.name == "homeassistant.components.yessssms.notify" ): assert ( "Login data is not valid! Please double check your login data at" in record.message ) async def test_init_success(hass, caplog, valid_settings, valid_login_data): """Test for successful init of yessssms.""" caplog.set_level(logging.DEBUG) await valid_settings assert hass.services.has_service("notify", "sms") messages = [] for record in caplog.records: if ( record.levelname == "DEBUG" and record.name == "homeassistant.components.yessssms.notify" ): messages.append(record.message) assert "Login data for 'educom' valid" in messages[0] assert ( "initialized; library version: {}".format(yessssms.YesssSMS("", "").version()) in messages[1] ) async def test_connection_error_on_init(hass, caplog, valid_settings, connection_error): """Test for connection error on init.""" caplog.set_level(logging.DEBUG) await valid_settings assert hass.services.has_service("notify", "sms") for record in caplog.records: if ( record.levelname == "WARNING" and record.name == "homeassistant.components.yessssms.notify" ): assert ( "Connection Error, could not verify login data for '{}'".format( "educom" ) in record.message ) for record in caplog.records: if ( record.levelname == "DEBUG" and record.name == "homeassistant.components.yessssms.notify" ): assert ( "initialized; library version: {}".format( yessssms.YesssSMS("", "").version() ) in record.message ) class TestNotifyYesssSMS(unittest.TestCase): """Test the yessssms notify.""" def setUp(self): # pylint: disable=invalid-name """Set up things to be run when tests are started.""" login = "06641234567" passwd = "testpasswd" recipient = "06501234567" client = yessssms.YesssSMS(login, passwd) self.yessssms = yessssms.YesssSMSNotificationService(client, recipient) @requests_mock.Mocker() def test_login_error(self, mock): """Test login that fails.""" mock.register_uri( requests_mock.POST, # pylint: disable=protected-access self.yessssms.yesss._login_url, status_code=200, text="BlaBlaBla<strong>Login nicht erfolgreichBlaBla", ) message = "Testing YesssSMS platform :)" with self.assertLogs("homeassistant.components.yessssms.notify", level="ERROR"): self.yessssms.send_message(message) self.assertTrue(mock.called) self.assertEqual(mock.call_count, 1) def test_empty_message_error(self): """Test for an empty SMS message error.""" message = "" with self.assertLogs("homeassistant.components.yessssms.notify", level="ERROR"): self.yessssms.send_message(message) @requests_mock.Mocker() def test_error_account_suspended(self, mock): """Test login that fails after multiple attempts.""" mock.register_uri( "POST", # pylint: disable=protected-access self.yessssms.yesss._login_url, status_code=200, text="BlaBlaBla<strong>Login nicht erfolgreichBlaBla", ) message = "Testing YesssSMS platform :)" with self.assertLogs("homeassistant.components.yessssms.notify", level="ERROR"): self.yessssms.send_message(message) self.assertTrue(mock.called) self.assertEqual(mock.call_count, 1) mock.register_uri( "POST", # pylint: disable=protected-access self.yessssms.yesss._login_url, status_code=200, text="Wegen 3 ungültigen Login-Versuchen ist Ihr Account für " "eine Stunde gesperrt.", ) message = "Testing YesssSMS platform :)" with self.assertLogs("homeassistant.components.yessssms.notify", level="ERROR"): self.yessssms.send_message(message) self.assertTrue(mock.called) self.assertEqual(mock.call_count, 2) def test_error_account_suspended_2(self): """Test login that fails after multiple attempts.""" message = "Testing YesssSMS platform :)" # pylint: disable=protected-access self.yessssms.yesss._suspended = True with self.assertLogs( "homeassistant.components.yessssms.notify", level="ERROR" ) as context: self.yessssms.send_message(message) self.assertIn("Account is suspended, cannot send SMS.", context.output[0]) @requests_mock.Mocker() def test_send_message(self, mock): """Test send message.""" message = "Testing YesssSMS platform :)" mock.register_uri( "POST", # pylint: disable=protected-access self.yessssms.yesss._login_url, status_code=302, # pylint: disable=protected-access headers={"location": self.yessssms.yesss._kontomanager}, ) # pylint: disable=protected-access login = self.yessssms.yesss._logindata["login_rufnummer"] mock.register_uri( "GET", # pylint: disable=protected-access self.yessssms.yesss._kontomanager, status_code=200, text="test..." + login + "</a>", ) mock.register_uri( "POST", # pylint: disable=protected-access self.yessssms.yesss._websms_url, status_code=200, text="<h1>Ihre SMS wurde erfolgreich verschickt!</h1>", ) mock.register_uri( "GET", # pylint: disable=protected-access self.yessssms.yesss._logout_url, status_code=200, ) with self.assertLogs( "homeassistant.components.yessssms.notify", level="INFO" ) as context: self.yessssms.send_message(message) self.assertIn("SMS sent", context.output[0]) self.assertTrue(mock.called) self.assertEqual(mock.call_count, 4) self.assertIn( mock.last_request.scheme + "://" + mock.last_request.hostname + mock.last_request.path + "?" + mock.last_request.query, # pylint: disable=protected-access self.yessssms.yesss._logout_url, ) def test_no_recipient_error(self): """Test for missing/empty recipient.""" message = "Testing YesssSMS platform :)" # pylint: disable=protected-access self.yessssms._recipient = "" with self.assertLogs( "homeassistant.components.yessssms.notify", level="ERROR" ) as context: self.yessssms.send_message(message) self.assertIn( "You need to provide a recipient for SMS notification", context.output[0] ) @requests_mock.Mocker() def test_sms_sending_error(self, mock): """Test sms sending error.""" mock.register_uri( "POST", # pylint: disable=protected-access self.yessssms.yesss._login_url, status_code=302, # pylint: disable=protected-access headers={"location": self.yessssms.yesss._kontomanager}, ) # pylint: disable=protected-access login = self.yessssms.yesss._logindata["login_rufnummer"] mock.register_uri( "GET", # pylint: disable=protected-access self.yessssms.yesss._kontomanager, status_code=200, text="test..." + login + "</a>", ) mock.register_uri( "POST", # pylint: disable=protected-access self.yessssms.yesss._websms_url, status_code=500, ) message = "Testing YesssSMS platform :)" with self.assertLogs( "homeassistant.components.yessssms.notify", level="ERROR" ) as context: self.yessssms.send_message(message) self.assertTrue(mock.called) self.assertEqual(mock.call_count, 3) self.assertIn("YesssSMS: error sending SMS", context.output[0]) @requests_mock.Mocker() def test_connection_error(self, mock): """Test connection error.""" mock.register_uri( "POST", # pylint: disable=protected-access self.yessssms.yesss._login_url, exc=yessssms.YesssSMS.ConnectionError, ) message = "Testing YesssSMS platform :)" with self.assertLogs( "homeassistant.components.yessssms.notify", level="ERROR" ) as context: self.yessssms.send_message(message) self.assertTrue(mock.called) self.assertEqual(mock.call_count, 1) self.assertIn("cannot connect to provider", context.output[0])
leppa/home-assistant
tests/components/yessssms/test_notify.py
Python
apache-2.0
12,228
0.001063
#!/usr/bin/env python import json import sys import os from bottle import route, run, get import time import httplib server = "127.0.0.1" statport = "18081" host = "%s:18001" % server staturl = "http://%s:%s/status" % (server,statport) blob = {"id": "bar", "url": staturl} data = json.dumps(blob) connection = httplib.HTTPConnection(host) connection.request('POST', '/checks', data) result = connection.getresponse() print "RESULT: %s - %s" % (result.status, result.reason) def usage(): print "%s [status: OK,Unknown,Warning,Critical]" % (sys.argv[0]) msgs = { "OK": "Everything is groovy!", "Unknown": "Unknown error!", "Warning": "Houstin, I think we have a warning!", "Critical": "Danger Will Rogers! Danger!" } t = len(sys.argv) if t < 2: usage() sys.exit(1) else: statusm = sys.argv[1] t = time.localtime() ts = time.strftime('%Y-%m-%dT%H:%M:%S%Z', t) rootdir = "./" # Change working directory so relative paths (and template lookup) work again root = os.path.join(os.path.dirname(__file__)) sys.path.insert(0, root) # generate nested python dictionaries, copied from here: # http://stackoverflow.com/questions/635483/what-is-the-best-way-to-implement-nested-dictionaries-in-python class AutoVivification(dict): """Implementation of perl's autovivification feature.""" def __getitem__(self, item): try: return dict.__getitem__(self, item) except KeyError: value = self[item] = type(self)() return value @get('/status') def status(): data = AutoVivification() data['id'] = "bar" data['status'] = statusm data['date'] = ts data['message'] = msgs[statusm] data['version'] = "1.0.0" return data run(host='localhost', port=statport, debug=True)
looprock/Megaphone
sample_service.py
Python
isc
1,823
0.016456
# # @lc app=leetcode id=594 lang=python3 # # [594] Longest Harmonious Subsequence # # https://leetcode.com/problems/longest-harmonious-subsequence/description/ # # algorithms # Easy (51.44%) # Total Accepted: 97.9K # Total Submissions: 190.2K # Testcase Example: '[1,3,2,2,5,2,3,7]' # # We define a harmonious array as an array where the difference between its # maximum value and its minimum value is exactly 1. # # Given an integer array nums, return the length of its longest harmonious # subsequence among all its possible subsequences. # # A subsequence of array is a sequence that can be derived from the array by # deleting some or no elements without changing the order of the remaining # elements. # # # Example 1: # # # Input: nums = [1,3,2,2,5,2,3,7] # Output: 5 # Explanation: The longest harmonious subsequence is [3,2,2,2,3]. # # # Example 2: # # # Input: nums = [1,2,3,4] # Output: 2 # # # Example 3: # # # Input: nums = [1,1,1,1] # Output: 0 # # # # Constraints: # # # 1 <= nums.length <= 2 * 10^4 # -10^9 <= nums[i] <= 10^9 # # # from typing import List class Solution: def findLHS(self, nums: List[int]) -> int: num_to_freq = dict() for num in nums: if num not in num_to_freq: num_to_freq[num] = 0 num_to_freq[num] += 1 lhs = 0 for num, freq in num_to_freq.items(): num_add_one_freq = num_to_freq.get(num + 1, -1) if num_add_one_freq != -1: curr_lhs = freq + num_add_one_freq if curr_lhs > lhs: lhs = curr_lhs return lhs
vermouth1992/Leetcode
python/594.longest-harmonious-subsequence.py
Python
mit
1,636
0.014059
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU Affero Public License for more details. # # You should have received a copy of the GNU Affero Public License # along with this program. If not, see http://www.gnu.org/licenses. # # http://numenta.org/licenses/ # ---------------------------------------------------------------------- from cStringIO import StringIO import sys import tempfile import unittest2 as unittest import numpy from nupic.encoders.base import defaultDtype from nupic.data import SENTINEL_VALUE_FOR_MISSING_DATA from nupic.data.fieldmeta import FieldMetaType from nupic.support.unittesthelpers.algorithm_test_helpers import getSeed from nupic.encoders.random_distributed_scalar import ( RandomDistributedScalarEncoder ) try: import capnp except ImportError: capnp = None if capnp: from nupic.encoders.random_distributed_scalar_capnp import ( RandomDistributedScalarEncoderProto ) # Disable warnings about accessing protected members # pylint: disable=W0212 def computeOverlap(x, y): """ Given two binary arrays, compute their overlap. The overlap is the number of bits where x[i] and y[i] are both 1 """ return (x & y).sum() def validateEncoder(encoder, subsampling): """ Given an encoder, calculate overlaps statistics and ensure everything is ok. We don't check every possible combination for speed reasons. """ for i in range(encoder.minIndex, encoder.maxIndex+1, 1): for j in range(i+1, encoder.maxIndex+1, subsampling): if not encoder._overlapOK(i, j): return False return True class RandomDistributedScalarEncoderTest(unittest.TestCase): """ Unit tests for RandomDistributedScalarEncoder class. """ def testEncoding(self): """ Test basic encoding functionality. Create encodings without crashing and check they contain the correct number of on and off bits. Check some encodings for expected overlap. Test that encodings for old values don't change once we generate new buckets. """ # Initialize with non-default parameters and encode with a number close to # the offset encoder = RandomDistributedScalarEncoder(name="encoder", resolution=1.0, w=23, n=500, offset=0.0) e0 = encoder.encode(-0.1) self.assertEqual(e0.sum(), 23, "Number of on bits is incorrect") self.assertEqual(e0.size, 500, "Width of the vector is incorrect") self.assertEqual(encoder.getBucketIndices(0.0)[0], encoder._maxBuckets / 2, "Offset doesn't correspond to middle bucket") self.assertEqual(len(encoder.bucketMap), 1, "Number of buckets is not 1") # Encode with a number that is resolution away from offset. Now we should # have two buckets and this encoding should be one bit away from e0 e1 = encoder.encode(1.0) self.assertEqual(len(encoder.bucketMap), 2, "Number of buckets is not 2") self.assertEqual(e1.sum(), 23, "Number of on bits is incorrect") self.assertEqual(e1.size, 500, "Width of the vector is incorrect") self.assertEqual(computeOverlap(e0, e1), 22, "Overlap is not equal to w-1") # Encode with a number that is resolution*w away from offset. Now we should # have many buckets and this encoding should have very little overlap with # e0 e25 = encoder.encode(25.0) self.assertGreater(len(encoder.bucketMap), 23, "Number of buckets is not 2") self.assertEqual(e25.sum(), 23, "Number of on bits is incorrect") self.assertEqual(e25.size, 500, "Width of the vector is incorrect") self.assertLess(computeOverlap(e0, e25), 4, "Overlap is too high") # Test encoding consistency. The encodings for previous numbers # shouldn't change even though we have added additional buckets self.assertTrue(numpy.array_equal(e0, encoder.encode(-0.1)), "Encodings are not consistent - they have changed after new buckets " "have been created") self.assertTrue(numpy.array_equal(e1, encoder.encode(1.0)), "Encodings are not consistent - they have changed after new buckets " "have been created") def testMissingValues(self): """ Test that missing values and NaN return all zero's. """ encoder = RandomDistributedScalarEncoder(name="encoder", resolution=1.0) empty = encoder.encode(SENTINEL_VALUE_FOR_MISSING_DATA) self.assertEqual(empty.sum(), 0) empty = encoder.encode(float("nan")) self.assertEqual(empty.sum(), 0) def testResolution(self): """ Test that numbers within the same resolution return the same encoding. Numbers outside the resolution should return different encodings. """ encoder = RandomDistributedScalarEncoder(name="encoder", resolution=1.0) # Since 23.0 is the first encoded number, it will be the offset. # Since resolution is 1, 22.9 and 23.4 should have the same bucket index and # encoding. e23 = encoder.encode(23.0) e23p1 = encoder.encode(23.1) e22p9 = encoder.encode(22.9) e24 = encoder.encode(24.0) self.assertEqual(e23.sum(), encoder.w) self.assertEqual((e23 == e23p1).sum(), encoder.getWidth(), "Numbers within resolution don't have the same encoding") self.assertEqual((e23 == e22p9).sum(), encoder.getWidth(), "Numbers within resolution don't have the same encoding") self.assertNotEqual((e23 == e24).sum(), encoder.getWidth(), "Numbers outside resolution have the same encoding") e22p9 = encoder.encode(22.5) self.assertNotEqual((e23 == e22p9).sum(), encoder.getWidth(), "Numbers outside resolution have the same encoding") def testMapBucketIndexToNonZeroBits(self): """ Test that mapBucketIndexToNonZeroBits works and that max buckets and clipping are handled properly. """ encoder = RandomDistributedScalarEncoder(resolution=1.0, w=11, n=150) # Set a low number of max buckets encoder._initializeBucketMap(10, None) encoder.encode(0.0) encoder.encode(-7.0) encoder.encode(7.0) self.assertEqual(len(encoder.bucketMap), encoder._maxBuckets, "_maxBuckets exceeded") self.assertTrue( numpy.array_equal(encoder.mapBucketIndexToNonZeroBits(-1), encoder.bucketMap[0]), "mapBucketIndexToNonZeroBits did not handle negative" " index") self.assertTrue( numpy.array_equal(encoder.mapBucketIndexToNonZeroBits(1000), encoder.bucketMap[9]), "mapBucketIndexToNonZeroBits did not handle negative index") e23 = encoder.encode(23.0) e6 = encoder.encode(6) self.assertEqual((e23 == e6).sum(), encoder.getWidth(), "Values not clipped correctly during encoding") ep8 = encoder.encode(-8) ep7 = encoder.encode(-7) self.assertEqual((ep8 == ep7).sum(), encoder.getWidth(), "Values not clipped correctly during encoding") self.assertEqual(encoder.getBucketIndices(-8)[0], 0, "getBucketIndices returned negative bucket index") self.assertEqual(encoder.getBucketIndices(23)[0], encoder._maxBuckets-1, "getBucketIndices returned bucket index that is too" " large") def testParameterChecks(self): """ Test that some bad construction parameters get handled. """ # n must be >= 6*w with self.assertRaises(ValueError): RandomDistributedScalarEncoder(name="mv", resolution=1.0, n=int(5.9*21)) # n must be an int with self.assertRaises(ValueError): RandomDistributedScalarEncoder(name="mv", resolution=1.0, n=5.9*21) # w can't be negative with self.assertRaises(ValueError): RandomDistributedScalarEncoder(name="mv", resolution=1.0, w=-1) # resolution can't be negative with self.assertRaises(ValueError): RandomDistributedScalarEncoder(name="mv", resolution=-2) def testOverlapStatistics(self): """ Check that the overlaps for the encodings are within the expected range. Here we ask the encoder to create a bunch of representations under somewhat stressful conditions, and then verify they are correct. We rely on the fact that the _overlapOK and _countOverlapIndices methods are working correctly. """ seed = getSeed() # Generate about 600 encodings. Set n relatively low to increase # chance of false overlaps encoder = RandomDistributedScalarEncoder(resolution=1.0, w=11, n=150, seed=seed) encoder.encode(0.0) encoder.encode(-300.0) encoder.encode(300.0) self.assertTrue(validateEncoder(encoder, subsampling=3), "Illegal overlap encountered in encoder") def testGetMethods(self): """ Test that the getWidth, getDescription, and getDecoderOutputFieldTypes methods work. """ encoder = RandomDistributedScalarEncoder(name="theName", resolution=1.0, n=500) self.assertEqual(encoder.getWidth(), 500, "getWidth doesn't return the correct result") self.assertEqual(encoder.getDescription(), [("theName", 0)], "getDescription doesn't return the correct result") self.assertEqual(encoder.getDecoderOutputFieldTypes(), (FieldMetaType.float, ), "getDecoderOutputFieldTypes doesn't return the correct" " result") def testOffset(self): """ Test that offset is working properly """ encoder = RandomDistributedScalarEncoder(name="encoder", resolution=1.0) encoder.encode(23.0) self.assertEqual(encoder._offset, 23.0, "Offset not specified and not initialized to first input") encoder = RandomDistributedScalarEncoder(name="encoder", resolution=1.0, offset=25.0) encoder.encode(23.0) self.assertEqual(encoder._offset, 25.0, "Offset not initialized to specified constructor" " parameter") def testSeed(self): """ Test that initializing twice with the same seed returns identical encodings and different when not specified """ encoder1 = RandomDistributedScalarEncoder(name="encoder1", resolution=1.0, seed=42) encoder2 = RandomDistributedScalarEncoder(name="encoder2", resolution=1.0, seed=42) encoder3 = RandomDistributedScalarEncoder(name="encoder3", resolution=1.0, seed=-1) encoder4 = RandomDistributedScalarEncoder(name="encoder4", resolution=1.0, seed=-1) e1 = encoder1.encode(23.0) e2 = encoder2.encode(23.0) e3 = encoder3.encode(23.0) e4 = encoder4.encode(23.0) self.assertEqual((e1 == e2).sum(), encoder1.getWidth(), "Same seed gives rise to different encodings") self.assertNotEqual((e1 == e3).sum(), encoder1.getWidth(), "Different seeds gives rise to same encodings") self.assertNotEqual((e3 == e4).sum(), encoder1.getWidth(), "seeds of -1 give rise to same encodings") def testCountOverlapIndices(self): """ Test that the internal method _countOverlapIndices works as expected. """ # Create a fake set of encodings. encoder = RandomDistributedScalarEncoder(name="encoder", resolution=1.0, w=5, n=5*20) midIdx = encoder._maxBuckets/2 encoder.bucketMap[midIdx-2] = numpy.array(range(3, 8)) encoder.bucketMap[midIdx-1] = numpy.array(range(4, 9)) encoder.bucketMap[midIdx] = numpy.array(range(5, 10)) encoder.bucketMap[midIdx+1] = numpy.array(range(6, 11)) encoder.bucketMap[midIdx+2] = numpy.array(range(7, 12)) encoder.bucketMap[midIdx+3] = numpy.array(range(8, 13)) encoder.minIndex = midIdx - 2 encoder.maxIndex = midIdx + 3 # Indices must exist with self.assertRaises(ValueError): encoder._countOverlapIndices(midIdx-3, midIdx-2) with self.assertRaises(ValueError): encoder._countOverlapIndices(midIdx-2, midIdx-3) # Test some overlaps self.assertEqual(encoder._countOverlapIndices(midIdx-2, midIdx-2), 5, "_countOverlapIndices didn't work") self.assertEqual(encoder._countOverlapIndices(midIdx-1, midIdx-2), 4, "_countOverlapIndices didn't work") self.assertEqual(encoder._countOverlapIndices(midIdx+1, midIdx-2), 2, "_countOverlapIndices didn't work") self.assertEqual(encoder._countOverlapIndices(midIdx-2, midIdx+3), 0, "_countOverlapIndices didn't work") def testOverlapOK(self): """ Test that the internal method _overlapOK works as expected. """ # Create a fake set of encodings. encoder = RandomDistributedScalarEncoder(name="encoder", resolution=1.0, w=5, n=5*20) midIdx = encoder._maxBuckets/2 encoder.bucketMap[midIdx-3] = numpy.array(range(4, 9)) # Not ok with # midIdx-1 encoder.bucketMap[midIdx-2] = numpy.array(range(3, 8)) encoder.bucketMap[midIdx-1] = numpy.array(range(4, 9)) encoder.bucketMap[midIdx] = numpy.array(range(5, 10)) encoder.bucketMap[midIdx+1] = numpy.array(range(6, 11)) encoder.bucketMap[midIdx+2] = numpy.array(range(7, 12)) encoder.bucketMap[midIdx+3] = numpy.array(range(8, 13)) encoder.minIndex = midIdx - 3 encoder.maxIndex = midIdx + 3 self.assertTrue(encoder._overlapOK(midIdx, midIdx-1), "_overlapOK didn't work") self.assertTrue(encoder._overlapOK(midIdx-2, midIdx+3), "_overlapOK didn't work") self.assertFalse(encoder._overlapOK(midIdx-3, midIdx-1), "_overlapOK didn't work") # We'll just use our own numbers self.assertTrue(encoder._overlapOK(100, 50, 0), "_overlapOK didn't work for far values") self.assertTrue(encoder._overlapOK(100, 50, encoder._maxOverlap), "_overlapOK didn't work for far values") self.assertFalse(encoder._overlapOK(100, 50, encoder._maxOverlap+1), "_overlapOK didn't work for far values") self.assertTrue(encoder._overlapOK(50, 50, 5), "_overlapOK didn't work for near values") self.assertTrue(encoder._overlapOK(48, 50, 3), "_overlapOK didn't work for near values") self.assertTrue(encoder._overlapOK(46, 50, 1), "_overlapOK didn't work for near values") self.assertTrue(encoder._overlapOK(45, 50, encoder._maxOverlap), "_overlapOK didn't work for near values") self.assertFalse(encoder._overlapOK(48, 50, 4), "_overlapOK didn't work for near values") self.assertFalse(encoder._overlapOK(48, 50, 2), "_overlapOK didn't work for near values") self.assertFalse(encoder._overlapOK(46, 50, 2), "_overlapOK didn't work for near values") self.assertFalse(encoder._overlapOK(50, 50, 6), "_overlapOK didn't work for near values") def testCountOverlap(self): """ Test that the internal method _countOverlap works as expected. """ encoder = RandomDistributedScalarEncoder(name="encoder", resolution=1.0, n=500) r1 = numpy.array([1, 2, 3, 4, 5, 6]) r2 = numpy.array([1, 2, 3, 4, 5, 6]) self.assertEqual(encoder._countOverlap(r1, r2), 6, "_countOverlap result is incorrect") r1 = numpy.array([1, 2, 3, 4, 5, 6]) r2 = numpy.array([1, 2, 3, 4, 5, 7]) self.assertEqual(encoder._countOverlap(r1, r2), 5, "_countOverlap result is incorrect") r1 = numpy.array([1, 2, 3, 4, 5, 6]) r2 = numpy.array([6, 5, 4, 3, 2, 1]) self.assertEqual(encoder._countOverlap(r1, r2), 6, "_countOverlap result is incorrect") r1 = numpy.array([1, 2, 8, 4, 5, 6]) r2 = numpy.array([1, 2, 3, 4, 9, 6]) self.assertEqual(encoder._countOverlap(r1, r2), 4, "_countOverlap result is incorrect") r1 = numpy.array([1, 2, 3, 4, 5, 6]) r2 = numpy.array([1, 2, 3]) self.assertEqual(encoder._countOverlap(r1, r2), 3, "_countOverlap result is incorrect") r1 = numpy.array([7, 8, 9, 10, 11, 12]) r2 = numpy.array([1, 2, 3, 4, 5, 6]) self.assertEqual(encoder._countOverlap(r1, r2), 0, "_countOverlap result is incorrect") def testVerbosity(self): """ Test that nothing is printed out when verbosity=0 """ _stdout = sys.stdout sys.stdout = _stringio = StringIO() encoder = RandomDistributedScalarEncoder(name="mv", resolution=1.0, verbosity=0) output = numpy.zeros(encoder.getWidth(), dtype=defaultDtype) encoder.encodeIntoArray(23.0, output) encoder.getBucketIndices(23.0) sys.stdout = _stdout self.assertEqual(len(_stringio.getvalue()), 0, "zero verbosity doesn't lead to zero output") def testEncodeInvalidInputType(self): encoder = RandomDistributedScalarEncoder(name="encoder", resolution=1.0, verbosity=0) with self.assertRaises(TypeError): encoder.encode("String") @unittest.skipUnless( capnp, "pycapnp is not installed, skipping serialization test.") def testCapNProtoSerialization(self): original = RandomDistributedScalarEncoder( name="encoder", resolution=1.0, w=23, n=500, offset=0.0) originalValue = original.encode(1) proto1 = RandomDistributedScalarEncoderProto.new_message() original.write(proto1) # Write the proto to a temp file and read it back into a new proto with tempfile.TemporaryFile() as f: proto1.write(f) f.seek(0) proto2 = RandomDistributedScalarEncoderProto.read(f) encoder = RandomDistributedScalarEncoder.read(proto2) self.assertIsInstance(encoder, RandomDistributedScalarEncoder) self.assertEqual(encoder.resolution, original.resolution) self.assertEqual(encoder.w, original.w) self.assertEqual(encoder.n, original.n) self.assertEqual(encoder.name, original.name) self.assertEqual(encoder.verbosity, original.verbosity) self.assertEqual(encoder.minIndex, original.minIndex) self.assertEqual(encoder.maxIndex, original.maxIndex) self.assertTrue(numpy.array_equal(encoder.encode(1), originalValue)) self.assertEqual(original.decode(encoder.encode(1)), encoder.decode(original.encode(1))) self.assertEqual(original.random.getSeed(), encoder.random.getSeed()) for key, value in original.bucketMap.items(): self.assertTrue(numpy.array_equal(value, encoder.bucketMap[key])) if __name__ == "__main__": unittest.main()
chen0031/nupic
tests/unit/nupic/encoders/random_distributed_scalar_test.py
Python
agpl-3.0
19,698
0.004315
#!env python import os import sys sys.path.append( os.path.join( os.environ.get( "SPLUNK_HOME", "/opt/splunk/6.1.3" ), "etc/apps/framework/contrib/splunk-sdk-python/1.3.0", ) ) from collections import Counter, OrderedDict from math import log from nltk import tokenize import execnet import json from splunklib.searchcommands import Configuration, Option from splunklib.searchcommands import dispatch, validators from remote_commands import OptionRemoteStreamingCommand class FloatValidator(validators.Integer): def __init__(self, **kwargs): super(FloatValidator, self).__init__(**kwargs) def __call__(self, value): if value is not None: value = float(value) self.check_range(value) return value @Configuration(clear_required_fields=True, overrides_timeorder=True) class NLCluster(OptionRemoteStreamingCommand): alg = Option(require=False, default="mean_shift") model = Option(require=False, default="lsi") # threshold = Option(require=False, default=0.01, validate=FloatValidator(minimum=0,maximum=1)) code = """ import sys, os, numbers try: import cStringIO as StringIO except: import StringIO import numpy as np import scipy.sparse as sp from gensim.corpora import TextCorpus, Dictionary from gensim.models import LsiModel, TfidfModel, LdaModel from gensim.similarities import SparseMatrixSimilarity from gensim.matutils import corpus2dense from sklearn import cluster, covariance if __name__ == "__channelexec__": args = channel.receive() # threshold = args['threshold'] fields = args.get('fieldnames') or ['_raw'] records = [] for record in channel: if not record: break records.append(record) def is_number(str): try: n = float(str) return True except ValueError: return False need_sim = args['alg'] in {'affinity_propagation','spectral'} if records: records = np.array(records) input = None # StringIO.StringIO() X = None # sp.lil_matrix((len(records),len(fields))) for i, record in enumerate(records): nums = [] strs = [] for field in fields: if isinstance(record.get(field), numbers.Number): nums.append(record[field]) elif is_number(record.get(field) or ""): nums.append(record[field]) else: strs.append(str(record.get(field) or "").lower()) if strs: if input is None: input = StringIO.StringIO() print >> input, " ".join(strs) else: if X is None: X = sp.lil_matrix((len(records),len(fields))) X[i] = np.array(nums, dtype=np.float64) if input is not None: corpus = TextCorpus(input) if args['alg'] == 'spectral': args['model'] = 'tfidf' if args['model'] == 'lsi': model = LsiModel(corpus) elif args['model'] == 'tfidf': model = TfidfModel(corpus) ## Disable this for now # # elif args['model'] == 'lda': # model = LdaModel(corpus) # ## else: model = None # TODO: Persist model? if model: num_terms = len(model.id2word or getattr(model, 'dfs',[])) if need_sim: index = SparseMatrixSimilarity(model[corpus], num_terms=num_terms) X = index[corpus].astype(np.float64) else: X = corpus2dense(model[corpus], num_terms) else: channel.send({ 'error': "Unknown model %s" % args['model']}) else: X = X.toarray() if need_sim: model = covariance.EmpiricalCovariance() model.fit(X) X = model.covariance_ if X is not None: if args['alg'] == 'affinity_propagation': _, labels = cluster.affinity_propagation(X) elif args['alg'] == "mean_shift": _, labels = cluster.mean_shift(X) elif args['alg'] == 'spectral': labels = cluster.spectral_clustering(X) elif args['alg'] == 'dbscan': _, labels = cluster.dbscan(X) else: labels = None if labels != None: n_labels = labels.max() clustered = [] for i in range(n_labels + 1): clust = records[labels == i] record = clust[0] record['cluster_label'] = i + 1 record['cluster_size'] = len(clust) channel.send(record) else: channel.send({ 'error': "Unknown algorithm %s" % args['alg']}) """ def __dir__(self): return ['alg', 'model'] dispatch(NLCluster, sys.argv, sys.stdin, sys.stdout, __name__)
nlproc/splunkml
bin/nlcluster.py
Python
apache-2.0
4,186
0.029384
#!/usr/bin/env python """ Created on Mon 2 Dec 2013 Plotter grunntilstanden for en harmonisk oscillator. @author Benedicte Emilie Brakken """ from numpy import * from matplotlib.pyplot import * # Kun for aa teste omega = 1 # [rad / s] # Fysiske parametre hbarc = 0.1973 # [MeV pm] E0p = 938.27 # [MeV] c = 3e2 # [pm / as] # x-verdier x = linspace( -pi, pi, 1e4 ) def Psi0( x ): ''' Grunntilstanden for en harmonisk oscillator. ''' A = ( E0p * omega / ( pi * hbarc * c ) )**0.25 B = exp( - E0p * omega / ( 2 * hbarc * c) * x**2 ) return A * B # Henter funksjonsverdier og lagrer i arrayen Psi Psi = Psi0(x) # Lager et nytt figurvindu figure() # Plotter x mot Psi0 plot( x, abs( Psi )**2 ) # Tekst langs x-aksen xlabel('$x$ [pm]') # Tekst langs y-aksen ylabel('$|\Psi_0 (x, 0)|^2$ [1/pm]') # Tittel paa plottet title('Grunntilstanden for harmonisk oscillator') # Viser det vi har plottet show()
ahye/FYS2140-Resources
examples/plotting/plot_initial.py
Python
mit
964
0.018672
# Copyright (c) 2018, Frappe Technologies and contributors # For license information, please see license.txt # don't remove this function it is used in tests def test_method(): '''test function''' return 'overridden'
mhbu50/erpnext
erpnext/regional/france/utils.py
Python
gpl-3.0
222
0.018018
# Copyright (c) 2019-2022, Manfred Moitzi # License: MIT License from typing import TYPE_CHECKING import logging from ezdxf.lldxf import validator from ezdxf.lldxf.attributes import ( DXFAttr, DXFAttributes, DefSubclass, XType, RETURN_DEFAULT, group_code_mapping, ) from ezdxf.lldxf.const import DXF12, SUBCLASS_MARKER, DXF2000, DXF2007, DXF2010 from ezdxf.math import Vec3, NULLVEC from ezdxf.entities.dxfentity import base_class, SubclassProcessor, DXFEntity from ezdxf.entities.layer import acdb_symbol_table_record from .factory import register_entity logger = logging.getLogger("ezdxf") if TYPE_CHECKING: from ezdxf.eztypes import TagWriter, DXFNamespace __all__ = ["View"] acdb_view = DefSubclass( "AcDbViewTableRecord", { "name": DXFAttr(2, validator=validator.is_valid_table_name), "flags": DXFAttr(70, default=0), "height": DXFAttr(40, default=1), "width": DXFAttr(41, default=1), "center": DXFAttr(10, xtype=XType.point2d, default=NULLVEC), "direction": DXFAttr( 11, xtype=XType.point3d, default=Vec3(1, 1, 1), validator=validator.is_not_null_vector, ), "target": DXFAttr(12, xtype=XType.point3d, default=NULLVEC), "focal_length": DXFAttr(42, default=50), "front_clipping": DXFAttr(43, default=0), "back_clipping": DXFAttr(44, default=0), "view_twist": DXFAttr(50, default=0), "view_mode": DXFAttr(71, default=0), # Render mode: # 0 = 2D Optimized (classic 2D) # 1 = Wireframe # 2 = Hidden line # 3 = Flat shaded # 4 = Gouraud shaded # 5 = Flat shaded with wireframe # 6 = Gouraud shaded with wireframe "render_mode": DXFAttr( 281, default=0, dxfversion=DXF2000, validator=validator.is_in_integer_range(0, 7), fixer=RETURN_DEFAULT, ), # 1 if there is an UCS associated to this view, 0 otherwise. "ucs": DXFAttr( 72, default=0, validator=validator.is_integer_bool, fixer=RETURN_DEFAULT, ), "ucs_origin": DXFAttr(110, xtype=XType.point3d, dxfversion=DXF2000), "ucs_xaxis": DXFAttr( 111, xtype=XType.point3d, dxfversion=DXF2000, validator=validator.is_not_null_vector, ), "ucs_yaxis": DXFAttr( 112, xtype=XType.point3d, dxfversion=DXF2000, validator=validator.is_not_null_vector, ), # 0 = UCS is not orthographic # 1 = Top # 2 = Bottom # 3 = Front # 4 = Back # 5 = Left # 6 = Right "ucs_ortho_type": DXFAttr( 79, dxfversion=DXF2000, validator=validator.is_in_integer_range(0, 7), fixer=lambda x: 0, ), "elevation": DXFAttr(146, dxfversion=DXF2000, default=0), # handle of AcDbUCSTableRecord if UCS is a named UCS. If not present, # then UCS is unnamed: "ucs_handle": DXFAttr(345, dxfversion=DXF2000), # handle of AcDbUCSTableRecord of base UCS if UCS is orthographic (79 code # is non-zero). If not present and 79 code is non-zero, then base UCS is # taken to be WORLD "base_ucs_handle": DXFAttr(346, dxfversion=DXF2000), # 1 if the camera is plottable "camera_plottable": DXFAttr( 73, default=0, dxfversion=DXF2007, validator=validator.is_integer_bool, fixer=RETURN_DEFAULT, ), "background_handle": DXFAttr(332, optional=True, dxfversion=DXF2007), "live_selection_handle": DXFAttr( 334, optional=True, dxfversion=DXF2007 ), "visual_style_handle": DXFAttr(348, optional=True, dxfversion=DXF2007), "sun_handle": DXFAttr(361, optional=True, dxfversion=DXF2010), }, ) acdb_view_group_codes = group_code_mapping(acdb_view) @register_entity class View(DXFEntity): """DXF VIEW entity""" DXFTYPE = "VIEW" DXFATTRIBS = DXFAttributes(base_class, acdb_symbol_table_record, acdb_view) def load_dxf_attribs( self, processor: SubclassProcessor = None ) -> "DXFNamespace": dxf = super().load_dxf_attribs(processor) if processor: processor.simple_dxfattribs_loader(dxf, acdb_view_group_codes) # type: ignore return dxf def export_entity(self, tagwriter: "TagWriter") -> None: super().export_entity(tagwriter) if tagwriter.dxfversion > DXF12: tagwriter.write_tag2(SUBCLASS_MARKER, acdb_symbol_table_record.name) tagwriter.write_tag2(SUBCLASS_MARKER, acdb_view.name) self.dxf.export_dxf_attribs( tagwriter, [ "name", "flags", "height", "width", "center", "direction", "target", "focal_length", "front_clipping", "back_clipping", "view_twist", "view_mode", "render_mode", "ucs", "ucs_origin", "ucs_xaxis", "ucs_yaxis", "ucs_ortho_type", "elevation", "ucs_handle", "base_ucs_handle", "camera_plottable", "background_handle", "live_selection_handle", "visual_style_handle", "sun_handle", ], )
mozman/ezdxf
src/ezdxf/entities/view.py
Python
mit
5,728
0.000698
from waldur_core.core import WaldurExtension class OpenStackTenantExtension(WaldurExtension): class Settings: # wiki: https://opennode.atlassian.net/wiki/display/WD/OpenStack+plugin+configuration WALDUR_OPENSTACK_TENANT = { 'MAX_CONCURRENT_PROVISION': { 'OpenStackTenant.Instance': 4, 'OpenStackTenant.Volume': 4, 'OpenStackTenant.Snapshot': 4, }, } @staticmethod def django_app(): return 'waldur_openstack.openstack_tenant' @staticmethod def rest_urls(): from .urls import register_in return register_in @staticmethod def celery_tasks(): from datetime import timedelta return { 'openstacktenant-schedule-backups': { 'task': 'openstack_tenant.ScheduleBackups', 'schedule': timedelta(minutes=10), 'args': (), }, 'openstacktenant-delete-expired-backups': { 'task': 'openstack_tenant.DeleteExpiredBackups', 'schedule': timedelta(minutes=10), 'args': (), }, 'openstacktenant-schedule-snapshots': { 'task': 'openstack_tenant.ScheduleSnapshots', 'schedule': timedelta(minutes=10), 'args': (), }, 'openstacktenant-delete-expired-snapshots': { 'task': 'openstack_tenant.DeleteExpiredSnapshots', 'schedule': timedelta(minutes=10), 'args': (), }, 'openstacktenant-set-erred-stuck-resources': { 'task': 'openstack_tenant.SetErredStuckResources', 'schedule': timedelta(minutes=10), 'args': (), }, } @staticmethod def get_cleanup_executor(): from .executors import OpenStackTenantCleanupExecutor return OpenStackTenantCleanupExecutor
opennode/nodeconductor-openstack
src/waldur_openstack/openstack_tenant/extension.py
Python
mit
1,984
0.000504
# Copyright 2014 Red Hat Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslo_serialization import jsonutils from oslo_utils import versionutils from nova import db from nova import exception from nova.objects import base from nova.objects import fields as obj_fields from nova.virt import hardware # TODO(berrange): Remove NovaObjectDictCompat @base.NovaObjectRegistry.register class InstanceNUMACell(base.NovaObject, base.NovaObjectDictCompat): # Version 1.0: Initial version # Version 1.1: Add pagesize field # Version 1.2: Add cpu_pinning_raw and topology fields # Version 1.3: Add cpu_policy and cpu_thread_policy fields VERSION = '1.3' def obj_make_compatible(self, primitive, target_version): super(InstanceNUMACell, self).obj_make_compatible(primitive, target_version) target_version = versionutils.convert_version_to_tuple(target_version) if target_version < (1, 3): primitive.pop('cpu_policy', None) primitive.pop('cpu_thread_policy', None) fields = { 'id': obj_fields.IntegerField(), 'cpuset': obj_fields.SetOfIntegersField(), 'memory': obj_fields.IntegerField(), 'pagesize': obj_fields.IntegerField(nullable=True), 'cpu_topology': obj_fields.ObjectField('VirtCPUTopology', nullable=True), 'cpu_pinning_raw': obj_fields.DictOfIntegersField(nullable=True), 'cpu_policy': obj_fields.CPUAllocationPolicyField(nullable=True), 'cpu_thread_policy': obj_fields.CPUThreadAllocationPolicyField( nullable=True), } cpu_pinning = obj_fields.DictProxyField('cpu_pinning_raw') def __init__(self, **kwargs): super(InstanceNUMACell, self).__init__(**kwargs) if 'pagesize' not in kwargs: self.pagesize = None self.obj_reset_changes(['pagesize']) if 'cpu_topology' not in kwargs: self.cpu_topology = None self.obj_reset_changes(['cpu_topology']) if 'cpu_pinning' not in kwargs: self.cpu_pinning = None self.obj_reset_changes(['cpu_pinning_raw']) if 'cpu_policy' not in kwargs: self.cpu_policy = None self.obj_reset_changes(['cpu_policy']) if 'cpu_thread_policy' not in kwargs: self.cpu_thread_policy = None self.obj_reset_changes(['cpu_thread_policy']) def __len__(self): return len(self.cpuset) def _to_dict(self): # NOTE(sahid): Used as legacy, could be renamed in # _legacy_to_dict_ to the future to avoid confusing. return {'cpus': hardware.format_cpu_spec(self.cpuset, allow_ranges=False), 'mem': {'total': self.memory}, 'id': self.id, 'pagesize': self.pagesize} @classmethod def _from_dict(cls, data_dict): # NOTE(sahid): Used as legacy, could be renamed in # _legacy_from_dict_ to the future to avoid confusing. cpuset = hardware.parse_cpu_spec(data_dict.get('cpus', '')) memory = data_dict.get('mem', {}).get('total', 0) cell_id = data_dict.get('id') pagesize = data_dict.get('pagesize') return cls(id=cell_id, cpuset=cpuset, memory=memory, pagesize=pagesize) @property def siblings(self): cpu_list = sorted(list(self.cpuset)) threads = 0 if self.cpu_topology: threads = self.cpu_topology.threads if threads == 1: threads = 0 return list(map(set, zip(*[iter(cpu_list)] * threads))) @property def cpu_pinning_requested(self): return self.cpu_policy == obj_fields.CPUAllocationPolicy.DEDICATED def pin(self, vcpu, pcpu): if vcpu not in self.cpuset: return pinning_dict = self.cpu_pinning or {} pinning_dict[vcpu] = pcpu self.cpu_pinning = pinning_dict def pin_vcpus(self, *cpu_pairs): for vcpu, pcpu in cpu_pairs: self.pin(vcpu, pcpu) def clear_host_pinning(self): """Clear any data related to how this cell is pinned to the host. Needed for aborting claims as we do not want to keep stale data around. """ self.id = -1 self.cpu_pinning = {} return self # TODO(berrange): Remove NovaObjectDictCompat @base.NovaObjectRegistry.register class InstanceNUMATopology(base.NovaObject, base.NovaObjectDictCompat): # Version 1.0: Initial version # Version 1.1: Takes into account pagesize # Version 1.2: InstanceNUMACell 1.2 VERSION = '1.2' fields = { # NOTE(danms): The 'id' field is no longer used and should be # removed in the future when convenient 'id': obj_fields.IntegerField(), 'instance_uuid': obj_fields.UUIDField(), 'cells': obj_fields.ListOfObjectsField('InstanceNUMACell'), } @classmethod def obj_from_primitive(cls, primitive, context=None): if 'nova_object.name' in primitive: obj_topology = super(InstanceNUMATopology, cls).obj_from_primitive( primitive, context=None) else: # NOTE(sahid): This compatibility code needs to stay until we can # guarantee that there are no cases of the old format stored in # the database (or forever, if we can never guarantee that). obj_topology = InstanceNUMATopology._from_dict(primitive) obj_topology.id = 0 return obj_topology @classmethod def obj_from_db_obj(cls, instance_uuid, db_obj): primitive = jsonutils.loads(db_obj) obj_topology = cls.obj_from_primitive(primitive) if 'nova_object.name' not in db_obj: obj_topology.instance_uuid = instance_uuid # No benefit to store a list of changed fields obj_topology.obj_reset_changes() return obj_topology # TODO(ndipanov) Remove this method on the major version bump to 2.0 @base.remotable def create(self): values = {'numa_topology': self._to_json()} db.instance_extra_update_by_uuid(self._context, self.instance_uuid, values) self.obj_reset_changes() @base.remotable_classmethod def get_by_instance_uuid(cls, context, instance_uuid): db_extra = db.instance_extra_get_by_instance_uuid( context, instance_uuid, columns=['numa_topology']) if not db_extra: raise exception.NumaTopologyNotFound(instance_uuid=instance_uuid) if db_extra['numa_topology'] is None: return None return cls.obj_from_db_obj(instance_uuid, db_extra['numa_topology']) def _to_json(self): return jsonutils.dumps(self.obj_to_primitive()) def __len__(self): """Defined so that boolean testing works the same as for lists.""" return len(self.cells) def _to_dict(self): # NOTE(sahid): Used as legacy, could be renamed in _legacy_to_dict_ # in the future to avoid confusing. return {'cells': [cell._to_dict() for cell in self.cells]} @classmethod def _from_dict(cls, data_dict): # NOTE(sahid): Used as legacy, could be renamed in _legacy_from_dict_ # in the future to avoid confusing. return cls(cells=[ InstanceNUMACell._from_dict(cell_dict) for cell_dict in data_dict.get('cells', [])]) @property def cpu_pinning_requested(self): return all(cell.cpu_pinning_requested for cell in self.cells) def clear_host_pinning(self): """Clear any data related to how instance is pinned to the host. Needed for aborting claims as we do not want to keep stale data around. """ for cell in self.cells: cell.clear_host_pinning() return self
bigswitch/nova
nova/objects/instance_numa_topology.py
Python
apache-2.0
8,588
0.000116
#!/usr/bin/python # -*- coding: utf-8 -*- """ sysdiag Pierre Haessig — September 2013 """ from __future__ import division, print_function def _create_name(name_list, base): '''Returns a name (str) built on `base` that doesn't exist in `name_list`. Useful for automatic creation of subsystems or wires ''' base = str(base).strip() if base == '': # avoid having '' as name (although it would not break the code...) raise ValueError('base name should not be empty!') if base not in name_list: return base # Else: build another name by counting i = 0 name = base + str(i) while name in name_list: i += 1 name = base + str(i) return name class System(object): '''Diagram description of a system a System is either an interconnecion of subsystems or an atomic element (a leaf of the tree) ''' def __init__(self, name='root', parent=None): self.name = name # Parent system, if any (None for top-level): self.parent = None # Children systems, if any (None for leaf-level): self.subsystems = [] self.wires = [] self.ports = [] self.params = {} # If a parent system is provided, request its addition as a subsystem if parent is not None: parent.add_subsystem(self) #end __init__() def is_empty(self): '''True if the System contains no subsystems and no wires''' return (not self.subsystems) and (not self.wires) @property def ports_dict(self): '''dict of ports, which keys are the names of the ports''' return {p.name:p for p in self.ports} @property def subsystems_dict(self): '''dict of subsystems, which keys are the names of the systems''' return {s.name:s for s in self.subsystems} def add_port(self, port, created_by_system = False): '''add a Port to the System''' if port in self.ports: raise ValueError('port already added!') # extract the port's name name = port.name port_names = [p.name for p in self.ports] if name in port_names: raise ValueError("port name '{}' already exists in {:s}!".format( name, repr(self)) ) # Add parent relationship and add to the ports dict: port.system = self port._created_by_system = bool(created_by_system) self.ports.append(port) def del_port(self, port): '''delete a Port of the System (and disconnect any connected wire) ''' if (port.wire is not None) or (port.internal_wire is not None): # TODO : implement the wire disconnection raise NotImplementedError('Cannot yet delete a connected Port') # Remove the ports list: self.ports.remove(port) def add_subsystem(self, subsys): # 1) Check name uniqueness name = subsys.name subsys_names = [s.name for s in self.subsystems] if name in subsys_names: raise ValueError("system name '{}' already exists in {:s}!".format( name, repr(self)) ) # 2) Add parent relationship and add to the system list subsys.parent = self self.subsystems.append(subsys) def add_wire(self, wire): # 1) Check name uniqueness name = wire.name wire_names = [w.name for w in self.wires] if name in wire_names: raise ValueError("wire name '{}' already exists in {:s}!".format( name, repr(self)) ) # Add parent relationship and add to the ports dict: wire.parent = self self.wires.append(wire) def create_name(self, category, base): '''Returns a name (str) built on `base` that doesn't exist in within the names of `category`. ''' if category == 'subsystem': components = self.subsystems elif category == 'wire': components = self.wires else: raise ValueError("Unknown category '{}'!".format(str(category))) name_list = [c.name for c in components] return _create_name(name_list, base) def __repr__(self): cls_name = self.__class__.__name__ s = "{:s}('{.name}')".format(cls_name, self) return s def __str__(self): s = repr(self) if self.parent: s += '\n Parent: {:s}'.format(repr(self.parent)) if self.params: s += '\n Parameters: {:s}'.format(str(self.params)) if self.ports: s += '\n Ports: {:s}'.format(str(self.ports)) if self.subsystems: s += '\n Subsytems: {:s}'.format(str(self.subsystems)) return s def __eq__(self, other): '''Systems compare equal if their class, `name` and `params` are equal. and also their lists of ports and wires are *similar* (see `_is_similar` methods of Port and Wire) and finally their subsystems recursively compare equal. parent systems are not compared (would generate infinite recursion). ''' if not isinstance(other, System): return NotImplemented # Basic similarity basic_sim = self.__class__ == other.__class__ and \ self.name == other.name and \ self.params == other.params if not basic_sim: return False # Port similarity: (sensitive to the order) ports_sim = all(p1._is_similar(p2) for (p1,p2) in zip(self.ports, other.ports)) if not ports_sim: return False # Wires similarity wires_sim = all(w1._is_similar(w2) for (w1,w2) in zip(self.wires, other.wires)) if not wires_sim: return False print('equality at level {} is true'.format(self.name)) # Since everything matches, compare subsystems: return self.subsystems == other.subsystems # end __eq__() def __ne__(self,other): return not (self==other) def _to_json(self): '''convert the System instance to a JSON-serializable object System is serialized with list of ports, subsystems and wires but without connectivity information (e.g. no parent information) ports created at the initialization of the system ("default ports") are not serialized. ''' # Filter out ports created at the initialization of the system ports_list = [p for p in self.ports if not p._created_by_system] cls_name = self.__module__ +'.'+ self.__class__.__name__ return {'__sysdiagclass__': 'System', '__class__': cls_name, 'name':self.name, 'subsystems':self.subsystems, 'wires':self.wires, 'ports':ports_list, 'params':self.params } # end _to_json def json_dump(self, output=None, indent=2, sort_keys=True): '''dump (e.g. save) the System structure in json format if `output` is None: return a json string if `output` is a writable file: write in this file ''' import json if output is None: return json.dumps(self, default=to_json, indent=indent, sort_keys=sort_keys) else: json.dump(self, output, default=to_json, indent=indent, sort_keys=sort_keys) return # end json_dump class Port(object): '''Port enables the connection of a System to a Wire Each port has a `type` which only allows the connection of a Wire of the same type. it also have a `direction` ('none', 'in', 'out') that is set at the class level private attribute `_created_by_system` tells whether the port was created automatically by the system's class at initialization or by a custom code (if True, the port is not serialized by its system). ''' direction = 'none' def __init__(self, name, ptype): self.name = name self.type = ptype self.system = None self.wire = None self.internal_wire = None self._created_by_system = False def __repr__(self): cls_name = self.__class__.__name__ s = '{:s}({:s}, {:s})'.format(cls_name, repr(self.name), repr(self.type)) return s def __str__(self): s = repr(self) + ' of ' + repr(self.system) return s def _is_similar(self, other): '''Ports are *similar* if their class, `type` and `name` are equal. (their parent system are not compared) ''' if not isinstance(other, Port): return NotImplemented return self.__class__ == other.__class__ and \ self.type == other.type and \ self.name == other.name def _to_json(self): '''convert the Port instance to a JSON-serializable object Ports are serialized without any connectivity information ''' cls_name = self.__module__ +'.'+ self.__class__.__name__ return {'__sysdiagclass__': 'Port', '__class__': cls_name, 'name':self.name, 'type':self.type } # end _to_json class InputPort(Port): '''Input Port''' direction = 'in' def __init__(self, name, ptype=''): super(InputPort, self).__init__(name, ptype) class OutputPort(Port): '''Output Port''' direction = 'out' def __init__(self, name, ptype=''): super(OutputPort, self).__init__(name, ptype) class Wire(object): '''Wire enables the interconnection of several Systems through their Ports''' def __init__(self, name, wtype, parent=None): self.name = name self.parent = None self.type = wtype self.ports = [] # If a parent system is provided, request its addition as a wire if parent is not None: parent.add_wire(self) def is_connect_allowed(self, port, port_level, raise_error=False): '''Check that a connection between Wire ̀ self` and a Port `port` is allowed. Parameters ---------- `port`: the Port instance to connect to `port_level`: whether `port` belongs to a 'sibling' (usual case) or a 'parent' system (to enable connections to the upper level) `raise_error`: if True, raising an error replaces returning False Returns ------- allowed: True or False ''' assert port_level in ['sibling', 'parent'] # Port availability (is there already a wire connected?): if port_level == 'sibling': connected_wire = port.wire elif port_level == 'parent': connected_wire = port.internal_wire if connected_wire is not None: if raise_error: raise ValueError('port is already connected to '+\ '{:s}!'.format(repr(connected_wire))) else: return False # Check parent relationship: if port_level == 'sibling': # Check that the wire and port.system are siblings: if self.parent is not port.system.parent: if raise_error: raise ValueError('wire and port.system should have a common parent!') else: return False elif port_level == 'parent': # Check that the port.system is the parent of the wire: if self.parent is not port.system: if raise_error: raise ValueError('port.system should be the parent of the wire!') else: return False # Wire-Port Type checking: if self.type == '': # untyped wire: connection is always possible return True elif port.type == self.type: return True else: # Incompatible types if raise_error: raise TypeError("Wire type '{:s}'".format(str(self.type)) + \ " and Port type '{:s}'".format(str(port.type)) + \ " are not compatible!") else: return False def connect_port(self, port, port_level='sibling'): '''Connect the Wire to a Port `port`''' if port in self.ports: return # Port is aleady connected # Type checking: self.is_connect_allowed(port, port_level, raise_error=True) # Add parent relationship: assert port_level in ['sibling', 'parent'] if port_level=='sibling': port.wire = self elif port_level == 'parent': port.internal_wire = self # Book keeping of ports: self.ports.append(port) @property def ports_by_name(self): '''triplet representation of port connections (level, port.system.name, port.name) (used for serialization) ''' def port_triplet(p): '''triplet representation (level, port.system.name, port.name)''' if p.system is self.parent: level = 'parent' elif p.system.parent is self.parent: level = 'sibling' else: raise ValueError('The system of Port {}'.format(repr(p)) +\ 'is neither a parent nor a sibling!') return (level, p.system.name, p.name) return [port_triplet(p) for p in self.ports] def connect_by_name(self, s_name, p_name, level='sibling'): '''Connects the ports named `p_name` of system named `s_name` to be found at level `level` ('parent' or 'sibling' (default)) ''' # TODO (?) merge the notion of level in the name (make parent a reserved name) assert level in ['sibling', 'parent'] # 1) find the system: if level == 'parent': syst = self.parent assert self.parent.name == s_name elif level == 'sibling': syst = self.parent.subsystems_dict[s_name] port = syst.ports_dict[p_name] self.connect_port(port, level) def __repr__(self): cls_name = self.__class__.__name__ s = '{:s}({:s}, {:s})'.format(cls_name, repr(self.name), repr(self.type)) return s def _is_similar(self, other): '''Wires are *similar* if their class, `type` and `name` are equal and if their connectivity (`ports_by_name`) is the same (their parent system are not compared) ''' if not isinstance(other, Wire): return NotImplemented return self.__class__ == other.__class__ and \ self.type == other.type and \ self.name == other.name and \ self.ports_by_name == other.ports_by_name def _to_json(self): '''convert the Wire instance to a JSON-serializable object Wires are serialized with the port connectivity in tuples (but parent relationship is not serialized) ''' cls_name = self.__module__ +'.'+ self.__class__.__name__ return {'__sysdiagclass__': 'Wire', '__class__': cls_name, 'name': self.name, 'type': self.type, 'ports': self.ports_by_name } # end _to_json class SignalWire(Wire): '''Signal Wire for the interconnection of several Systems through their Input and Output Ports. Each SignalWire can be connected to a unique Output Port (signal source) and several Input Ports (signal sinks) ''' def __init__(self, name, wtype='', parent=None): super(SignalWire, self).__init__(name, wtype, parent) def is_connect_allowed(self, port, port_level, raise_error=False): '''Check that a connection between SignalWire ̀ self` and a Port `port` is allowed. Parameters ---------- `port`: the Port instance to connect to `port_level`: whether `port` belongs to a 'sibling' (usual case) or a 'parent' system (to enable connections to the upper level) `raise_error`: if True, raising an error replaces returning False Returns ------- allowed: True or False ''' if port.direction not in ['in', 'out']: if raise_error: raise TypeError('Only Input/Output Port can be connected!') else: return False def is_output(port, level): '''an output port is either: * a sibling system'port with direction == 'out' or * a parent system'port with direction == 'in' ''' if level=='detect': wire = self if wire.parent == port.system: level = 'parent' elif wire.parent == port.system.parent: level = 'sibling' else: raise ValueError('Port is neither sibling nor parent') is_out = (level=='sibling' and port.direction == 'out') or \ (level=='parent' and port.direction == 'in') return is_out # Now we have an I/O Port for sure: if is_output(port, port_level): # check that there is not already a signal source other_ports = [p for p in self.ports if (is_output(p, 'detect') and p is not port)] if other_ports: if raise_error: raise ValueError('Only one output port can be connected!') else: return False # Now the I/O aspect is fine. Launch some further checks: return super(SignalWire, self).is_connect_allowed(port, port_level, raise_error) def connect_systems(source, dest, s_pname, d_pname, wire_cls=Wire): '''Connect systems `source` to `dest` using port names `s_pname` and `d_pname` with a wire of instance `wire_cls` (defaults to Wire) The wire is created if necessary Returns: the wire used for the connection ''' # 1) find the ports s_port = source.ports_dict[s_pname] d_port = dest.ports_dict[d_pname] # 2) find a prexisting wire: w = None if s_port.wire is not None: w = s_port.wire elif d_port.wire is not None: w = d_port.wire else: parent = s_port.system.parent wname = parent.create_name('wire','W') wtype = s_port.type w = wire_cls(wname, wtype, parent) # 3) Make the connection: w.connect_port(s_port) w.connect_port(d_port) return w def to_json(py_obj): '''convert `py_obj` to JSON-serializable objects `py_obj` should be an instance of `System`, `Wire` or `Port` ''' if isinstance(py_obj, System): return py_obj._to_json() if isinstance(py_obj, Wire): return py_obj._to_json() if isinstance(py_obj, Port): return py_obj._to_json() raise TypeError(repr(py_obj) + ' is not JSON serializable') # end to_json import sys def _str_to_class(mod_class): '''retreives the class from a "module.class" string''' mod_name, cls_name = mod_class.split('.') mod = sys.modules[mod_name] return getattr(mod, cls_name) def from_json(json_object): '''deserializes a sysdiag json object''' if '__sysdiagclass__' in json_object: cls = _str_to_class(json_object['__class__']) if json_object['__sysdiagclass__'] == 'Port': port = cls(name = json_object['name'], ptype = json_object['type']) return port if json_object['__sysdiagclass__'] == 'System': # TODO: specialize the instanciation for each class using # _from_json class methods syst = cls(name = json_object['name']) syst.params = json_object['params'] # add ports if any: for p in json_object['ports']: syst.add_port(p) # add subsystems for s in json_object['subsystems']: syst.add_subsystem(s) # add wires for w_dict in json_object['wires']: # 1) decode the wire: w_cls = _str_to_class(w_dict['__class__']) w = w_cls(name = w_dict['name'], wtype = w_dict['type']) syst.add_wire(w) # make the connections: for level, s_name, p_name in w_dict['ports']: w.connect_by_name(s_name, p_name, level) # end for each wire return syst return json_object def json_load(json_dump): import json syst = json.loads(json_dump, object_hook=from_json) return syst
pierre-haessig/sysdiag
sysdiag.py
Python
mit
21,428
0.007049
from .base import DebugPanel from ..utils import STATIC_ROUTE_NAME __all__ = ['MiddlewaresDebugPanel'] class MiddlewaresDebugPanel(DebugPanel): """ A panel to display the middlewares used by your aiohttp application. """ name = 'Middlewares' has_content = True template = 'middlewares.jinja2' title = 'Middlewares' nav_title = title def __init__(self, request): super().__init__(request) if not request.app.middlewares: self.has_content = False self.is_active = False else: self.populate(request) def populate(self, request): middleware_names = [] for m in request.app.middlewares: if hasattr(m, '__name__'): # name for regular functions middleware_names.append(m.__name__) else: middleware_names.append(m.__repr__()) self.data = {'middlewares': middleware_names} def render_vars(self, request): static_path = self._request.app.router[STATIC_ROUTE_NAME]\ .url(filename='') return {'static_path': static_path}
realer01/aiohttp-debugtoolbar
aiohttp_debugtoolbar/panels/middlewares.py
Python
apache-2.0
1,143
0
"""Filters allows to match the output against a regex and use the match for statistic purpose.""" import re import typing from lib_hook.auto_number import AutoNumber from .stage import Str_to_stage, Stage class InvalidStage(Exception): """A filter was applied at a wrong stage.""" pass class FilterMode(AutoNumber): """Whether the filter should use lookaroung regex or extract the match thanks to groups.""" LookAround = () Groups = () class Filter: """The Filter class contains everyting about a filter and is made to look into output and returns the match with the right type.""" def __init__(self, data): self.name = data["name"] self.regex = re.compile(data["pattern"]) self.mode = FilterMode.Groups if data["mode"] == "group" else FilterMode.LookAround self.group = data["group"] if self.mode == FilterMode.Groups else None self.stages = [Str_to_stage(e) for e in data["stages"]] self.type = {"bool": bool, "int": int, "float": float, "string": str}[data["type"]] self.summary = data["summary"] def search(self, output: str, stage: Stage) -> typing.Union[bool, int, float, str, None]: """Looks for a match in the given string and returns the match. If the filter does not match, return None.""" if stage not in self.stages: return None match = self.regex.search(output) if match is None: return None if self.mode == FilterMode.Groups: return self.type(match.group(self.group)) return self.type(match.group(0))
s-i-newton/clang-hook
lib_hook/filter.py
Python
apache-2.0
1,601
0.004372
#!/usr/bin/python import sys from klampt import * from klampt.vis import GLSimulationProgram class MyGLViewer(GLSimulationProgram): def __init__(self,files): #create a world from the given files world = WorldModel() for fn in files: res = world.readFile(fn) if not res: raise RuntimeError("Unable to load model "+fn) #initialize the simulation GLSimulationProgram.__init__(self,world,"My GL program") #put custom action hooks here self.add_action(self.some_function,'Some random function','f') def some_function(self): print "The function is called" def control_loop(self): #Put your control handler here pass def mousefunc(self,button,state,x,y): #Put your mouse handler here #the current example prints out the list of objects clicked whenever #you right click print "mouse",button,state,x,y if button==2: if state==0: print [o.getName() for o in self.click_world(x,y)] return GLSimulationProgram.mousefunc(self,button,state,x,y) def motionfunc(self,x,y,dx,dy): return GLSimulationProgram.motionfunc(self,x,y,dx,dy) if __name__ == "__main__": print "gltemplate.py: This example demonstrates how to simulate a world and read user input" if len(sys.argv)<=1: print "USAGE: gltemplate.py [world_file]" exit() viewer = MyGLViewer(sys.argv[1:]) viewer.run()
YilunZhou/Klampt
Python/demos/gltemplate.py
Python
bsd-3-clause
1,532
0.02611
from typing import Any, Dict, List, Union from flask import abort, flash, g, render_template, url_for from flask_babel import format_number, lazy_gettext as _ from werkzeug.utils import redirect from werkzeug.wrappers import Response from openatlas import app from openatlas.database.connect import Transaction from openatlas.forms.form import build_move_form from openatlas.models.entity import Entity from openatlas.models.node import Node from openatlas.util.table import Table from openatlas.util.util import link, required_group, sanitize def walk_tree(nodes: List[int]) -> List[Dict[str, Any]]: items = [] for id_ in nodes: item = g.nodes[id_] count_subs = f' ({format_number(item.count_subs)})' \ if item.count_subs else '' items.append({ 'id': item.id, 'href': url_for('entity_view', id_=item.id), 'a_attr': {'href': url_for('entity_view', id_=item.id)}, 'text': item.name.replace("'", "&apos;") + f' {format_number(item.count)}{count_subs}', 'children': walk_tree(item.subs)}) return items @app.route('/types') @required_group('readonly') def node_index() -> str: nodes: Dict[str, Dict[Entity, str]] = \ {'standard': {}, 'custom': {}, 'places': {}, 'value': {}} for node in g.nodes.values(): if node.root: continue type_ = 'custom' if node.class_.name == 'administrative_unit': type_ = 'places' elif node.standard: type_ = 'standard' elif node.value_type: type_ = 'value' nodes[type_][node] = render_template( 'forms/tree_select_item.html', name=sanitize(node.name), data=walk_tree(Node.get_nodes(node.name))) return render_template( 'types/index.html', nodes=nodes, title=_('types'), crumbs=[_('types')]) @app.route('/types/delete/<int:id_>', methods=['POST', 'GET']) @required_group('editor') def node_delete(id_: int) -> Response: node = g.nodes[id_] root = g.nodes[node.root[-1]] if node.root else None if node.standard or node.subs or node.count or (root and root.locked): abort(403) node.delete() flash(_('entity deleted'), 'info') return redirect( url_for('entity_view', id_=root.id) if root else url_for('node_index')) @app.route('/types/move/<int:id_>', methods=['POST', 'GET']) @required_group('editor') def node_move_entities(id_: int) -> Union[str, Response]: node = g.nodes[id_] root = g.nodes[node.root[-1]] if root.value_type: # pragma: no cover abort(403) form = build_move_form(node) if form.validate_on_submit(): Transaction.begin() Node.move_entities( node, getattr(form, str(root.id)).data, form.checkbox_values.data) Transaction.commit() flash(_('Entities were updated'), 'success') if node.class_.name == 'administrative_unit': tab = 'places' elif root.standard: tab = 'standard' elif node.value_type: # pragma: no cover tab = 'value' else: tab = 'custom' return redirect( f"{url_for('node_index')}#menu-tab-{tab}_collapse-{root.id}") getattr(form, str(root.id)).data = node.id return render_template( 'types/move.html', table=Table( header=['#', _('selection')], rows=[[item, item.label.text] for item in form.selection]), root=root, form=form, entity=node, crumbs=[ [_('types'), url_for('node_index')], root, node, _('move entities')]) @app.route('/types/untyped/<int:id_>') @required_group('editor') def show_untyped_entities(id_: int) -> str: hierarchy = g.nodes[id_] table = Table(['name', 'class', 'first', 'last', 'description']) for entity in Node.get_untyped(hierarchy.id): table.rows.append([ link(entity), entity.class_.label, entity.first, entity.last, entity.description]) return render_template( 'table.html', entity=hierarchy, table=table, crumbs=[ [_('types'), url_for('node_index')], link(hierarchy), _('untyped entities')])
craws/OpenAtlas-Python
openatlas/views/types.py
Python
gpl-2.0
4,440
0
from .sizedist import * from .WD01 import make_WD01_DustSpectrum
eblur/dust
astrodust/distlib/__init__.py
Python
bsd-2-clause
67
0
from relation_iterator import RelationIterator from true_expression import TrueExpression from operation_status import OperationStatus from data_input_stream import DataInputStream from insert_row import InsertRow from column import Column import simple_dbms class TableIterator(RelationIterator, object): """ A class that serves as an iterator over some or all of the rows in a stored table. For a given table, there may be more than one TableIterator open at the same time -- for example, when performing the cross product of a table with itself. """ def __init__(self, stmt, table, eval_where): """ Constructs a TableIterator object for the subset of the specified table that is defined by the given SQLStatement. If the SQLStatement has a WHERE clause and the evalWhere parameter has a value of true, the iterator will only visit rows that satisfy the WHERE clause. :param stmt: the SQL statement that defines the subset of the table :param table: the table to iterate over :param eval_where: should the WHERE clause in stmt be evaluated by this iterator? If this iterator is being used by a higher-level iterator, then we can specify false so that the WHERE clause will not be evaluated at this level. """ super(TableIterator, self).__init__() self.table = table # Make sure the table is open. if table.get_db() is None: raise Exception("table " + table.get_name() + " must be " + "opened before attempting to create an iterator for it") # Find all columns from the SQL statement whose values will # be obtained using this table iterator, and update their # state so that we can get their values as needed. table_col = stmt_col = None for i in range(0, table.num_columns()): table_col = table.get_column(i) # check for a match in the SELECT clause for j in range(0, stmt.num_columns()): stmt_col = stmt.get_column(j) if stmt_col.name_matches(table_col, table): stmt_col.use_col_info(table_col) stmt_col.set_table_iterator(self) # check for a match in the WHERE clause for j in range(0, stmt.num_where_columns()): stmt_col = stmt.get_where_column(j) if stmt_col.name_matches(table_col, table): stmt_col.use_col_info(table_col) stmt_col.set_table_iterator(self) self.cursor = table.get_db().cursor(txn=simple_dbms.SimpleDBMS.get_txn(), flags=0) self.key = None self.data = None self.where = stmt.get_where() if not eval_where: self.where = None if self.where is None: self.where = TrueExpression() self.num_tuples = 0 def close(self): """ Closes the iterator, which closes any BDB handles that it is using. :return: """ if self.cursor is not None: self.cursor.close() self.cursor = None def first(self): """ Positions the iterator on the first tuple in the relation, without taking the a WHERE clause (if any) into effect. Because this method ignores the WHERE clause, it should ordinarily be used only when you need to reposition the cursor at the start of the relation after having completed a previous iteration. :return: true if the iterator was advanced to the first tuple, and false if there are no tuples to visit """ if self.cursor is None: raise Exception("This iterator has been closed") ret = self.cursor.first() # this.cursor.getFirst(this.key, this.data, null); if ret == OperationStatus.NOTFOUND: return False # Only increment num_tuples if the WHERE clause isn't violated. if self.where.is_true(): self.num_tuples += 1 return True def next(self): """ Advances the iterator to the next tuple in the relation. If there is a WHERE clause that limits which tuples should be included in the relation, this method will advance the iterator to the next tuple that satisfies the WHERE clause. If the iterator is newly created, this method will position it on the first tuple in the relation (that satisfies the WHERE clause). Provided that the iterator can be positioned on a tuple, the count of the number of tuples visited by the iterator is incremented. :return: true if the iterator was advanced to a new tuple, and false if there are no more tuples to visit """ if self.cursor is None: raise Exception("this iterator has been closed") ret = self.cursor.next() if ret is None: return False self.key = ret[0] self.data = ret[1] while not self.where.is_true(): ret = self.cursor.next() if ret is None: return False self.key = ret[0] self.data = ret[1] self.num_tuples += 1 return True def get_column(self, col_index): """ Gets the column at the specified index in the relation that this iterator iterates over. The leftmost column has an index of 0. :param col_index: :return: the column """ return self.table.get_column(col_index) def get_column_val(self, col_index): """ Gets the value of the column at the specified index in the row on which this iterator is currently positioned. The leftmost column has an index of 0. This method will unmarshall the relevant bytes from the key/data pair and return the corresponding Object -- i.e., an object of type String for CHAR and VARCHAR values, an object of type Integer for INTEGER values, or an object of type Double for REAL values. :param col_index: :return: the value of the column """ # Get the specified column and its type. col = self.table.get_column(col_index) col_type = col.get_type() # Create an input stream for the data item in the # current key/data pair, and mark the beginning of its buffer. data_in = DataInputStream(self.data) # Read the appropriate offset from the table of offsets, # and handle null values. offset_offset = col_index * 4 # the offset of the offset! data_in.skip(offset_offset) offset = data_in.read_int() if offset == InsertRow.IS_NULL: return None # Prepare the appropriate TupleInput object (for either the # key or the data item), and make the variable "in" refer # to that object. We also determine the size of the value. din = None size = -1 if offset == InsertRow.IS_PKEY: din = DataInputStream(self.key) size = len(self.key) else: din = data_in if col_type == Column.VARCHAR: # Get the next positive offset from the data item, # so we can compute the size of the VARCHAR in bytes. # We need a loop so that we can skip over special offsets # for null values and primary keys. next_offset = data_in.read_int() while next_offset == InsertRow.IS_PKEY or next_offset == InsertRow.IS_NULL: next_offset = data_in.read_int() size = next_offset - offset else: size = col.get_length() # Skip to the appropriate place in the data item. # We do this *after* we read all necessary offsets. din.reset() din.skip(offset) # Read the value, and return it as an object of the # appropriate type. if col_type == Column.INTEGER: return din.read_int() elif col_type == Column.REAL: return din.read_float() else: # CHAR and VARCHAR if size == 0: return "" else: x = bytearray() for i in range(0, size): x.append( din.read_byte() ) return str(x) def update_row(self): """ # Updates the row on which the iterator is positioned, according to # the update values specified for the Column objects in the Table object # associated with this iterator. :return: """ # Not yet implemented pass def delete_row(self): """ Deletes the row on which the iterator is positioned. :return: """ # not yet implemented pass def get_num_tuples(self): return self.num_tuples def get_num_columns(self): return self.table.num_columns()
nddsg/SimpleDBMS
simple_dbms/table_iterator.py
Python
gpl-3.0
9,205
0.000869
from ulp.urlextract import escape_ansi, parse_input import os TEST_DIR = os.path.dirname(os.path.realpath(__file__)) def test_parse_no_url_input(): assert len(parse_input("")) == 0 multiline_text = """ text without URLs and multiple lines """ assert len(parse_input(multiline_text)) == 0 def test_extract_one_url(): with open(os.path.join(TEST_DIR, 'example_bitbucket.txt')) as f: result = parse_input(f.read()) assert len(result) == 1 assert result[0] == 'https://bitbucket.org/owner/repository/pull-requests/new?source=BRANCH&t=1' def test_extract_multiple_urls_per_line(): input_text = """ two urls https://example.org/?q=1 https://example.org/?p=2 on the same line""" result = parse_input(input_text) assert len(result) == 2 assert 'https://example.org/?q=1' in result assert 'https://example.org/?p=2' in result def test_escape_ansi_sequence_url(): with open(os.path.join(TEST_DIR, 'example_terminal_colors.txt')) as f: result = parse_input(f.read()) assert len(result) == 2 assert 'https://example.org/?p=3707' in result assert 'https://example.org/anotherurl?q=0m' in result
victal/ulp
test/test_urlextract.py
Python
mit
1,212
0.00495
from flask import Flask from flask import request from subprocess import call import git, json, os, sys newname = "gitlistener" from ctypes import cdll, byref, create_string_buffer libc = cdll.LoadLibrary('libc.so.6') #Loading a 3rd party library C buff = create_string_buffer(len(newname)+1) #Note: One larger than the name (man prctl says that) buff.value = newname #Null terminated string as it should be libc.prctl(15, byref(buff), 0, 0, 0) #Refer to "#define" of "/usr/include/linux/prctl.h" for the misterious value 16 & arg[3..5] are zero as the man page says. app = Flask(__name__) @app.route("/", methods=['POST']) def index(): if request.method == 'POST': repo = git.Repo('/var/www/lunch_app') print repo.git.status() print repo.git.pull() f = open("keyfile.txt") pw = f.read() os.popen("sudo service apache2 reload", "w").write(pw) else: print "Wrong" return "Ran" if __name__ == "__main__": app.run(host='0.0.0.0',port=5001)
WilliamMarti/gitlistener
gitlistener.py
Python
mit
1,001
0.02997
# coding: utf-8 from smartbot import Behaviour from smartbot import Utils from smartbot import ExternalAPI import re import os import random class JokeBehaviour(Behaviour): def __init__(self, bot): super(JokeBehaviour, self).__init__(bot) self.language = self.bot.config.get('main', 'language') if self.bot.config.has_option('main', 'language') else 'en-US' def addHandlers(self): self.bot.addCommandHandler('joke', self.jokeSearch) self.bot.addCommandHandler('jalk', self.jalkSearch) def removeHandlers(self): self.bot.removeCommandHandler('joke', self.jokeSearch) self.bot.removeCommandHandler('jalk', self.jalkSearch) def jokeSearch(self, telegramBot, update): p = re.compile('([^ ]*) (.*)') query = (p.match(update.message.text).groups()[1] or '').strip() self.logDebug(u'Joke search (chat_id: %s, query: %s)' % (update.message.chat_id, query or 'None')) jokes = ExternalAPI.searchJoke(query) if jokes: self.bot.sendMessage(chat_id=update.message.chat_id, text=random.choice(jokes)) def jalkSearch(self, telegramBot, update): p = re.compile('([^ ]*) (.*)') query = (p.match(update.message.text).groups()[1] or '').strip() self.logDebug(u'Jalk search (chat_id: %s, query: %s)' % (update.message.chat_id, query or 'None')) jokes = ExternalAPI.searchJoke(query) if jokes: jokes = filter(lambda c: len(re.split('\W+', c, re.MULTILINE)) < 200, jokes) jokes = sorted(jokes, lambda x, y: len(x) - len(y)) if jokes: joke = jokes[0] audioFile = ExternalAPI.textToSpeech(joke, language=self.language, encode='mp3') if os.path.exists(audioFile) and os.path.getsize(audioFile) > 0: self.bot.sendAudio(chat_id=update.message.chat_id, audio=audioFile, performer=self.bot.getInfo().username) else: self.bot.sendMessage(chat_id=update.message.chat_id, text=u'Não consigo contar') else: self.bot.sendMessage(chat_id=update.message.chat_id, text=u'Não encontrei piada curta')
pedrohml/smartbot
smartbot/joke_behaviour.py
Python
mit
2,199
0.005462
class Solution: def trailingZeroes(self, n: int) -> int: powers_of_5 = [] for i in range(1, 10): powers_of_5.append(5 ** i) return sum(n // power_of_5 for power_of_5 in powers_of_5)
1337/yesterday-i-learned
leetcode/172e.py
Python
gpl-3.0
222
0
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.core.exceptions import HttpResponseError import msrest.serialization class AadAuthenticationParameters(msrest.serialization.Model): """AAD Vpn authentication type related parameters. :param aad_tenant: AAD Vpn authentication parameter AAD tenant. :type aad_tenant: str :param aad_audience: AAD Vpn authentication parameter AAD audience. :type aad_audience: str :param aad_issuer: AAD Vpn authentication parameter AAD issuer. :type aad_issuer: str """ _attribute_map = { 'aad_tenant': {'key': 'aadTenant', 'type': 'str'}, 'aad_audience': {'key': 'aadAudience', 'type': 'str'}, 'aad_issuer': {'key': 'aadIssuer', 'type': 'str'}, } def __init__( self, **kwargs ): super(AadAuthenticationParameters, self).__init__(**kwargs) self.aad_tenant = kwargs.get('aad_tenant', None) self.aad_audience = kwargs.get('aad_audience', None) self.aad_issuer = kwargs.get('aad_issuer', None) class AddressSpace(msrest.serialization.Model): """AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network. :param address_prefixes: A list of address blocks reserved for this virtual network in CIDR notation. :type address_prefixes: list[str] """ _attribute_map = { 'address_prefixes': {'key': 'addressPrefixes', 'type': '[str]'}, } def __init__( self, **kwargs ): super(AddressSpace, self).__init__(**kwargs) self.address_prefixes = kwargs.get('address_prefixes', None) class Resource(msrest.serialization.Model): """Common resource representation. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__( self, **kwargs ): super(Resource, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = None self.type = None self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) class ApplicationGateway(Resource): """Application gateway resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param zones: A list of availability zones denoting where the resource needs to come from. :type zones: list[str] :param identity: The identity of the application gateway, if configured. :type identity: ~azure.mgmt.network.v2020_04_01.models.ManagedServiceIdentity :param sku: SKU of the application gateway resource. :type sku: ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySku :param ssl_policy: SSL policy of the application gateway resource. :type ssl_policy: ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySslPolicy :ivar operational_state: Operational state of the application gateway resource. Possible values include: "Stopped", "Starting", "Running", "Stopping". :vartype operational_state: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayOperationalState :param gateway_ip_configurations: Subnets of the application gateway resource. For default limits, see `Application Gateway limits <https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits>`_. :type gateway_ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayIPConfiguration] :param authentication_certificates: Authentication certificates of the application gateway resource. For default limits, see `Application Gateway limits <https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits>`_. :type authentication_certificates: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayAuthenticationCertificate] :param trusted_root_certificates: Trusted Root certificates of the application gateway resource. For default limits, see `Application Gateway limits <https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits>`_. :type trusted_root_certificates: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayTrustedRootCertificate] :param ssl_certificates: SSL certificates of the application gateway resource. For default limits, see `Application Gateway limits <https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits>`_. :type ssl_certificates: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySslCertificate] :param frontend_ip_configurations: Frontend IP addresses of the application gateway resource. For default limits, see `Application Gateway limits <https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits>`_. :type frontend_ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayFrontendIPConfiguration] :param frontend_ports: Frontend ports of the application gateway resource. For default limits, see `Application Gateway limits <https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits>`_. :type frontend_ports: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayFrontendPort] :param probes: Probes of the application gateway resource. :type probes: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayProbe] :param backend_address_pools: Backend address pool of the application gateway resource. For default limits, see `Application Gateway limits <https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits>`_. :type backend_address_pools: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayBackendAddressPool] :param backend_http_settings_collection: Backend http settings of the application gateway resource. For default limits, see `Application Gateway limits <https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits>`_. :type backend_http_settings_collection: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayBackendHttpSettings] :param http_listeners: Http listeners of the application gateway resource. For default limits, see `Application Gateway limits <https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits>`_. :type http_listeners: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayHttpListener] :param url_path_maps: URL path map of the application gateway resource. For default limits, see `Application Gateway limits <https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits>`_. :type url_path_maps: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayUrlPathMap] :param request_routing_rules: Request routing rules of the application gateway resource. :type request_routing_rules: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayRequestRoutingRule] :param rewrite_rule_sets: Rewrite rules for the application gateway resource. :type rewrite_rule_sets: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayRewriteRuleSet] :param redirect_configurations: Redirect configurations of the application gateway resource. For default limits, see `Application Gateway limits <https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits>`_. :type redirect_configurations: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayRedirectConfiguration] :param web_application_firewall_configuration: Web application firewall configuration. :type web_application_firewall_configuration: ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayWebApplicationFirewallConfiguration :param firewall_policy: Reference to the FirewallPolicy resource. :type firewall_policy: ~azure.mgmt.network.v2020_04_01.models.SubResource :param enable_http2: Whether HTTP2 is enabled on the application gateway resource. :type enable_http2: bool :param enable_fips: Whether FIPS is enabled on the application gateway resource. :type enable_fips: bool :param autoscale_configuration: Autoscale Configuration. :type autoscale_configuration: ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayAutoscaleConfiguration :ivar resource_guid: The resource GUID property of the application gateway resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the application gateway resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param custom_error_configurations: Custom error configurations of the application gateway resource. :type custom_error_configurations: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayCustomError] :param force_firewall_policy_association: If true, associates a firewall policy with an application gateway regardless whether the policy differs from the WAF Config. :type force_firewall_policy_association: bool """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'operational_state': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'zones': {'key': 'zones', 'type': '[str]'}, 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'sku': {'key': 'properties.sku', 'type': 'ApplicationGatewaySku'}, 'ssl_policy': {'key': 'properties.sslPolicy', 'type': 'ApplicationGatewaySslPolicy'}, 'operational_state': {'key': 'properties.operationalState', 'type': 'str'}, 'gateway_ip_configurations': {'key': 'properties.gatewayIPConfigurations', 'type': '[ApplicationGatewayIPConfiguration]'}, 'authentication_certificates': {'key': 'properties.authenticationCertificates', 'type': '[ApplicationGatewayAuthenticationCertificate]'}, 'trusted_root_certificates': {'key': 'properties.trustedRootCertificates', 'type': '[ApplicationGatewayTrustedRootCertificate]'}, 'ssl_certificates': {'key': 'properties.sslCertificates', 'type': '[ApplicationGatewaySslCertificate]'}, 'frontend_ip_configurations': {'key': 'properties.frontendIPConfigurations', 'type': '[ApplicationGatewayFrontendIPConfiguration]'}, 'frontend_ports': {'key': 'properties.frontendPorts', 'type': '[ApplicationGatewayFrontendPort]'}, 'probes': {'key': 'properties.probes', 'type': '[ApplicationGatewayProbe]'}, 'backend_address_pools': {'key': 'properties.backendAddressPools', 'type': '[ApplicationGatewayBackendAddressPool]'}, 'backend_http_settings_collection': {'key': 'properties.backendHttpSettingsCollection', 'type': '[ApplicationGatewayBackendHttpSettings]'}, 'http_listeners': {'key': 'properties.httpListeners', 'type': '[ApplicationGatewayHttpListener]'}, 'url_path_maps': {'key': 'properties.urlPathMaps', 'type': '[ApplicationGatewayUrlPathMap]'}, 'request_routing_rules': {'key': 'properties.requestRoutingRules', 'type': '[ApplicationGatewayRequestRoutingRule]'}, 'rewrite_rule_sets': {'key': 'properties.rewriteRuleSets', 'type': '[ApplicationGatewayRewriteRuleSet]'}, 'redirect_configurations': {'key': 'properties.redirectConfigurations', 'type': '[ApplicationGatewayRedirectConfiguration]'}, 'web_application_firewall_configuration': {'key': 'properties.webApplicationFirewallConfiguration', 'type': 'ApplicationGatewayWebApplicationFirewallConfiguration'}, 'firewall_policy': {'key': 'properties.firewallPolicy', 'type': 'SubResource'}, 'enable_http2': {'key': 'properties.enableHttp2', 'type': 'bool'}, 'enable_fips': {'key': 'properties.enableFips', 'type': 'bool'}, 'autoscale_configuration': {'key': 'properties.autoscaleConfiguration', 'type': 'ApplicationGatewayAutoscaleConfiguration'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'custom_error_configurations': {'key': 'properties.customErrorConfigurations', 'type': '[ApplicationGatewayCustomError]'}, 'force_firewall_policy_association': {'key': 'properties.forceFirewallPolicyAssociation', 'type': 'bool'}, } def __init__( self, **kwargs ): super(ApplicationGateway, self).__init__(**kwargs) self.etag = None self.zones = kwargs.get('zones', None) self.identity = kwargs.get('identity', None) self.sku = kwargs.get('sku', None) self.ssl_policy = kwargs.get('ssl_policy', None) self.operational_state = None self.gateway_ip_configurations = kwargs.get('gateway_ip_configurations', None) self.authentication_certificates = kwargs.get('authentication_certificates', None) self.trusted_root_certificates = kwargs.get('trusted_root_certificates', None) self.ssl_certificates = kwargs.get('ssl_certificates', None) self.frontend_ip_configurations = kwargs.get('frontend_ip_configurations', None) self.frontend_ports = kwargs.get('frontend_ports', None) self.probes = kwargs.get('probes', None) self.backend_address_pools = kwargs.get('backend_address_pools', None) self.backend_http_settings_collection = kwargs.get('backend_http_settings_collection', None) self.http_listeners = kwargs.get('http_listeners', None) self.url_path_maps = kwargs.get('url_path_maps', None) self.request_routing_rules = kwargs.get('request_routing_rules', None) self.rewrite_rule_sets = kwargs.get('rewrite_rule_sets', None) self.redirect_configurations = kwargs.get('redirect_configurations', None) self.web_application_firewall_configuration = kwargs.get('web_application_firewall_configuration', None) self.firewall_policy = kwargs.get('firewall_policy', None) self.enable_http2 = kwargs.get('enable_http2', None) self.enable_fips = kwargs.get('enable_fips', None) self.autoscale_configuration = kwargs.get('autoscale_configuration', None) self.resource_guid = None self.provisioning_state = None self.custom_error_configurations = kwargs.get('custom_error_configurations', None) self.force_firewall_policy_association = kwargs.get('force_firewall_policy_association', None) class SubResource(msrest.serialization.Model): """Reference to another subresource. :param id: Resource ID. :type id: str """ _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, **kwargs ): super(SubResource, self).__init__(**kwargs) self.id = kwargs.get('id', None) class ApplicationGatewayAuthenticationCertificate(SubResource): """Authentication certificates of an application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the authentication certificate that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param data: Certificate public data. :type data: str :ivar provisioning_state: The provisioning state of the authentication certificate resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'data': {'key': 'properties.data', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayAuthenticationCertificate, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.data = kwargs.get('data', None) self.provisioning_state = None class ApplicationGatewayAutoscaleConfiguration(msrest.serialization.Model): """Application Gateway autoscale configuration. All required parameters must be populated in order to send to Azure. :param min_capacity: Required. Lower bound on number of Application Gateway capacity. :type min_capacity: int :param max_capacity: Upper bound on number of Application Gateway capacity. :type max_capacity: int """ _validation = { 'min_capacity': {'required': True, 'minimum': 0}, 'max_capacity': {'minimum': 2}, } _attribute_map = { 'min_capacity': {'key': 'minCapacity', 'type': 'int'}, 'max_capacity': {'key': 'maxCapacity', 'type': 'int'}, } def __init__( self, **kwargs ): super(ApplicationGatewayAutoscaleConfiguration, self).__init__(**kwargs) self.min_capacity = kwargs['min_capacity'] self.max_capacity = kwargs.get('max_capacity', None) class ApplicationGatewayAvailableSslOptions(Resource): """Response for ApplicationGatewayAvailableSslOptions API service call. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param predefined_policies: List of available Ssl predefined policy. :type predefined_policies: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :param default_policy: Name of the Ssl predefined policy applied by default to application gateway. Possible values include: "AppGwSslPolicy20150501", "AppGwSslPolicy20170401", "AppGwSslPolicy20170401S". :type default_policy: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySslPolicyName :param available_cipher_suites: List of available Ssl cipher suites. :type available_cipher_suites: list[str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySslCipherSuite] :param available_protocols: List of available Ssl protocols. :type available_protocols: list[str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySslProtocol] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'predefined_policies': {'key': 'properties.predefinedPolicies', 'type': '[SubResource]'}, 'default_policy': {'key': 'properties.defaultPolicy', 'type': 'str'}, 'available_cipher_suites': {'key': 'properties.availableCipherSuites', 'type': '[str]'}, 'available_protocols': {'key': 'properties.availableProtocols', 'type': '[str]'}, } def __init__( self, **kwargs ): super(ApplicationGatewayAvailableSslOptions, self).__init__(**kwargs) self.predefined_policies = kwargs.get('predefined_policies', None) self.default_policy = kwargs.get('default_policy', None) self.available_cipher_suites = kwargs.get('available_cipher_suites', None) self.available_protocols = kwargs.get('available_protocols', None) class ApplicationGatewayAvailableSslPredefinedPolicies(msrest.serialization.Model): """Response for ApplicationGatewayAvailableSslOptions API service call. :param value: List of available Ssl predefined policy. :type value: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySslPredefinedPolicy] :param next_link: URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ApplicationGatewaySslPredefinedPolicy]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayAvailableSslPredefinedPolicies, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ApplicationGatewayAvailableWafRuleSetsResult(msrest.serialization.Model): """Response for ApplicationGatewayAvailableWafRuleSets API service call. :param value: The list of application gateway rule sets. :type value: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayFirewallRuleSet] """ _attribute_map = { 'value': {'key': 'value', 'type': '[ApplicationGatewayFirewallRuleSet]'}, } def __init__( self, **kwargs ): super(ApplicationGatewayAvailableWafRuleSetsResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) class ApplicationGatewayBackendAddress(msrest.serialization.Model): """Backend address of an application gateway. :param fqdn: Fully qualified domain name (FQDN). :type fqdn: str :param ip_address: IP address. :type ip_address: str """ _attribute_map = { 'fqdn': {'key': 'fqdn', 'type': 'str'}, 'ip_address': {'key': 'ipAddress', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayBackendAddress, self).__init__(**kwargs) self.fqdn = kwargs.get('fqdn', None) self.ip_address = kwargs.get('ip_address', None) class ApplicationGatewayBackendAddressPool(SubResource): """Backend Address Pool of an application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the backend address pool that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :ivar backend_ip_configurations: Collection of references to IPs defined in network interfaces. :vartype backend_ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.NetworkInterfaceIPConfiguration] :param backend_addresses: Backend addresses. :type backend_addresses: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayBackendAddress] :ivar provisioning_state: The provisioning state of the backend address pool resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'backend_ip_configurations': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'backend_ip_configurations': {'key': 'properties.backendIPConfigurations', 'type': '[NetworkInterfaceIPConfiguration]'}, 'backend_addresses': {'key': 'properties.backendAddresses', 'type': '[ApplicationGatewayBackendAddress]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayBackendAddressPool, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.backend_ip_configurations = None self.backend_addresses = kwargs.get('backend_addresses', None) self.provisioning_state = None class ApplicationGatewayBackendHealth(msrest.serialization.Model): """Response for ApplicationGatewayBackendHealth API service call. :param backend_address_pools: A list of ApplicationGatewayBackendHealthPool resources. :type backend_address_pools: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayBackendHealthPool] """ _attribute_map = { 'backend_address_pools': {'key': 'backendAddressPools', 'type': '[ApplicationGatewayBackendHealthPool]'}, } def __init__( self, **kwargs ): super(ApplicationGatewayBackendHealth, self).__init__(**kwargs) self.backend_address_pools = kwargs.get('backend_address_pools', None) class ApplicationGatewayBackendHealthHttpSettings(msrest.serialization.Model): """Application gateway BackendHealthHttp settings. :param backend_http_settings: Reference to an ApplicationGatewayBackendHttpSettings resource. :type backend_http_settings: ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayBackendHttpSettings :param servers: List of ApplicationGatewayBackendHealthServer resources. :type servers: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayBackendHealthServer] """ _attribute_map = { 'backend_http_settings': {'key': 'backendHttpSettings', 'type': 'ApplicationGatewayBackendHttpSettings'}, 'servers': {'key': 'servers', 'type': '[ApplicationGatewayBackendHealthServer]'}, } def __init__( self, **kwargs ): super(ApplicationGatewayBackendHealthHttpSettings, self).__init__(**kwargs) self.backend_http_settings = kwargs.get('backend_http_settings', None) self.servers = kwargs.get('servers', None) class ApplicationGatewayBackendHealthOnDemand(msrest.serialization.Model): """Result of on demand test probe. :param backend_address_pool: Reference to an ApplicationGatewayBackendAddressPool resource. :type backend_address_pool: ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayBackendAddressPool :param backend_health_http_settings: Application gateway BackendHealthHttp settings. :type backend_health_http_settings: ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayBackendHealthHttpSettings """ _attribute_map = { 'backend_address_pool': {'key': 'backendAddressPool', 'type': 'ApplicationGatewayBackendAddressPool'}, 'backend_health_http_settings': {'key': 'backendHealthHttpSettings', 'type': 'ApplicationGatewayBackendHealthHttpSettings'}, } def __init__( self, **kwargs ): super(ApplicationGatewayBackendHealthOnDemand, self).__init__(**kwargs) self.backend_address_pool = kwargs.get('backend_address_pool', None) self.backend_health_http_settings = kwargs.get('backend_health_http_settings', None) class ApplicationGatewayBackendHealthPool(msrest.serialization.Model): """Application gateway BackendHealth pool. :param backend_address_pool: Reference to an ApplicationGatewayBackendAddressPool resource. :type backend_address_pool: ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayBackendAddressPool :param backend_http_settings_collection: List of ApplicationGatewayBackendHealthHttpSettings resources. :type backend_http_settings_collection: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayBackendHealthHttpSettings] """ _attribute_map = { 'backend_address_pool': {'key': 'backendAddressPool', 'type': 'ApplicationGatewayBackendAddressPool'}, 'backend_http_settings_collection': {'key': 'backendHttpSettingsCollection', 'type': '[ApplicationGatewayBackendHealthHttpSettings]'}, } def __init__( self, **kwargs ): super(ApplicationGatewayBackendHealthPool, self).__init__(**kwargs) self.backend_address_pool = kwargs.get('backend_address_pool', None) self.backend_http_settings_collection = kwargs.get('backend_http_settings_collection', None) class ApplicationGatewayBackendHealthServer(msrest.serialization.Model): """Application gateway backendhealth http settings. :param address: IP address or FQDN of backend server. :type address: str :param ip_configuration: Reference to IP configuration of backend server. :type ip_configuration: ~azure.mgmt.network.v2020_04_01.models.NetworkInterfaceIPConfiguration :param health: Health of backend server. Possible values include: "Unknown", "Up", "Down", "Partial", "Draining". :type health: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayBackendHealthServerHealth :param health_probe_log: Health Probe Log. :type health_probe_log: str """ _attribute_map = { 'address': {'key': 'address', 'type': 'str'}, 'ip_configuration': {'key': 'ipConfiguration', 'type': 'NetworkInterfaceIPConfiguration'}, 'health': {'key': 'health', 'type': 'str'}, 'health_probe_log': {'key': 'healthProbeLog', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayBackendHealthServer, self).__init__(**kwargs) self.address = kwargs.get('address', None) self.ip_configuration = kwargs.get('ip_configuration', None) self.health = kwargs.get('health', None) self.health_probe_log = kwargs.get('health_probe_log', None) class ApplicationGatewayBackendHttpSettings(SubResource): """Backend address pool settings of an application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the backend http settings that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param port: The destination port on the backend. :type port: int :param protocol: The protocol used to communicate with the backend. Possible values include: "Http", "Https". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayProtocol :param cookie_based_affinity: Cookie based affinity. Possible values include: "Enabled", "Disabled". :type cookie_based_affinity: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayCookieBasedAffinity :param request_timeout: Request timeout in seconds. Application Gateway will fail the request if response is not received within RequestTimeout. Acceptable values are from 1 second to 86400 seconds. :type request_timeout: int :param probe: Probe resource of an application gateway. :type probe: ~azure.mgmt.network.v2020_04_01.models.SubResource :param authentication_certificates: Array of references to application gateway authentication certificates. :type authentication_certificates: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :param trusted_root_certificates: Array of references to application gateway trusted root certificates. :type trusted_root_certificates: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :param connection_draining: Connection draining of the backend http settings resource. :type connection_draining: ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayConnectionDraining :param host_name: Host header to be sent to the backend servers. :type host_name: str :param pick_host_name_from_backend_address: Whether to pick host header should be picked from the host name of the backend server. Default value is false. :type pick_host_name_from_backend_address: bool :param affinity_cookie_name: Cookie name to use for the affinity cookie. :type affinity_cookie_name: str :param probe_enabled: Whether the probe is enabled. Default value is false. :type probe_enabled: bool :param path: Path which should be used as a prefix for all HTTP requests. Null means no path will be prefixed. Default value is null. :type path: str :ivar provisioning_state: The provisioning state of the backend HTTP settings resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'port': {'key': 'properties.port', 'type': 'int'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, 'cookie_based_affinity': {'key': 'properties.cookieBasedAffinity', 'type': 'str'}, 'request_timeout': {'key': 'properties.requestTimeout', 'type': 'int'}, 'probe': {'key': 'properties.probe', 'type': 'SubResource'}, 'authentication_certificates': {'key': 'properties.authenticationCertificates', 'type': '[SubResource]'}, 'trusted_root_certificates': {'key': 'properties.trustedRootCertificates', 'type': '[SubResource]'}, 'connection_draining': {'key': 'properties.connectionDraining', 'type': 'ApplicationGatewayConnectionDraining'}, 'host_name': {'key': 'properties.hostName', 'type': 'str'}, 'pick_host_name_from_backend_address': {'key': 'properties.pickHostNameFromBackendAddress', 'type': 'bool'}, 'affinity_cookie_name': {'key': 'properties.affinityCookieName', 'type': 'str'}, 'probe_enabled': {'key': 'properties.probeEnabled', 'type': 'bool'}, 'path': {'key': 'properties.path', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayBackendHttpSettings, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.port = kwargs.get('port', None) self.protocol = kwargs.get('protocol', None) self.cookie_based_affinity = kwargs.get('cookie_based_affinity', None) self.request_timeout = kwargs.get('request_timeout', None) self.probe = kwargs.get('probe', None) self.authentication_certificates = kwargs.get('authentication_certificates', None) self.trusted_root_certificates = kwargs.get('trusted_root_certificates', None) self.connection_draining = kwargs.get('connection_draining', None) self.host_name = kwargs.get('host_name', None) self.pick_host_name_from_backend_address = kwargs.get('pick_host_name_from_backend_address', None) self.affinity_cookie_name = kwargs.get('affinity_cookie_name', None) self.probe_enabled = kwargs.get('probe_enabled', None) self.path = kwargs.get('path', None) self.provisioning_state = None class ApplicationGatewayConnectionDraining(msrest.serialization.Model): """Connection draining allows open connections to a backend server to be active for a specified time after the backend server got removed from the configuration. All required parameters must be populated in order to send to Azure. :param enabled: Required. Whether connection draining is enabled or not. :type enabled: bool :param drain_timeout_in_sec: Required. The number of seconds connection draining is active. Acceptable values are from 1 second to 3600 seconds. :type drain_timeout_in_sec: int """ _validation = { 'enabled': {'required': True}, 'drain_timeout_in_sec': {'required': True, 'maximum': 3600, 'minimum': 1}, } _attribute_map = { 'enabled': {'key': 'enabled', 'type': 'bool'}, 'drain_timeout_in_sec': {'key': 'drainTimeoutInSec', 'type': 'int'}, } def __init__( self, **kwargs ): super(ApplicationGatewayConnectionDraining, self).__init__(**kwargs) self.enabled = kwargs['enabled'] self.drain_timeout_in_sec = kwargs['drain_timeout_in_sec'] class ApplicationGatewayCustomError(msrest.serialization.Model): """Customer error of an application gateway. :param status_code: Status code of the application gateway customer error. Possible values include: "HttpStatus403", "HttpStatus502". :type status_code: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayCustomErrorStatusCode :param custom_error_page_url: Error page URL of the application gateway customer error. :type custom_error_page_url: str """ _attribute_map = { 'status_code': {'key': 'statusCode', 'type': 'str'}, 'custom_error_page_url': {'key': 'customErrorPageUrl', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayCustomError, self).__init__(**kwargs) self.status_code = kwargs.get('status_code', None) self.custom_error_page_url = kwargs.get('custom_error_page_url', None) class ApplicationGatewayFirewallDisabledRuleGroup(msrest.serialization.Model): """Allows to disable rules within a rule group or an entire rule group. All required parameters must be populated in order to send to Azure. :param rule_group_name: Required. The name of the rule group that will be disabled. :type rule_group_name: str :param rules: The list of rules that will be disabled. If null, all rules of the rule group will be disabled. :type rules: list[int] """ _validation = { 'rule_group_name': {'required': True}, } _attribute_map = { 'rule_group_name': {'key': 'ruleGroupName', 'type': 'str'}, 'rules': {'key': 'rules', 'type': '[int]'}, } def __init__( self, **kwargs ): super(ApplicationGatewayFirewallDisabledRuleGroup, self).__init__(**kwargs) self.rule_group_name = kwargs['rule_group_name'] self.rules = kwargs.get('rules', None) class ApplicationGatewayFirewallExclusion(msrest.serialization.Model): """Allow to exclude some variable satisfy the condition for the WAF check. All required parameters must be populated in order to send to Azure. :param match_variable: Required. The variable to be excluded. :type match_variable: str :param selector_match_operator: Required. When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to. :type selector_match_operator: str :param selector: Required. When matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to. :type selector: str """ _validation = { 'match_variable': {'required': True}, 'selector_match_operator': {'required': True}, 'selector': {'required': True}, } _attribute_map = { 'match_variable': {'key': 'matchVariable', 'type': 'str'}, 'selector_match_operator': {'key': 'selectorMatchOperator', 'type': 'str'}, 'selector': {'key': 'selector', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayFirewallExclusion, self).__init__(**kwargs) self.match_variable = kwargs['match_variable'] self.selector_match_operator = kwargs['selector_match_operator'] self.selector = kwargs['selector'] class ApplicationGatewayFirewallRule(msrest.serialization.Model): """A web application firewall rule. All required parameters must be populated in order to send to Azure. :param rule_id: Required. The identifier of the web application firewall rule. :type rule_id: int :param description: The description of the web application firewall rule. :type description: str """ _validation = { 'rule_id': {'required': True}, } _attribute_map = { 'rule_id': {'key': 'ruleId', 'type': 'int'}, 'description': {'key': 'description', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayFirewallRule, self).__init__(**kwargs) self.rule_id = kwargs['rule_id'] self.description = kwargs.get('description', None) class ApplicationGatewayFirewallRuleGroup(msrest.serialization.Model): """A web application firewall rule group. All required parameters must be populated in order to send to Azure. :param rule_group_name: Required. The name of the web application firewall rule group. :type rule_group_name: str :param description: The description of the web application firewall rule group. :type description: str :param rules: Required. The rules of the web application firewall rule group. :type rules: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayFirewallRule] """ _validation = { 'rule_group_name': {'required': True}, 'rules': {'required': True}, } _attribute_map = { 'rule_group_name': {'key': 'ruleGroupName', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'rules': {'key': 'rules', 'type': '[ApplicationGatewayFirewallRule]'}, } def __init__( self, **kwargs ): super(ApplicationGatewayFirewallRuleGroup, self).__init__(**kwargs) self.rule_group_name = kwargs['rule_group_name'] self.description = kwargs.get('description', None) self.rules = kwargs['rules'] class ApplicationGatewayFirewallRuleSet(Resource): """A web application firewall rule set. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar provisioning_state: The provisioning state of the web application firewall rule set. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param rule_set_type: The type of the web application firewall rule set. :type rule_set_type: str :param rule_set_version: The version of the web application firewall rule set type. :type rule_set_version: str :param rule_groups: The rule groups of the web application firewall rule set. :type rule_groups: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayFirewallRuleGroup] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'rule_set_type': {'key': 'properties.ruleSetType', 'type': 'str'}, 'rule_set_version': {'key': 'properties.ruleSetVersion', 'type': 'str'}, 'rule_groups': {'key': 'properties.ruleGroups', 'type': '[ApplicationGatewayFirewallRuleGroup]'}, } def __init__( self, **kwargs ): super(ApplicationGatewayFirewallRuleSet, self).__init__(**kwargs) self.provisioning_state = None self.rule_set_type = kwargs.get('rule_set_type', None) self.rule_set_version = kwargs.get('rule_set_version', None) self.rule_groups = kwargs.get('rule_groups', None) class ApplicationGatewayFrontendIPConfiguration(SubResource): """Frontend IP configuration of an application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the frontend IP configuration that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param private_ip_address: PrivateIPAddress of the network interface IP Configuration. :type private_ip_address: str :param private_ip_allocation_method: The private IP address allocation method. Possible values include: "Static", "Dynamic". :type private_ip_allocation_method: str or ~azure.mgmt.network.v2020_04_01.models.IPAllocationMethod :param subnet: Reference to the subnet resource. :type subnet: ~azure.mgmt.network.v2020_04_01.models.SubResource :param public_ip_address: Reference to the PublicIP resource. :type public_ip_address: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar provisioning_state: The provisioning state of the frontend IP configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'private_ip_address': {'key': 'properties.privateIPAddress', 'type': 'str'}, 'private_ip_allocation_method': {'key': 'properties.privateIPAllocationMethod', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'SubResource'}, 'public_ip_address': {'key': 'properties.publicIPAddress', 'type': 'SubResource'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayFrontendIPConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.private_ip_address = kwargs.get('private_ip_address', None) self.private_ip_allocation_method = kwargs.get('private_ip_allocation_method', None) self.subnet = kwargs.get('subnet', None) self.public_ip_address = kwargs.get('public_ip_address', None) self.provisioning_state = None class ApplicationGatewayFrontendPort(SubResource): """Frontend port of an application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the frontend port that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param port: Frontend port. :type port: int :ivar provisioning_state: The provisioning state of the frontend port resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'port': {'key': 'properties.port', 'type': 'int'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayFrontendPort, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.port = kwargs.get('port', None) self.provisioning_state = None class ApplicationGatewayHeaderConfiguration(msrest.serialization.Model): """Header configuration of the Actions set in Application Gateway. :param header_name: Header name of the header configuration. :type header_name: str :param header_value: Header value of the header configuration. :type header_value: str """ _attribute_map = { 'header_name': {'key': 'headerName', 'type': 'str'}, 'header_value': {'key': 'headerValue', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayHeaderConfiguration, self).__init__(**kwargs) self.header_name = kwargs.get('header_name', None) self.header_value = kwargs.get('header_value', None) class ApplicationGatewayHttpListener(SubResource): """Http listener of an application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the HTTP listener that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param frontend_ip_configuration: Frontend IP configuration resource of an application gateway. :type frontend_ip_configuration: ~azure.mgmt.network.v2020_04_01.models.SubResource :param frontend_port: Frontend port resource of an application gateway. :type frontend_port: ~azure.mgmt.network.v2020_04_01.models.SubResource :param protocol: Protocol of the HTTP listener. Possible values include: "Http", "Https". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayProtocol :param host_name: Host name of HTTP listener. :type host_name: str :param ssl_certificate: SSL certificate resource of an application gateway. :type ssl_certificate: ~azure.mgmt.network.v2020_04_01.models.SubResource :param require_server_name_indication: Applicable only if protocol is https. Enables SNI for multi-hosting. :type require_server_name_indication: bool :ivar provisioning_state: The provisioning state of the HTTP listener resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param custom_error_configurations: Custom error configurations of the HTTP listener. :type custom_error_configurations: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayCustomError] :param firewall_policy: Reference to the FirewallPolicy resource. :type firewall_policy: ~azure.mgmt.network.v2020_04_01.models.SubResource :param host_names: List of Host names for HTTP Listener that allows special wildcard characters as well. :type host_names: list[str] """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'frontend_ip_configuration': {'key': 'properties.frontendIPConfiguration', 'type': 'SubResource'}, 'frontend_port': {'key': 'properties.frontendPort', 'type': 'SubResource'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, 'host_name': {'key': 'properties.hostName', 'type': 'str'}, 'ssl_certificate': {'key': 'properties.sslCertificate', 'type': 'SubResource'}, 'require_server_name_indication': {'key': 'properties.requireServerNameIndication', 'type': 'bool'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'custom_error_configurations': {'key': 'properties.customErrorConfigurations', 'type': '[ApplicationGatewayCustomError]'}, 'firewall_policy': {'key': 'properties.firewallPolicy', 'type': 'SubResource'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, } def __init__( self, **kwargs ): super(ApplicationGatewayHttpListener, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.frontend_ip_configuration = kwargs.get('frontend_ip_configuration', None) self.frontend_port = kwargs.get('frontend_port', None) self.protocol = kwargs.get('protocol', None) self.host_name = kwargs.get('host_name', None) self.ssl_certificate = kwargs.get('ssl_certificate', None) self.require_server_name_indication = kwargs.get('require_server_name_indication', None) self.provisioning_state = None self.custom_error_configurations = kwargs.get('custom_error_configurations', None) self.firewall_policy = kwargs.get('firewall_policy', None) self.host_names = kwargs.get('host_names', None) class ApplicationGatewayIPConfiguration(SubResource): """IP configuration of an application gateway. Currently 1 public and 1 private IP configuration is allowed. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the IP configuration that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param subnet: Reference to the subnet resource. A subnet from where application gateway gets its private address. :type subnet: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar provisioning_state: The provisioning state of the application gateway IP configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'SubResource'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayIPConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.subnet = kwargs.get('subnet', None) self.provisioning_state = None class ApplicationGatewayListResult(msrest.serialization.Model): """Response for ListApplicationGateways API service call. :param value: List of an application gateways in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGateway] :param next_link: URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ApplicationGateway]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ApplicationGatewayOnDemandProbe(msrest.serialization.Model): """Details of on demand test probe request. :param protocol: The protocol used for the probe. Possible values include: "Http", "Https". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayProtocol :param host: Host name to send the probe to. :type host: str :param path: Relative path of probe. Valid path starts from '/'. Probe is sent to :code:`<Protocol>`://:code:`<host>`::code:`<port>`:code:`<path>`. :type path: str :param timeout: The probe timeout in seconds. Probe marked as failed if valid response is not received with this timeout period. Acceptable values are from 1 second to 86400 seconds. :type timeout: int :param pick_host_name_from_backend_http_settings: Whether the host header should be picked from the backend http settings. Default value is false. :type pick_host_name_from_backend_http_settings: bool :param match: Criterion for classifying a healthy probe response. :type match: ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayProbeHealthResponseMatch :param backend_address_pool: Reference to backend pool of application gateway to which probe request will be sent. :type backend_address_pool: ~azure.mgmt.network.v2020_04_01.models.SubResource :param backend_http_settings: Reference to backend http setting of application gateway to be used for test probe. :type backend_http_settings: ~azure.mgmt.network.v2020_04_01.models.SubResource """ _attribute_map = { 'protocol': {'key': 'protocol', 'type': 'str'}, 'host': {'key': 'host', 'type': 'str'}, 'path': {'key': 'path', 'type': 'str'}, 'timeout': {'key': 'timeout', 'type': 'int'}, 'pick_host_name_from_backend_http_settings': {'key': 'pickHostNameFromBackendHttpSettings', 'type': 'bool'}, 'match': {'key': 'match', 'type': 'ApplicationGatewayProbeHealthResponseMatch'}, 'backend_address_pool': {'key': 'backendAddressPool', 'type': 'SubResource'}, 'backend_http_settings': {'key': 'backendHttpSettings', 'type': 'SubResource'}, } def __init__( self, **kwargs ): super(ApplicationGatewayOnDemandProbe, self).__init__(**kwargs) self.protocol = kwargs.get('protocol', None) self.host = kwargs.get('host', None) self.path = kwargs.get('path', None) self.timeout = kwargs.get('timeout', None) self.pick_host_name_from_backend_http_settings = kwargs.get('pick_host_name_from_backend_http_settings', None) self.match = kwargs.get('match', None) self.backend_address_pool = kwargs.get('backend_address_pool', None) self.backend_http_settings = kwargs.get('backend_http_settings', None) class ApplicationGatewayPathRule(SubResource): """Path rule of URL path map of an application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the path rule that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param paths: Path rules of URL path map. :type paths: list[str] :param backend_address_pool: Backend address pool resource of URL path map path rule. :type backend_address_pool: ~azure.mgmt.network.v2020_04_01.models.SubResource :param backend_http_settings: Backend http settings resource of URL path map path rule. :type backend_http_settings: ~azure.mgmt.network.v2020_04_01.models.SubResource :param redirect_configuration: Redirect configuration resource of URL path map path rule. :type redirect_configuration: ~azure.mgmt.network.v2020_04_01.models.SubResource :param rewrite_rule_set: Rewrite rule set resource of URL path map path rule. :type rewrite_rule_set: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar provisioning_state: The provisioning state of the path rule resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param firewall_policy: Reference to the FirewallPolicy resource. :type firewall_policy: ~azure.mgmt.network.v2020_04_01.models.SubResource """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'paths': {'key': 'properties.paths', 'type': '[str]'}, 'backend_address_pool': {'key': 'properties.backendAddressPool', 'type': 'SubResource'}, 'backend_http_settings': {'key': 'properties.backendHttpSettings', 'type': 'SubResource'}, 'redirect_configuration': {'key': 'properties.redirectConfiguration', 'type': 'SubResource'}, 'rewrite_rule_set': {'key': 'properties.rewriteRuleSet', 'type': 'SubResource'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'firewall_policy': {'key': 'properties.firewallPolicy', 'type': 'SubResource'}, } def __init__( self, **kwargs ): super(ApplicationGatewayPathRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.paths = kwargs.get('paths', None) self.backend_address_pool = kwargs.get('backend_address_pool', None) self.backend_http_settings = kwargs.get('backend_http_settings', None) self.redirect_configuration = kwargs.get('redirect_configuration', None) self.rewrite_rule_set = kwargs.get('rewrite_rule_set', None) self.provisioning_state = None self.firewall_policy = kwargs.get('firewall_policy', None) class ApplicationGatewayProbe(SubResource): """Probe of the application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the probe that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param protocol: The protocol used for the probe. Possible values include: "Http", "Https". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayProtocol :param host: Host name to send the probe to. :type host: str :param path: Relative path of probe. Valid path starts from '/'. Probe is sent to :code:`<Protocol>`://:code:`<host>`::code:`<port>`:code:`<path>`. :type path: str :param interval: The probing interval in seconds. This is the time interval between two consecutive probes. Acceptable values are from 1 second to 86400 seconds. :type interval: int :param timeout: The probe timeout in seconds. Probe marked as failed if valid response is not received with this timeout period. Acceptable values are from 1 second to 86400 seconds. :type timeout: int :param unhealthy_threshold: The probe retry count. Backend server is marked down after consecutive probe failure count reaches UnhealthyThreshold. Acceptable values are from 1 second to 20. :type unhealthy_threshold: int :param pick_host_name_from_backend_http_settings: Whether the host header should be picked from the backend http settings. Default value is false. :type pick_host_name_from_backend_http_settings: bool :param min_servers: Minimum number of servers that are always marked healthy. Default value is 0. :type min_servers: int :param match: Criterion for classifying a healthy probe response. :type match: ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayProbeHealthResponseMatch :ivar provisioning_state: The provisioning state of the probe resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param port: Custom port which will be used for probing the backend servers. The valid value ranges from 1 to 65535. In case not set, port from http settings will be used. This property is valid for Standard_v2 and WAF_v2 only. :type port: int """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'port': {'maximum': 65535, 'minimum': 1}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, 'host': {'key': 'properties.host', 'type': 'str'}, 'path': {'key': 'properties.path', 'type': 'str'}, 'interval': {'key': 'properties.interval', 'type': 'int'}, 'timeout': {'key': 'properties.timeout', 'type': 'int'}, 'unhealthy_threshold': {'key': 'properties.unhealthyThreshold', 'type': 'int'}, 'pick_host_name_from_backend_http_settings': {'key': 'properties.pickHostNameFromBackendHttpSettings', 'type': 'bool'}, 'min_servers': {'key': 'properties.minServers', 'type': 'int'}, 'match': {'key': 'properties.match', 'type': 'ApplicationGatewayProbeHealthResponseMatch'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'port': {'key': 'properties.port', 'type': 'int'}, } def __init__( self, **kwargs ): super(ApplicationGatewayProbe, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.protocol = kwargs.get('protocol', None) self.host = kwargs.get('host', None) self.path = kwargs.get('path', None) self.interval = kwargs.get('interval', None) self.timeout = kwargs.get('timeout', None) self.unhealthy_threshold = kwargs.get('unhealthy_threshold', None) self.pick_host_name_from_backend_http_settings = kwargs.get('pick_host_name_from_backend_http_settings', None) self.min_servers = kwargs.get('min_servers', None) self.match = kwargs.get('match', None) self.provisioning_state = None self.port = kwargs.get('port', None) class ApplicationGatewayProbeHealthResponseMatch(msrest.serialization.Model): """Application gateway probe health response match. :param body: Body that must be contained in the health response. Default value is empty. :type body: str :param status_codes: Allowed ranges of healthy status codes. Default range of healthy status codes is 200-399. :type status_codes: list[str] """ _attribute_map = { 'body': {'key': 'body', 'type': 'str'}, 'status_codes': {'key': 'statusCodes', 'type': '[str]'}, } def __init__( self, **kwargs ): super(ApplicationGatewayProbeHealthResponseMatch, self).__init__(**kwargs) self.body = kwargs.get('body', None) self.status_codes = kwargs.get('status_codes', None) class ApplicationGatewayRedirectConfiguration(SubResource): """Redirect configuration of an application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the redirect configuration that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param redirect_type: HTTP redirection type. Possible values include: "Permanent", "Found", "SeeOther", "Temporary". :type redirect_type: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayRedirectType :param target_listener: Reference to a listener to redirect the request to. :type target_listener: ~azure.mgmt.network.v2020_04_01.models.SubResource :param target_url: Url to redirect the request to. :type target_url: str :param include_path: Include path in the redirected url. :type include_path: bool :param include_query_string: Include query string in the redirected url. :type include_query_string: bool :param request_routing_rules: Request routing specifying redirect configuration. :type request_routing_rules: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :param url_path_maps: Url path maps specifying default redirect configuration. :type url_path_maps: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :param path_rules: Path rules specifying redirect configuration. :type path_rules: list[~azure.mgmt.network.v2020_04_01.models.SubResource] """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'redirect_type': {'key': 'properties.redirectType', 'type': 'str'}, 'target_listener': {'key': 'properties.targetListener', 'type': 'SubResource'}, 'target_url': {'key': 'properties.targetUrl', 'type': 'str'}, 'include_path': {'key': 'properties.includePath', 'type': 'bool'}, 'include_query_string': {'key': 'properties.includeQueryString', 'type': 'bool'}, 'request_routing_rules': {'key': 'properties.requestRoutingRules', 'type': '[SubResource]'}, 'url_path_maps': {'key': 'properties.urlPathMaps', 'type': '[SubResource]'}, 'path_rules': {'key': 'properties.pathRules', 'type': '[SubResource]'}, } def __init__( self, **kwargs ): super(ApplicationGatewayRedirectConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.redirect_type = kwargs.get('redirect_type', None) self.target_listener = kwargs.get('target_listener', None) self.target_url = kwargs.get('target_url', None) self.include_path = kwargs.get('include_path', None) self.include_query_string = kwargs.get('include_query_string', None) self.request_routing_rules = kwargs.get('request_routing_rules', None) self.url_path_maps = kwargs.get('url_path_maps', None) self.path_rules = kwargs.get('path_rules', None) class ApplicationGatewayRequestRoutingRule(SubResource): """Request routing rule of an application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the request routing rule that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param rule_type: Rule type. Possible values include: "Basic", "PathBasedRouting". :type rule_type: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayRequestRoutingRuleType :param priority: Priority of the request routing rule. :type priority: int :param backend_address_pool: Backend address pool resource of the application gateway. :type backend_address_pool: ~azure.mgmt.network.v2020_04_01.models.SubResource :param backend_http_settings: Backend http settings resource of the application gateway. :type backend_http_settings: ~azure.mgmt.network.v2020_04_01.models.SubResource :param http_listener: Http listener resource of the application gateway. :type http_listener: ~azure.mgmt.network.v2020_04_01.models.SubResource :param url_path_map: URL path map resource of the application gateway. :type url_path_map: ~azure.mgmt.network.v2020_04_01.models.SubResource :param rewrite_rule_set: Rewrite Rule Set resource in Basic rule of the application gateway. :type rewrite_rule_set: ~azure.mgmt.network.v2020_04_01.models.SubResource :param redirect_configuration: Redirect configuration resource of the application gateway. :type redirect_configuration: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar provisioning_state: The provisioning state of the request routing rule resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'priority': {'maximum': 20000, 'minimum': 1}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'rule_type': {'key': 'properties.ruleType', 'type': 'str'}, 'priority': {'key': 'properties.priority', 'type': 'int'}, 'backend_address_pool': {'key': 'properties.backendAddressPool', 'type': 'SubResource'}, 'backend_http_settings': {'key': 'properties.backendHttpSettings', 'type': 'SubResource'}, 'http_listener': {'key': 'properties.httpListener', 'type': 'SubResource'}, 'url_path_map': {'key': 'properties.urlPathMap', 'type': 'SubResource'}, 'rewrite_rule_set': {'key': 'properties.rewriteRuleSet', 'type': 'SubResource'}, 'redirect_configuration': {'key': 'properties.redirectConfiguration', 'type': 'SubResource'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayRequestRoutingRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.rule_type = kwargs.get('rule_type', None) self.priority = kwargs.get('priority', None) self.backend_address_pool = kwargs.get('backend_address_pool', None) self.backend_http_settings = kwargs.get('backend_http_settings', None) self.http_listener = kwargs.get('http_listener', None) self.url_path_map = kwargs.get('url_path_map', None) self.rewrite_rule_set = kwargs.get('rewrite_rule_set', None) self.redirect_configuration = kwargs.get('redirect_configuration', None) self.provisioning_state = None class ApplicationGatewayRewriteRule(msrest.serialization.Model): """Rewrite rule of an application gateway. :param name: Name of the rewrite rule that is unique within an Application Gateway. :type name: str :param rule_sequence: Rule Sequence of the rewrite rule that determines the order of execution of a particular rule in a RewriteRuleSet. :type rule_sequence: int :param conditions: Conditions based on which the action set execution will be evaluated. :type conditions: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayRewriteRuleCondition] :param action_set: Set of actions to be done as part of the rewrite Rule. :type action_set: ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayRewriteRuleActionSet """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'rule_sequence': {'key': 'ruleSequence', 'type': 'int'}, 'conditions': {'key': 'conditions', 'type': '[ApplicationGatewayRewriteRuleCondition]'}, 'action_set': {'key': 'actionSet', 'type': 'ApplicationGatewayRewriteRuleActionSet'}, } def __init__( self, **kwargs ): super(ApplicationGatewayRewriteRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.rule_sequence = kwargs.get('rule_sequence', None) self.conditions = kwargs.get('conditions', None) self.action_set = kwargs.get('action_set', None) class ApplicationGatewayRewriteRuleActionSet(msrest.serialization.Model): """Set of actions in the Rewrite Rule in Application Gateway. :param request_header_configurations: Request Header Actions in the Action Set. :type request_header_configurations: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayHeaderConfiguration] :param response_header_configurations: Response Header Actions in the Action Set. :type response_header_configurations: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayHeaderConfiguration] :param url_configuration: Url Configuration Action in the Action Set. :type url_configuration: ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayUrlConfiguration """ _attribute_map = { 'request_header_configurations': {'key': 'requestHeaderConfigurations', 'type': '[ApplicationGatewayHeaderConfiguration]'}, 'response_header_configurations': {'key': 'responseHeaderConfigurations', 'type': '[ApplicationGatewayHeaderConfiguration]'}, 'url_configuration': {'key': 'urlConfiguration', 'type': 'ApplicationGatewayUrlConfiguration'}, } def __init__( self, **kwargs ): super(ApplicationGatewayRewriteRuleActionSet, self).__init__(**kwargs) self.request_header_configurations = kwargs.get('request_header_configurations', None) self.response_header_configurations = kwargs.get('response_header_configurations', None) self.url_configuration = kwargs.get('url_configuration', None) class ApplicationGatewayRewriteRuleCondition(msrest.serialization.Model): """Set of conditions in the Rewrite Rule in Application Gateway. :param variable: The condition parameter of the RewriteRuleCondition. :type variable: str :param pattern: The pattern, either fixed string or regular expression, that evaluates the truthfulness of the condition. :type pattern: str :param ignore_case: Setting this parameter to truth value with force the pattern to do a case in-sensitive comparison. :type ignore_case: bool :param negate: Setting this value as truth will force to check the negation of the condition given by the user. :type negate: bool """ _attribute_map = { 'variable': {'key': 'variable', 'type': 'str'}, 'pattern': {'key': 'pattern', 'type': 'str'}, 'ignore_case': {'key': 'ignoreCase', 'type': 'bool'}, 'negate': {'key': 'negate', 'type': 'bool'}, } def __init__( self, **kwargs ): super(ApplicationGatewayRewriteRuleCondition, self).__init__(**kwargs) self.variable = kwargs.get('variable', None) self.pattern = kwargs.get('pattern', None) self.ignore_case = kwargs.get('ignore_case', None) self.negate = kwargs.get('negate', None) class ApplicationGatewayRewriteRuleSet(SubResource): """Rewrite rule set of an application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the rewrite rule set that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param rewrite_rules: Rewrite rules in the rewrite rule set. :type rewrite_rules: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayRewriteRule] :ivar provisioning_state: The provisioning state of the rewrite rule set resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'rewrite_rules': {'key': 'properties.rewriteRules', 'type': '[ApplicationGatewayRewriteRule]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayRewriteRuleSet, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.rewrite_rules = kwargs.get('rewrite_rules', None) self.provisioning_state = None class ApplicationGatewaySku(msrest.serialization.Model): """SKU of an application gateway. :param name: Name of an application gateway SKU. Possible values include: "Standard_Small", "Standard_Medium", "Standard_Large", "WAF_Medium", "WAF_Large", "Standard_v2", "WAF_v2". :type name: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySkuName :param tier: Tier of an application gateway. Possible values include: "Standard", "WAF", "Standard_v2", "WAF_v2". :type tier: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayTier :param capacity: Capacity (instance count) of an application gateway. :type capacity: int """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'tier': {'key': 'tier', 'type': 'str'}, 'capacity': {'key': 'capacity', 'type': 'int'}, } def __init__( self, **kwargs ): super(ApplicationGatewaySku, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) self.capacity = kwargs.get('capacity', None) class ApplicationGatewaySslCertificate(SubResource): """SSL certificates of an application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the SSL certificate that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param data: Base-64 encoded pfx certificate. Only applicable in PUT Request. :type data: str :param password: Password for the pfx file specified in data. Only applicable in PUT request. :type password: str :ivar public_cert_data: Base-64 encoded Public cert data corresponding to pfx specified in data. Only applicable in GET request. :vartype public_cert_data: str :param key_vault_secret_id: Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. :type key_vault_secret_id: str :ivar provisioning_state: The provisioning state of the SSL certificate resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'public_cert_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'data': {'key': 'properties.data', 'type': 'str'}, 'password': {'key': 'properties.password', 'type': 'str'}, 'public_cert_data': {'key': 'properties.publicCertData', 'type': 'str'}, 'key_vault_secret_id': {'key': 'properties.keyVaultSecretId', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewaySslCertificate, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.data = kwargs.get('data', None) self.password = kwargs.get('password', None) self.public_cert_data = None self.key_vault_secret_id = kwargs.get('key_vault_secret_id', None) self.provisioning_state = None class ApplicationGatewaySslPolicy(msrest.serialization.Model): """Application Gateway Ssl policy. :param disabled_ssl_protocols: Ssl protocols to be disabled on application gateway. :type disabled_ssl_protocols: list[str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySslProtocol] :param policy_type: Type of Ssl Policy. Possible values include: "Predefined", "Custom". :type policy_type: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySslPolicyType :param policy_name: Name of Ssl predefined policy. Possible values include: "AppGwSslPolicy20150501", "AppGwSslPolicy20170401", "AppGwSslPolicy20170401S". :type policy_name: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySslPolicyName :param cipher_suites: Ssl cipher suites to be enabled in the specified order to application gateway. :type cipher_suites: list[str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySslCipherSuite] :param min_protocol_version: Minimum version of Ssl protocol to be supported on application gateway. Possible values include: "TLSv1_0", "TLSv1_1", "TLSv1_2". :type min_protocol_version: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySslProtocol """ _attribute_map = { 'disabled_ssl_protocols': {'key': 'disabledSslProtocols', 'type': '[str]'}, 'policy_type': {'key': 'policyType', 'type': 'str'}, 'policy_name': {'key': 'policyName', 'type': 'str'}, 'cipher_suites': {'key': 'cipherSuites', 'type': '[str]'}, 'min_protocol_version': {'key': 'minProtocolVersion', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewaySslPolicy, self).__init__(**kwargs) self.disabled_ssl_protocols = kwargs.get('disabled_ssl_protocols', None) self.policy_type = kwargs.get('policy_type', None) self.policy_name = kwargs.get('policy_name', None) self.cipher_suites = kwargs.get('cipher_suites', None) self.min_protocol_version = kwargs.get('min_protocol_version', None) class ApplicationGatewaySslPredefinedPolicy(SubResource): """An Ssl predefined policy. :param id: Resource ID. :type id: str :param name: Name of the Ssl predefined policy. :type name: str :param cipher_suites: Ssl cipher suites to be enabled in the specified order for application gateway. :type cipher_suites: list[str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySslCipherSuite] :param min_protocol_version: Minimum version of Ssl protocol to be supported on application gateway. Possible values include: "TLSv1_0", "TLSv1_1", "TLSv1_2". :type min_protocol_version: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewaySslProtocol """ _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'cipher_suites': {'key': 'properties.cipherSuites', 'type': '[str]'}, 'min_protocol_version': {'key': 'properties.minProtocolVersion', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewaySslPredefinedPolicy, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.cipher_suites = kwargs.get('cipher_suites', None) self.min_protocol_version = kwargs.get('min_protocol_version', None) class ApplicationGatewayTrustedRootCertificate(SubResource): """Trusted Root certificates of an application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the trusted root certificate that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param data: Certificate public data. :type data: str :param key_vault_secret_id: Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. :type key_vault_secret_id: str :ivar provisioning_state: The provisioning state of the trusted root certificate resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'data': {'key': 'properties.data', 'type': 'str'}, 'key_vault_secret_id': {'key': 'properties.keyVaultSecretId', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayTrustedRootCertificate, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.data = kwargs.get('data', None) self.key_vault_secret_id = kwargs.get('key_vault_secret_id', None) self.provisioning_state = None class ApplicationGatewayUrlConfiguration(msrest.serialization.Model): """Url configuration of the Actions set in Application Gateway. :param modified_path: Url path which user has provided for url rewrite. Null means no path will be updated. Default value is null. :type modified_path: str :param modified_query_string: Query string which user has provided for url rewrite. Null means no query string will be updated. Default value is null. :type modified_query_string: str :param reroute: If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path. Default value is false. :type reroute: bool """ _attribute_map = { 'modified_path': {'key': 'modifiedPath', 'type': 'str'}, 'modified_query_string': {'key': 'modifiedQueryString', 'type': 'str'}, 'reroute': {'key': 'reroute', 'type': 'bool'}, } def __init__( self, **kwargs ): super(ApplicationGatewayUrlConfiguration, self).__init__(**kwargs) self.modified_path = kwargs.get('modified_path', None) self.modified_query_string = kwargs.get('modified_query_string', None) self.reroute = kwargs.get('reroute', None) class ApplicationGatewayUrlPathMap(SubResource): """UrlPathMaps give a url path to the backend mapping information for PathBasedRouting. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the URL path map that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param default_backend_address_pool: Default backend address pool resource of URL path map. :type default_backend_address_pool: ~azure.mgmt.network.v2020_04_01.models.SubResource :param default_backend_http_settings: Default backend http settings resource of URL path map. :type default_backend_http_settings: ~azure.mgmt.network.v2020_04_01.models.SubResource :param default_rewrite_rule_set: Default Rewrite rule set resource of URL path map. :type default_rewrite_rule_set: ~azure.mgmt.network.v2020_04_01.models.SubResource :param default_redirect_configuration: Default redirect configuration resource of URL path map. :type default_redirect_configuration: ~azure.mgmt.network.v2020_04_01.models.SubResource :param path_rules: Path rule of URL path map resource. :type path_rules: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayPathRule] :ivar provisioning_state: The provisioning state of the URL path map resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'default_backend_address_pool': {'key': 'properties.defaultBackendAddressPool', 'type': 'SubResource'}, 'default_backend_http_settings': {'key': 'properties.defaultBackendHttpSettings', 'type': 'SubResource'}, 'default_rewrite_rule_set': {'key': 'properties.defaultRewriteRuleSet', 'type': 'SubResource'}, 'default_redirect_configuration': {'key': 'properties.defaultRedirectConfiguration', 'type': 'SubResource'}, 'path_rules': {'key': 'properties.pathRules', 'type': '[ApplicationGatewayPathRule]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationGatewayUrlPathMap, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.default_backend_address_pool = kwargs.get('default_backend_address_pool', None) self.default_backend_http_settings = kwargs.get('default_backend_http_settings', None) self.default_rewrite_rule_set = kwargs.get('default_rewrite_rule_set', None) self.default_redirect_configuration = kwargs.get('default_redirect_configuration', None) self.path_rules = kwargs.get('path_rules', None) self.provisioning_state = None class ApplicationGatewayWebApplicationFirewallConfiguration(msrest.serialization.Model): """Application gateway web application firewall configuration. All required parameters must be populated in order to send to Azure. :param enabled: Required. Whether the web application firewall is enabled or not. :type enabled: bool :param firewall_mode: Required. Web application firewall mode. Possible values include: "Detection", "Prevention". :type firewall_mode: str or ~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayFirewallMode :param rule_set_type: Required. The type of the web application firewall rule set. Possible values are: 'OWASP'. :type rule_set_type: str :param rule_set_version: Required. The version of the rule set type. :type rule_set_version: str :param disabled_rule_groups: The disabled rule groups. :type disabled_rule_groups: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayFirewallDisabledRuleGroup] :param request_body_check: Whether allow WAF to check request Body. :type request_body_check: bool :param max_request_body_size: Maximum request body size for WAF. :type max_request_body_size: int :param max_request_body_size_in_kb: Maximum request body size in Kb for WAF. :type max_request_body_size_in_kb: int :param file_upload_limit_in_mb: Maximum file upload size in Mb for WAF. :type file_upload_limit_in_mb: int :param exclusions: The exclusion list. :type exclusions: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayFirewallExclusion] """ _validation = { 'enabled': {'required': True}, 'firewall_mode': {'required': True}, 'rule_set_type': {'required': True}, 'rule_set_version': {'required': True}, 'max_request_body_size': {'maximum': 128, 'minimum': 8}, 'max_request_body_size_in_kb': {'maximum': 128, 'minimum': 8}, 'file_upload_limit_in_mb': {'minimum': 0}, } _attribute_map = { 'enabled': {'key': 'enabled', 'type': 'bool'}, 'firewall_mode': {'key': 'firewallMode', 'type': 'str'}, 'rule_set_type': {'key': 'ruleSetType', 'type': 'str'}, 'rule_set_version': {'key': 'ruleSetVersion', 'type': 'str'}, 'disabled_rule_groups': {'key': 'disabledRuleGroups', 'type': '[ApplicationGatewayFirewallDisabledRuleGroup]'}, 'request_body_check': {'key': 'requestBodyCheck', 'type': 'bool'}, 'max_request_body_size': {'key': 'maxRequestBodySize', 'type': 'int'}, 'max_request_body_size_in_kb': {'key': 'maxRequestBodySizeInKb', 'type': 'int'}, 'file_upload_limit_in_mb': {'key': 'fileUploadLimitInMb', 'type': 'int'}, 'exclusions': {'key': 'exclusions', 'type': '[ApplicationGatewayFirewallExclusion]'}, } def __init__( self, **kwargs ): super(ApplicationGatewayWebApplicationFirewallConfiguration, self).__init__(**kwargs) self.enabled = kwargs['enabled'] self.firewall_mode = kwargs['firewall_mode'] self.rule_set_type = kwargs['rule_set_type'] self.rule_set_version = kwargs['rule_set_version'] self.disabled_rule_groups = kwargs.get('disabled_rule_groups', None) self.request_body_check = kwargs.get('request_body_check', None) self.max_request_body_size = kwargs.get('max_request_body_size', None) self.max_request_body_size_in_kb = kwargs.get('max_request_body_size_in_kb', None) self.file_upload_limit_in_mb = kwargs.get('file_upload_limit_in_mb', None) self.exclusions = kwargs.get('exclusions', None) class FirewallPolicyRuleCondition(msrest.serialization.Model): """Properties of a rule. You probably want to use the sub-classes and not this class directly. Known sub-classes are: ApplicationRuleCondition, NatRuleCondition, NetworkRuleCondition. All required parameters must be populated in order to send to Azure. :param name: Name of the rule condition. :type name: str :param description: Description of the rule condition. :type description: str :param rule_condition_type: Required. Rule Condition Type.Constant filled by server. Possible values include: "ApplicationRuleCondition", "NetworkRuleCondition", "NatRuleCondition". :type rule_condition_type: str or ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleConditionType """ _validation = { 'rule_condition_type': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'rule_condition_type': {'key': 'ruleConditionType', 'type': 'str'}, } _subtype_map = { 'rule_condition_type': {'ApplicationRuleCondition': 'ApplicationRuleCondition', 'NatRuleCondition': 'NatRuleCondition', 'NetworkRuleCondition': 'NetworkRuleCondition'} } def __init__( self, **kwargs ): super(FirewallPolicyRuleCondition, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.description = kwargs.get('description', None) self.rule_condition_type = None # type: Optional[str] class ApplicationRuleCondition(FirewallPolicyRuleCondition): """Rule condition of type application. All required parameters must be populated in order to send to Azure. :param name: Name of the rule condition. :type name: str :param description: Description of the rule condition. :type description: str :param rule_condition_type: Required. Rule Condition Type.Constant filled by server. Possible values include: "ApplicationRuleCondition", "NetworkRuleCondition", "NatRuleCondition". :type rule_condition_type: str or ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleConditionType :param source_addresses: List of source IP addresses for this rule. :type source_addresses: list[str] :param destination_addresses: List of destination IP addresses or Service Tags. :type destination_addresses: list[str] :param protocols: Array of Application Protocols. :type protocols: list[~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleConditionApplicationProtocol] :param target_fqdns: List of FQDNs for this rule condition. :type target_fqdns: list[str] :param fqdn_tags: List of FQDN Tags for this rule condition. :type fqdn_tags: list[str] :param source_ip_groups: List of source IpGroups for this rule. :type source_ip_groups: list[str] """ _validation = { 'rule_condition_type': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'rule_condition_type': {'key': 'ruleConditionType', 'type': 'str'}, 'source_addresses': {'key': 'sourceAddresses', 'type': '[str]'}, 'destination_addresses': {'key': 'destinationAddresses', 'type': '[str]'}, 'protocols': {'key': 'protocols', 'type': '[FirewallPolicyRuleConditionApplicationProtocol]'}, 'target_fqdns': {'key': 'targetFqdns', 'type': '[str]'}, 'fqdn_tags': {'key': 'fqdnTags', 'type': '[str]'}, 'source_ip_groups': {'key': 'sourceIpGroups', 'type': '[str]'}, } def __init__( self, **kwargs ): super(ApplicationRuleCondition, self).__init__(**kwargs) self.rule_condition_type = 'ApplicationRuleCondition' # type: str self.source_addresses = kwargs.get('source_addresses', None) self.destination_addresses = kwargs.get('destination_addresses', None) self.protocols = kwargs.get('protocols', None) self.target_fqdns = kwargs.get('target_fqdns', None) self.fqdn_tags = kwargs.get('fqdn_tags', None) self.source_ip_groups = kwargs.get('source_ip_groups', None) class ApplicationSecurityGroup(Resource): """An application security group in a resource group. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar resource_guid: The resource GUID property of the application security group resource. It uniquely identifies a resource, even if the user changes its name or migrate the resource across subscriptions or resource groups. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the application security group resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationSecurityGroup, self).__init__(**kwargs) self.etag = None self.resource_guid = None self.provisioning_state = None class ApplicationSecurityGroupListResult(msrest.serialization.Model): """A list of application security groups. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of application security groups. :type value: list[~azure.mgmt.network.v2020_04_01.models.ApplicationSecurityGroup] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[ApplicationSecurityGroup]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ApplicationSecurityGroupListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class AuthorizationListResult(msrest.serialization.Model): """Response for ListAuthorizations API service call retrieves all authorizations that belongs to an ExpressRouteCircuit. :param value: The authorizations in an ExpressRoute Circuit. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitAuthorization] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteCircuitAuthorization]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(AuthorizationListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class AutoApprovedPrivateLinkService(msrest.serialization.Model): """The information of an AutoApprovedPrivateLinkService. :param private_link_service: The id of the private link service resource. :type private_link_service: str """ _attribute_map = { 'private_link_service': {'key': 'privateLinkService', 'type': 'str'}, } def __init__( self, **kwargs ): super(AutoApprovedPrivateLinkService, self).__init__(**kwargs) self.private_link_service = kwargs.get('private_link_service', None) class AutoApprovedPrivateLinkServicesResult(msrest.serialization.Model): """An array of private link service id that can be linked to a private end point with auto approved. Variables are only populated by the server, and will be ignored when sending a request. :param value: An array of auto approved private link service. :type value: list[~azure.mgmt.network.v2020_04_01.models.AutoApprovedPrivateLinkService] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[AutoApprovedPrivateLinkService]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(AutoApprovedPrivateLinkServicesResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class Availability(msrest.serialization.Model): """Availability of the metric. :param time_grain: The time grain of the availability. :type time_grain: str :param retention: The retention of the availability. :type retention: str :param blob_duration: Duration of the availability blob. :type blob_duration: str """ _attribute_map = { 'time_grain': {'key': 'timeGrain', 'type': 'str'}, 'retention': {'key': 'retention', 'type': 'str'}, 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } def __init__( self, **kwargs ): super(Availability, self).__init__(**kwargs) self.time_grain = kwargs.get('time_grain', None) self.retention = kwargs.get('retention', None) self.blob_duration = kwargs.get('blob_duration', None) class AvailableDelegation(msrest.serialization.Model): """The serviceName of an AvailableDelegation indicates a possible delegation for a subnet. :param name: The name of the AvailableDelegation resource. :type name: str :param id: A unique identifier of the AvailableDelegation resource. :type id: str :param type: Resource type. :type type: str :param service_name: The name of the service and resource. :type service_name: str :param actions: The actions permitted to the service upon delegation. :type actions: list[str] """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'service_name': {'key': 'serviceName', 'type': 'str'}, 'actions': {'key': 'actions', 'type': '[str]'}, } def __init__( self, **kwargs ): super(AvailableDelegation, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.id = kwargs.get('id', None) self.type = kwargs.get('type', None) self.service_name = kwargs.get('service_name', None) self.actions = kwargs.get('actions', None) class AvailableDelegationsResult(msrest.serialization.Model): """An array of available delegations. Variables are only populated by the server, and will be ignored when sending a request. :param value: An array of available delegations. :type value: list[~azure.mgmt.network.v2020_04_01.models.AvailableDelegation] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[AvailableDelegation]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(AvailableDelegationsResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class AvailablePrivateEndpointType(msrest.serialization.Model): """The information of an AvailablePrivateEndpointType. :param name: The name of the service and resource. :type name: str :param id: A unique identifier of the AvailablePrivateEndpoint Type resource. :type id: str :param type: Resource type. :type type: str :param resource_name: The name of the service and resource. :type resource_name: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'resource_name': {'key': 'resourceName', 'type': 'str'}, } def __init__( self, **kwargs ): super(AvailablePrivateEndpointType, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.id = kwargs.get('id', None) self.type = kwargs.get('type', None) self.resource_name = kwargs.get('resource_name', None) class AvailablePrivateEndpointTypesResult(msrest.serialization.Model): """An array of available PrivateEndpoint types. Variables are only populated by the server, and will be ignored when sending a request. :param value: An array of available privateEndpoint type. :type value: list[~azure.mgmt.network.v2020_04_01.models.AvailablePrivateEndpointType] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[AvailablePrivateEndpointType]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(AvailablePrivateEndpointTypesResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class AvailableProvidersList(msrest.serialization.Model): """List of available countries with details. All required parameters must be populated in order to send to Azure. :param countries: Required. List of available countries. :type countries: list[~azure.mgmt.network.v2020_04_01.models.AvailableProvidersListCountry] """ _validation = { 'countries': {'required': True}, } _attribute_map = { 'countries': {'key': 'countries', 'type': '[AvailableProvidersListCountry]'}, } def __init__( self, **kwargs ): super(AvailableProvidersList, self).__init__(**kwargs) self.countries = kwargs['countries'] class AvailableProvidersListCity(msrest.serialization.Model): """City or town details. :param city_name: The city or town name. :type city_name: str :param providers: A list of Internet service providers. :type providers: list[str] """ _attribute_map = { 'city_name': {'key': 'cityName', 'type': 'str'}, 'providers': {'key': 'providers', 'type': '[str]'}, } def __init__( self, **kwargs ): super(AvailableProvidersListCity, self).__init__(**kwargs) self.city_name = kwargs.get('city_name', None) self.providers = kwargs.get('providers', None) class AvailableProvidersListCountry(msrest.serialization.Model): """Country details. :param country_name: The country name. :type country_name: str :param providers: A list of Internet service providers. :type providers: list[str] :param states: List of available states in the country. :type states: list[~azure.mgmt.network.v2020_04_01.models.AvailableProvidersListState] """ _attribute_map = { 'country_name': {'key': 'countryName', 'type': 'str'}, 'providers': {'key': 'providers', 'type': '[str]'}, 'states': {'key': 'states', 'type': '[AvailableProvidersListState]'}, } def __init__( self, **kwargs ): super(AvailableProvidersListCountry, self).__init__(**kwargs) self.country_name = kwargs.get('country_name', None) self.providers = kwargs.get('providers', None) self.states = kwargs.get('states', None) class AvailableProvidersListParameters(msrest.serialization.Model): """Constraints that determine the list of available Internet service providers. :param azure_locations: A list of Azure regions. :type azure_locations: list[str] :param country: The country for available providers list. :type country: str :param state: The state for available providers list. :type state: str :param city: The city or town for available providers list. :type city: str """ _attribute_map = { 'azure_locations': {'key': 'azureLocations', 'type': '[str]'}, 'country': {'key': 'country', 'type': 'str'}, 'state': {'key': 'state', 'type': 'str'}, 'city': {'key': 'city', 'type': 'str'}, } def __init__( self, **kwargs ): super(AvailableProvidersListParameters, self).__init__(**kwargs) self.azure_locations = kwargs.get('azure_locations', None) self.country = kwargs.get('country', None) self.state = kwargs.get('state', None) self.city = kwargs.get('city', None) class AvailableProvidersListState(msrest.serialization.Model): """State details. :param state_name: The state name. :type state_name: str :param providers: A list of Internet service providers. :type providers: list[str] :param cities: List of available cities or towns in the state. :type cities: list[~azure.mgmt.network.v2020_04_01.models.AvailableProvidersListCity] """ _attribute_map = { 'state_name': {'key': 'stateName', 'type': 'str'}, 'providers': {'key': 'providers', 'type': '[str]'}, 'cities': {'key': 'cities', 'type': '[AvailableProvidersListCity]'}, } def __init__( self, **kwargs ): super(AvailableProvidersListState, self).__init__(**kwargs) self.state_name = kwargs.get('state_name', None) self.providers = kwargs.get('providers', None) self.cities = kwargs.get('cities', None) class AvailableServiceAlias(msrest.serialization.Model): """The available service alias. :param name: The name of the service alias. :type name: str :param id: The ID of the service alias. :type id: str :param type: The type of the resource. :type type: str :param resource_name: The resource name of the service alias. :type resource_name: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'resource_name': {'key': 'resourceName', 'type': 'str'}, } def __init__( self, **kwargs ): super(AvailableServiceAlias, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.id = kwargs.get('id', None) self.type = kwargs.get('type', None) self.resource_name = kwargs.get('resource_name', None) class AvailableServiceAliasesResult(msrest.serialization.Model): """An array of available service aliases. Variables are only populated by the server, and will be ignored when sending a request. :param value: An array of available service aliases. :type value: list[~azure.mgmt.network.v2020_04_01.models.AvailableServiceAlias] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[AvailableServiceAlias]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(AvailableServiceAliasesResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class AzureAsyncOperationResult(msrest.serialization.Model): """The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. :param status: Status of the Azure async operation. Possible values include: "InProgress", "Succeeded", "Failed". :type status: str or ~azure.mgmt.network.v2020_04_01.models.NetworkOperationStatus :param error: Details of the error occurred during specified asynchronous operation. :type error: ~azure.mgmt.network.v2020_04_01.models.Error """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'error': {'key': 'error', 'type': 'Error'}, } def __init__( self, **kwargs ): super(AzureAsyncOperationResult, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.error = kwargs.get('error', None) class AzureFirewall(Resource): """Azure Firewall resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param zones: A list of availability zones denoting where the resource needs to come from. :type zones: list[str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param application_rule_collections: Collection of application rule collections used by Azure Firewall. :type application_rule_collections: list[~azure.mgmt.network.v2020_04_01.models.AzureFirewallApplicationRuleCollection] :param nat_rule_collections: Collection of NAT rule collections used by Azure Firewall. :type nat_rule_collections: list[~azure.mgmt.network.v2020_04_01.models.AzureFirewallNatRuleCollection] :param network_rule_collections: Collection of network rule collections used by Azure Firewall. :type network_rule_collections: list[~azure.mgmt.network.v2020_04_01.models.AzureFirewallNetworkRuleCollection] :param ip_configurations: IP configuration of the Azure Firewall resource. :type ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.AzureFirewallIPConfiguration] :param management_ip_configuration: IP configuration of the Azure Firewall used for management traffic. :type management_ip_configuration: ~azure.mgmt.network.v2020_04_01.models.AzureFirewallIPConfiguration :ivar provisioning_state: The provisioning state of the Azure firewall resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param threat_intel_mode: The operation mode for Threat Intelligence. Possible values include: "Alert", "Deny", "Off". :type threat_intel_mode: str or ~azure.mgmt.network.v2020_04_01.models.AzureFirewallThreatIntelMode :param virtual_hub: The virtualHub to which the firewall belongs. :type virtual_hub: ~azure.mgmt.network.v2020_04_01.models.SubResource :param firewall_policy: The firewallPolicy associated with this azure firewall. :type firewall_policy: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar hub_ip_addresses: IP addresses associated with AzureFirewall. :vartype hub_ip_addresses: ~azure.mgmt.network.v2020_04_01.models.HubIPAddresses :ivar ip_groups: IpGroups associated with AzureFirewall. :vartype ip_groups: list[~azure.mgmt.network.v2020_04_01.models.AzureFirewallIpGroups] :param sku: The Azure Firewall Resource SKU. :type sku: ~azure.mgmt.network.v2020_04_01.models.AzureFirewallSku :param additional_properties: The additional properties used to further config this azure firewall. :type additional_properties: dict[str, str] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'hub_ip_addresses': {'readonly': True}, 'ip_groups': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'zones': {'key': 'zones', 'type': '[str]'}, 'etag': {'key': 'etag', 'type': 'str'}, 'application_rule_collections': {'key': 'properties.applicationRuleCollections', 'type': '[AzureFirewallApplicationRuleCollection]'}, 'nat_rule_collections': {'key': 'properties.natRuleCollections', 'type': '[AzureFirewallNatRuleCollection]'}, 'network_rule_collections': {'key': 'properties.networkRuleCollections', 'type': '[AzureFirewallNetworkRuleCollection]'}, 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[AzureFirewallIPConfiguration]'}, 'management_ip_configuration': {'key': 'properties.managementIpConfiguration', 'type': 'AzureFirewallIPConfiguration'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'threat_intel_mode': {'key': 'properties.threatIntelMode', 'type': 'str'}, 'virtual_hub': {'key': 'properties.virtualHub', 'type': 'SubResource'}, 'firewall_policy': {'key': 'properties.firewallPolicy', 'type': 'SubResource'}, 'hub_ip_addresses': {'key': 'properties.hubIpAddresses', 'type': 'HubIPAddresses'}, 'ip_groups': {'key': 'properties.ipGroups', 'type': '[AzureFirewallIpGroups]'}, 'sku': {'key': 'properties.sku', 'type': 'AzureFirewallSku'}, 'additional_properties': {'key': 'properties.additionalProperties', 'type': '{str}'}, } def __init__( self, **kwargs ): super(AzureFirewall, self).__init__(**kwargs) self.zones = kwargs.get('zones', None) self.etag = None self.application_rule_collections = kwargs.get('application_rule_collections', None) self.nat_rule_collections = kwargs.get('nat_rule_collections', None) self.network_rule_collections = kwargs.get('network_rule_collections', None) self.ip_configurations = kwargs.get('ip_configurations', None) self.management_ip_configuration = kwargs.get('management_ip_configuration', None) self.provisioning_state = None self.threat_intel_mode = kwargs.get('threat_intel_mode', None) self.virtual_hub = kwargs.get('virtual_hub', None) self.firewall_policy = kwargs.get('firewall_policy', None) self.hub_ip_addresses = None self.ip_groups = None self.sku = kwargs.get('sku', None) self.additional_properties = kwargs.get('additional_properties', None) class AzureFirewallApplicationRule(msrest.serialization.Model): """Properties of an application rule. :param name: Name of the application rule. :type name: str :param description: Description of the rule. :type description: str :param source_addresses: List of source IP addresses for this rule. :type source_addresses: list[str] :param protocols: Array of ApplicationRuleProtocols. :type protocols: list[~azure.mgmt.network.v2020_04_01.models.AzureFirewallApplicationRuleProtocol] :param target_fqdns: List of FQDNs for this rule. :type target_fqdns: list[str] :param fqdn_tags: List of FQDN Tags for this rule. :type fqdn_tags: list[str] :param source_ip_groups: List of source IpGroups for this rule. :type source_ip_groups: list[str] """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'source_addresses': {'key': 'sourceAddresses', 'type': '[str]'}, 'protocols': {'key': 'protocols', 'type': '[AzureFirewallApplicationRuleProtocol]'}, 'target_fqdns': {'key': 'targetFqdns', 'type': '[str]'}, 'fqdn_tags': {'key': 'fqdnTags', 'type': '[str]'}, 'source_ip_groups': {'key': 'sourceIpGroups', 'type': '[str]'}, } def __init__( self, **kwargs ): super(AzureFirewallApplicationRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.description = kwargs.get('description', None) self.source_addresses = kwargs.get('source_addresses', None) self.protocols = kwargs.get('protocols', None) self.target_fqdns = kwargs.get('target_fqdns', None) self.fqdn_tags = kwargs.get('fqdn_tags', None) self.source_ip_groups = kwargs.get('source_ip_groups', None) class AzureFirewallApplicationRuleCollection(SubResource): """Application rule collection resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param priority: Priority of the application rule collection resource. :type priority: int :param action: The action type of a rule collection. :type action: ~azure.mgmt.network.v2020_04_01.models.AzureFirewallRCAction :param rules: Collection of rules used by a application rule collection. :type rules: list[~azure.mgmt.network.v2020_04_01.models.AzureFirewallApplicationRule] :ivar provisioning_state: The provisioning state of the application rule collection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'priority': {'maximum': 65000, 'minimum': 100}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'priority': {'key': 'properties.priority', 'type': 'int'}, 'action': {'key': 'properties.action', 'type': 'AzureFirewallRCAction'}, 'rules': {'key': 'properties.rules', 'type': '[AzureFirewallApplicationRule]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(AzureFirewallApplicationRuleCollection, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.priority = kwargs.get('priority', None) self.action = kwargs.get('action', None) self.rules = kwargs.get('rules', None) self.provisioning_state = None class AzureFirewallApplicationRuleProtocol(msrest.serialization.Model): """Properties of the application rule protocol. :param protocol_type: Protocol type. Possible values include: "Http", "Https", "Mssql". :type protocol_type: str or ~azure.mgmt.network.v2020_04_01.models.AzureFirewallApplicationRuleProtocolType :param port: Port number for the protocol, cannot be greater than 64000. This field is optional. :type port: int """ _validation = { 'port': {'maximum': 64000, 'minimum': 0}, } _attribute_map = { 'protocol_type': {'key': 'protocolType', 'type': 'str'}, 'port': {'key': 'port', 'type': 'int'}, } def __init__( self, **kwargs ): super(AzureFirewallApplicationRuleProtocol, self).__init__(**kwargs) self.protocol_type = kwargs.get('protocol_type', None) self.port = kwargs.get('port', None) class AzureFirewallFqdnTag(Resource): """Azure Firewall FQDN Tag Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar provisioning_state: The provisioning state of the Azure firewall FQDN tag resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :ivar fqdn_tag_name: The name of this FQDN Tag. :vartype fqdn_tag_name: str """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'fqdn_tag_name': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'fqdn_tag_name': {'key': 'properties.fqdnTagName', 'type': 'str'}, } def __init__( self, **kwargs ): super(AzureFirewallFqdnTag, self).__init__(**kwargs) self.etag = None self.provisioning_state = None self.fqdn_tag_name = None class AzureFirewallFqdnTagListResult(msrest.serialization.Model): """Response for ListAzureFirewallFqdnTags API service call. :param value: List of Azure Firewall FQDN Tags in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.AzureFirewallFqdnTag] :param next_link: URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[AzureFirewallFqdnTag]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(AzureFirewallFqdnTagListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class AzureFirewallIPConfiguration(SubResource): """IP configuration of an Azure Firewall. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :ivar private_ip_address: The Firewall Internal Load Balancer IP to be used as the next hop in User Defined Routes. :vartype private_ip_address: str :param subnet: Reference to the subnet resource. This resource must be named 'AzureFirewallSubnet' or 'AzureFirewallManagementSubnet'. :type subnet: ~azure.mgmt.network.v2020_04_01.models.SubResource :param public_ip_address: Reference to the PublicIP resource. This field is a mandatory input if subnet is not null. :type public_ip_address: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar provisioning_state: The provisioning state of the Azure firewall IP configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'private_ip_address': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'private_ip_address': {'key': 'properties.privateIPAddress', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'SubResource'}, 'public_ip_address': {'key': 'properties.publicIPAddress', 'type': 'SubResource'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(AzureFirewallIPConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.private_ip_address = None self.subnet = kwargs.get('subnet', None) self.public_ip_address = kwargs.get('public_ip_address', None) self.provisioning_state = None class AzureFirewallIpGroups(msrest.serialization.Model): """IpGroups associated with azure firewall. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource ID. :vartype id: str :ivar change_number: The iteration number. :vartype change_number: str """ _validation = { 'id': {'readonly': True}, 'change_number': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'change_number': {'key': 'changeNumber', 'type': 'str'}, } def __init__( self, **kwargs ): super(AzureFirewallIpGroups, self).__init__(**kwargs) self.id = None self.change_number = None class AzureFirewallListResult(msrest.serialization.Model): """Response for ListAzureFirewalls API service call. :param value: List of Azure Firewalls in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.AzureFirewall] :param next_link: URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[AzureFirewall]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(AzureFirewallListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class AzureFirewallNatRCAction(msrest.serialization.Model): """AzureFirewall NAT Rule Collection Action. :param type: The type of action. Possible values include: "Snat", "Dnat". :type type: str or ~azure.mgmt.network.v2020_04_01.models.AzureFirewallNatRCActionType """ _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, **kwargs ): super(AzureFirewallNatRCAction, self).__init__(**kwargs) self.type = kwargs.get('type', None) class AzureFirewallNatRule(msrest.serialization.Model): """Properties of a NAT rule. :param name: Name of the NAT rule. :type name: str :param description: Description of the rule. :type description: str :param source_addresses: List of source IP addresses for this rule. :type source_addresses: list[str] :param destination_addresses: List of destination IP addresses for this rule. Supports IP ranges, prefixes, and service tags. :type destination_addresses: list[str] :param destination_ports: List of destination ports. :type destination_ports: list[str] :param protocols: Array of AzureFirewallNetworkRuleProtocols applicable to this NAT rule. :type protocols: list[str or ~azure.mgmt.network.v2020_04_01.models.AzureFirewallNetworkRuleProtocol] :param translated_address: The translated address for this NAT rule. :type translated_address: str :param translated_port: The translated port for this NAT rule. :type translated_port: str :param translated_fqdn: The translated FQDN for this NAT rule. :type translated_fqdn: str :param source_ip_groups: List of source IpGroups for this rule. :type source_ip_groups: list[str] """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'source_addresses': {'key': 'sourceAddresses', 'type': '[str]'}, 'destination_addresses': {'key': 'destinationAddresses', 'type': '[str]'}, 'destination_ports': {'key': 'destinationPorts', 'type': '[str]'}, 'protocols': {'key': 'protocols', 'type': '[str]'}, 'translated_address': {'key': 'translatedAddress', 'type': 'str'}, 'translated_port': {'key': 'translatedPort', 'type': 'str'}, 'translated_fqdn': {'key': 'translatedFqdn', 'type': 'str'}, 'source_ip_groups': {'key': 'sourceIpGroups', 'type': '[str]'}, } def __init__( self, **kwargs ): super(AzureFirewallNatRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.description = kwargs.get('description', None) self.source_addresses = kwargs.get('source_addresses', None) self.destination_addresses = kwargs.get('destination_addresses', None) self.destination_ports = kwargs.get('destination_ports', None) self.protocols = kwargs.get('protocols', None) self.translated_address = kwargs.get('translated_address', None) self.translated_port = kwargs.get('translated_port', None) self.translated_fqdn = kwargs.get('translated_fqdn', None) self.source_ip_groups = kwargs.get('source_ip_groups', None) class AzureFirewallNatRuleCollection(SubResource): """NAT rule collection resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param priority: Priority of the NAT rule collection resource. :type priority: int :param action: The action type of a NAT rule collection. :type action: ~azure.mgmt.network.v2020_04_01.models.AzureFirewallNatRCAction :param rules: Collection of rules used by a NAT rule collection. :type rules: list[~azure.mgmt.network.v2020_04_01.models.AzureFirewallNatRule] :ivar provisioning_state: The provisioning state of the NAT rule collection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'priority': {'maximum': 65000, 'minimum': 100}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'priority': {'key': 'properties.priority', 'type': 'int'}, 'action': {'key': 'properties.action', 'type': 'AzureFirewallNatRCAction'}, 'rules': {'key': 'properties.rules', 'type': '[AzureFirewallNatRule]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(AzureFirewallNatRuleCollection, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.priority = kwargs.get('priority', None) self.action = kwargs.get('action', None) self.rules = kwargs.get('rules', None) self.provisioning_state = None class AzureFirewallNetworkRule(msrest.serialization.Model): """Properties of the network rule. :param name: Name of the network rule. :type name: str :param description: Description of the rule. :type description: str :param protocols: Array of AzureFirewallNetworkRuleProtocols. :type protocols: list[str or ~azure.mgmt.network.v2020_04_01.models.AzureFirewallNetworkRuleProtocol] :param source_addresses: List of source IP addresses for this rule. :type source_addresses: list[str] :param destination_addresses: List of destination IP addresses. :type destination_addresses: list[str] :param destination_ports: List of destination ports. :type destination_ports: list[str] :param destination_fqdns: List of destination FQDNs. :type destination_fqdns: list[str] :param source_ip_groups: List of source IpGroups for this rule. :type source_ip_groups: list[str] :param destination_ip_groups: List of destination IpGroups for this rule. :type destination_ip_groups: list[str] """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'protocols': {'key': 'protocols', 'type': '[str]'}, 'source_addresses': {'key': 'sourceAddresses', 'type': '[str]'}, 'destination_addresses': {'key': 'destinationAddresses', 'type': '[str]'}, 'destination_ports': {'key': 'destinationPorts', 'type': '[str]'}, 'destination_fqdns': {'key': 'destinationFqdns', 'type': '[str]'}, 'source_ip_groups': {'key': 'sourceIpGroups', 'type': '[str]'}, 'destination_ip_groups': {'key': 'destinationIpGroups', 'type': '[str]'}, } def __init__( self, **kwargs ): super(AzureFirewallNetworkRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.description = kwargs.get('description', None) self.protocols = kwargs.get('protocols', None) self.source_addresses = kwargs.get('source_addresses', None) self.destination_addresses = kwargs.get('destination_addresses', None) self.destination_ports = kwargs.get('destination_ports', None) self.destination_fqdns = kwargs.get('destination_fqdns', None) self.source_ip_groups = kwargs.get('source_ip_groups', None) self.destination_ip_groups = kwargs.get('destination_ip_groups', None) class AzureFirewallNetworkRuleCollection(SubResource): """Network rule collection resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param priority: Priority of the network rule collection resource. :type priority: int :param action: The action type of a rule collection. :type action: ~azure.mgmt.network.v2020_04_01.models.AzureFirewallRCAction :param rules: Collection of rules used by a network rule collection. :type rules: list[~azure.mgmt.network.v2020_04_01.models.AzureFirewallNetworkRule] :ivar provisioning_state: The provisioning state of the network rule collection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'priority': {'maximum': 65000, 'minimum': 100}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'priority': {'key': 'properties.priority', 'type': 'int'}, 'action': {'key': 'properties.action', 'type': 'AzureFirewallRCAction'}, 'rules': {'key': 'properties.rules', 'type': '[AzureFirewallNetworkRule]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(AzureFirewallNetworkRuleCollection, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.priority = kwargs.get('priority', None) self.action = kwargs.get('action', None) self.rules = kwargs.get('rules', None) self.provisioning_state = None class AzureFirewallPublicIPAddress(msrest.serialization.Model): """Public IP Address associated with azure firewall. :param address: Public IP Address value. :type address: str """ _attribute_map = { 'address': {'key': 'address', 'type': 'str'}, } def __init__( self, **kwargs ): super(AzureFirewallPublicIPAddress, self).__init__(**kwargs) self.address = kwargs.get('address', None) class AzureFirewallRCAction(msrest.serialization.Model): """Properties of the AzureFirewallRCAction. :param type: The type of action. Possible values include: "Allow", "Deny". :type type: str or ~azure.mgmt.network.v2020_04_01.models.AzureFirewallRCActionType """ _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, **kwargs ): super(AzureFirewallRCAction, self).__init__(**kwargs) self.type = kwargs.get('type', None) class AzureFirewallSku(msrest.serialization.Model): """SKU of an Azure Firewall. :param name: Name of an Azure Firewall SKU. Possible values include: "AZFW_VNet", "AZFW_Hub". :type name: str or ~azure.mgmt.network.v2020_04_01.models.AzureFirewallSkuName :param tier: Tier of an Azure Firewall. Possible values include: "Standard", "Premium". :type tier: str or ~azure.mgmt.network.v2020_04_01.models.AzureFirewallSkuTier """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'tier': {'key': 'tier', 'type': 'str'}, } def __init__( self, **kwargs ): super(AzureFirewallSku, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) class AzureReachabilityReport(msrest.serialization.Model): """Azure reachability report details. All required parameters must be populated in order to send to Azure. :param aggregation_level: Required. The aggregation level of Azure reachability report. Can be Country, State or City. :type aggregation_level: str :param provider_location: Required. Parameters that define a geographic location. :type provider_location: ~azure.mgmt.network.v2020_04_01.models.AzureReachabilityReportLocation :param reachability_report: Required. List of Azure reachability report items. :type reachability_report: list[~azure.mgmt.network.v2020_04_01.models.AzureReachabilityReportItem] """ _validation = { 'aggregation_level': {'required': True}, 'provider_location': {'required': True}, 'reachability_report': {'required': True}, } _attribute_map = { 'aggregation_level': {'key': 'aggregationLevel', 'type': 'str'}, 'provider_location': {'key': 'providerLocation', 'type': 'AzureReachabilityReportLocation'}, 'reachability_report': {'key': 'reachabilityReport', 'type': '[AzureReachabilityReportItem]'}, } def __init__( self, **kwargs ): super(AzureReachabilityReport, self).__init__(**kwargs) self.aggregation_level = kwargs['aggregation_level'] self.provider_location = kwargs['provider_location'] self.reachability_report = kwargs['reachability_report'] class AzureReachabilityReportItem(msrest.serialization.Model): """Azure reachability report details for a given provider location. :param provider: The Internet service provider. :type provider: str :param azure_location: The Azure region. :type azure_location: str :param latencies: List of latency details for each of the time series. :type latencies: list[~azure.mgmt.network.v2020_04_01.models.AzureReachabilityReportLatencyInfo] """ _attribute_map = { 'provider': {'key': 'provider', 'type': 'str'}, 'azure_location': {'key': 'azureLocation', 'type': 'str'}, 'latencies': {'key': 'latencies', 'type': '[AzureReachabilityReportLatencyInfo]'}, } def __init__( self, **kwargs ): super(AzureReachabilityReportItem, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.azure_location = kwargs.get('azure_location', None) self.latencies = kwargs.get('latencies', None) class AzureReachabilityReportLatencyInfo(msrest.serialization.Model): """Details on latency for a time series. :param time_stamp: The time stamp. :type time_stamp: ~datetime.datetime :param score: The relative latency score between 1 and 100, higher values indicating a faster connection. :type score: int """ _validation = { 'score': {'maximum': 100, 'minimum': 1}, } _attribute_map = { 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'}, 'score': {'key': 'score', 'type': 'int'}, } def __init__( self, **kwargs ): super(AzureReachabilityReportLatencyInfo, self).__init__(**kwargs) self.time_stamp = kwargs.get('time_stamp', None) self.score = kwargs.get('score', None) class AzureReachabilityReportLocation(msrest.serialization.Model): """Parameters that define a geographic location. All required parameters must be populated in order to send to Azure. :param country: Required. The name of the country. :type country: str :param state: The name of the state. :type state: str :param city: The name of the city or town. :type city: str """ _validation = { 'country': {'required': True}, } _attribute_map = { 'country': {'key': 'country', 'type': 'str'}, 'state': {'key': 'state', 'type': 'str'}, 'city': {'key': 'city', 'type': 'str'}, } def __init__( self, **kwargs ): super(AzureReachabilityReportLocation, self).__init__(**kwargs) self.country = kwargs['country'] self.state = kwargs.get('state', None) self.city = kwargs.get('city', None) class AzureReachabilityReportParameters(msrest.serialization.Model): """Geographic and time constraints for Azure reachability report. All required parameters must be populated in order to send to Azure. :param provider_location: Required. Parameters that define a geographic location. :type provider_location: ~azure.mgmt.network.v2020_04_01.models.AzureReachabilityReportLocation :param providers: List of Internet service providers. :type providers: list[str] :param azure_locations: Optional Azure regions to scope the query to. :type azure_locations: list[str] :param start_time: Required. The start time for the Azure reachability report. :type start_time: ~datetime.datetime :param end_time: Required. The end time for the Azure reachability report. :type end_time: ~datetime.datetime """ _validation = { 'provider_location': {'required': True}, 'start_time': {'required': True}, 'end_time': {'required': True}, } _attribute_map = { 'provider_location': {'key': 'providerLocation', 'type': 'AzureReachabilityReportLocation'}, 'providers': {'key': 'providers', 'type': '[str]'}, 'azure_locations': {'key': 'azureLocations', 'type': '[str]'}, 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, } def __init__( self, **kwargs ): super(AzureReachabilityReportParameters, self).__init__(**kwargs) self.provider_location = kwargs['provider_location'] self.providers = kwargs.get('providers', None) self.azure_locations = kwargs.get('azure_locations', None) self.start_time = kwargs['start_time'] self.end_time = kwargs['end_time'] class BackendAddressPool(SubResource): """Pool of backend IP addresses. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within the set of backend address pools used by the load balancer. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param load_balancer_backend_addresses: An array of backend addresses. :type load_balancer_backend_addresses: list[~azure.mgmt.network.v2020_04_01.models.LoadBalancerBackendAddress] :ivar backend_ip_configurations: An array of references to IP addresses defined in network interfaces. :vartype backend_ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.NetworkInterfaceIPConfiguration] :ivar load_balancing_rules: An array of references to load balancing rules that use this backend address pool. :vartype load_balancing_rules: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar outbound_rule: A reference to an outbound rule that uses this backend address pool. :vartype outbound_rule: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar outbound_rules: An array of references to outbound rules that use this backend address pool. :vartype outbound_rules: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar provisioning_state: The provisioning state of the backend address pool resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'backend_ip_configurations': {'readonly': True}, 'load_balancing_rules': {'readonly': True}, 'outbound_rule': {'readonly': True}, 'outbound_rules': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'load_balancer_backend_addresses': {'key': 'properties.loadBalancerBackendAddresses', 'type': '[LoadBalancerBackendAddress]'}, 'backend_ip_configurations': {'key': 'properties.backendIPConfigurations', 'type': '[NetworkInterfaceIPConfiguration]'}, 'load_balancing_rules': {'key': 'properties.loadBalancingRules', 'type': '[SubResource]'}, 'outbound_rule': {'key': 'properties.outboundRule', 'type': 'SubResource'}, 'outbound_rules': {'key': 'properties.outboundRules', 'type': '[SubResource]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(BackendAddressPool, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.load_balancer_backend_addresses = kwargs.get('load_balancer_backend_addresses', None) self.backend_ip_configurations = None self.load_balancing_rules = None self.outbound_rule = None self.outbound_rules = None self.provisioning_state = None class BastionActiveSession(msrest.serialization.Model): """The session detail for a target. Variables are only populated by the server, and will be ignored when sending a request. :ivar session_id: A unique id for the session. :vartype session_id: str :ivar start_time: The time when the session started. :vartype start_time: any :ivar target_subscription_id: The subscription id for the target virtual machine. :vartype target_subscription_id: str :ivar resource_type: The type of the resource. :vartype resource_type: str :ivar target_host_name: The host name of the target. :vartype target_host_name: str :ivar target_resource_group: The resource group of the target. :vartype target_resource_group: str :ivar user_name: The user name who is active on this session. :vartype user_name: str :ivar target_ip_address: The IP Address of the target. :vartype target_ip_address: str :ivar protocol: The protocol used to connect to the target. Possible values include: "SSH", "RDP". :vartype protocol: str or ~azure.mgmt.network.v2020_04_01.models.BastionConnectProtocol :ivar target_resource_id: The resource id of the target. :vartype target_resource_id: str :ivar session_duration_in_mins: Duration in mins the session has been active. :vartype session_duration_in_mins: float """ _validation = { 'session_id': {'readonly': True}, 'start_time': {'readonly': True}, 'target_subscription_id': {'readonly': True}, 'resource_type': {'readonly': True}, 'target_host_name': {'readonly': True}, 'target_resource_group': {'readonly': True}, 'user_name': {'readonly': True}, 'target_ip_address': {'readonly': True}, 'protocol': {'readonly': True}, 'target_resource_id': {'readonly': True}, 'session_duration_in_mins': {'readonly': True}, } _attribute_map = { 'session_id': {'key': 'sessionId', 'type': 'str'}, 'start_time': {'key': 'startTime', 'type': 'object'}, 'target_subscription_id': {'key': 'targetSubscriptionId', 'type': 'str'}, 'resource_type': {'key': 'resourceType', 'type': 'str'}, 'target_host_name': {'key': 'targetHostName', 'type': 'str'}, 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, 'user_name': {'key': 'userName', 'type': 'str'}, 'target_ip_address': {'key': 'targetIpAddress', 'type': 'str'}, 'protocol': {'key': 'protocol', 'type': 'str'}, 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, 'session_duration_in_mins': {'key': 'sessionDurationInMins', 'type': 'float'}, } def __init__( self, **kwargs ): super(BastionActiveSession, self).__init__(**kwargs) self.session_id = None self.start_time = None self.target_subscription_id = None self.resource_type = None self.target_host_name = None self.target_resource_group = None self.user_name = None self.target_ip_address = None self.protocol = None self.target_resource_id = None self.session_duration_in_mins = None class BastionActiveSessionListResult(msrest.serialization.Model): """Response for GetActiveSessions. :param value: List of active sessions on the bastion. :type value: list[~azure.mgmt.network.v2020_04_01.models.BastionActiveSession] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[BastionActiveSession]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(BastionActiveSessionListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class BastionHost(Resource): """Bastion Host resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param ip_configurations: IP configuration of the Bastion Host resource. :type ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.BastionHostIPConfiguration] :param dns_name: FQDN for the endpoint on which bastion host is accessible. :type dns_name: str :ivar provisioning_state: The provisioning state of the bastion host resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[BastionHostIPConfiguration]'}, 'dns_name': {'key': 'properties.dnsName', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(BastionHost, self).__init__(**kwargs) self.etag = None self.ip_configurations = kwargs.get('ip_configurations', None) self.dns_name = kwargs.get('dns_name', None) self.provisioning_state = None class BastionHostIPConfiguration(SubResource): """IP configuration of an Bastion Host. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Ip configuration type. :vartype type: str :param subnet: Reference of the subnet resource. :type subnet: ~azure.mgmt.network.v2020_04_01.models.SubResource :param public_ip_address: Reference of the PublicIP resource. :type public_ip_address: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar provisioning_state: The provisioning state of the bastion host IP configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param private_ip_allocation_method: Private IP allocation method. Possible values include: "Static", "Dynamic". :type private_ip_allocation_method: str or ~azure.mgmt.network.v2020_04_01.models.IPAllocationMethod """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'SubResource'}, 'public_ip_address': {'key': 'properties.publicIPAddress', 'type': 'SubResource'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'private_ip_allocation_method': {'key': 'properties.privateIPAllocationMethod', 'type': 'str'}, } def __init__( self, **kwargs ): super(BastionHostIPConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.subnet = kwargs.get('subnet', None) self.public_ip_address = kwargs.get('public_ip_address', None) self.provisioning_state = None self.private_ip_allocation_method = kwargs.get('private_ip_allocation_method', None) class BastionHostListResult(msrest.serialization.Model): """Response for ListBastionHosts API service call. :param value: List of Bastion Hosts in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.BastionHost] :param next_link: URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[BastionHost]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(BastionHostListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class BastionSessionDeleteResult(msrest.serialization.Model): """Response for DisconnectActiveSessions. :param value: List of sessions with their corresponding state. :type value: list[~azure.mgmt.network.v2020_04_01.models.BastionSessionState] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[BastionSessionState]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(BastionSessionDeleteResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class BastionSessionState(msrest.serialization.Model): """The session state detail for a target. Variables are only populated by the server, and will be ignored when sending a request. :ivar session_id: A unique id for the session. :vartype session_id: str :ivar message: Used for extra information. :vartype message: str :ivar state: The state of the session. Disconnected/Failed/NotFound. :vartype state: str """ _validation = { 'session_id': {'readonly': True}, 'message': {'readonly': True}, 'state': {'readonly': True}, } _attribute_map = { 'session_id': {'key': 'sessionId', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'state': {'key': 'state', 'type': 'str'}, } def __init__( self, **kwargs ): super(BastionSessionState, self).__init__(**kwargs) self.session_id = None self.message = None self.state = None class BastionShareableLink(msrest.serialization.Model): """Bastion Shareable Link. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param vm: Required. Reference of the virtual machine resource. :type vm: ~azure.mgmt.network.v2020_04_01.models.VM :ivar bsl: The unique Bastion Shareable Link to the virtual machine. :vartype bsl: str :ivar created_at: The time when the link was created. :vartype created_at: str :ivar message: Optional field indicating the warning or error message related to the vm in case of partial failure. :vartype message: str """ _validation = { 'vm': {'required': True}, 'bsl': {'readonly': True}, 'created_at': {'readonly': True}, 'message': {'readonly': True}, } _attribute_map = { 'vm': {'key': 'vm', 'type': 'VM'}, 'bsl': {'key': 'bsl', 'type': 'str'}, 'created_at': {'key': 'createdAt', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } def __init__( self, **kwargs ): super(BastionShareableLink, self).__init__(**kwargs) self.vm = kwargs['vm'] self.bsl = None self.created_at = None self.message = None class BastionShareableLinkListRequest(msrest.serialization.Model): """Post request for all the Bastion Shareable Link endpoints. :param vms: List of VM references. :type vms: list[~azure.mgmt.network.v2020_04_01.models.BastionShareableLink] """ _attribute_map = { 'vms': {'key': 'vms', 'type': '[BastionShareableLink]'}, } def __init__( self, **kwargs ): super(BastionShareableLinkListRequest, self).__init__(**kwargs) self.vms = kwargs.get('vms', None) class BastionShareableLinkListResult(msrest.serialization.Model): """Response for all the Bastion Shareable Link endpoints. :param value: List of Bastion Shareable Links for the request. :type value: list[~azure.mgmt.network.v2020_04_01.models.BastionShareableLink] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[BastionShareableLink]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(BastionShareableLinkListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class BGPCommunity(msrest.serialization.Model): """Contains bgp community information offered in Service Community resources. :param service_supported_region: The region which the service support. e.g. For O365, region is Global. :type service_supported_region: str :param community_name: The name of the bgp community. e.g. Skype. :type community_name: str :param community_value: The value of the bgp community. For more information: https://docs.microsoft.com/en-us/azure/expressroute/expressroute-routing. :type community_value: str :param community_prefixes: The prefixes that the bgp community contains. :type community_prefixes: list[str] :param is_authorized_to_use: Customer is authorized to use bgp community or not. :type is_authorized_to_use: bool :param service_group: The service group of the bgp community contains. :type service_group: str """ _attribute_map = { 'service_supported_region': {'key': 'serviceSupportedRegion', 'type': 'str'}, 'community_name': {'key': 'communityName', 'type': 'str'}, 'community_value': {'key': 'communityValue', 'type': 'str'}, 'community_prefixes': {'key': 'communityPrefixes', 'type': '[str]'}, 'is_authorized_to_use': {'key': 'isAuthorizedToUse', 'type': 'bool'}, 'service_group': {'key': 'serviceGroup', 'type': 'str'}, } def __init__( self, **kwargs ): super(BGPCommunity, self).__init__(**kwargs) self.service_supported_region = kwargs.get('service_supported_region', None) self.community_name = kwargs.get('community_name', None) self.community_value = kwargs.get('community_value', None) self.community_prefixes = kwargs.get('community_prefixes', None) self.is_authorized_to_use = kwargs.get('is_authorized_to_use', None) self.service_group = kwargs.get('service_group', None) class BgpPeerStatus(msrest.serialization.Model): """BGP peer status details. Variables are only populated by the server, and will be ignored when sending a request. :ivar local_address: The virtual network gateway's local address. :vartype local_address: str :ivar neighbor: The remote BGP peer. :vartype neighbor: str :ivar asn: The autonomous system number of the remote BGP peer. :vartype asn: long :ivar state: The BGP peer state. Possible values include: "Unknown", "Stopped", "Idle", "Connecting", "Connected". :vartype state: str or ~azure.mgmt.network.v2020_04_01.models.BgpPeerState :ivar connected_duration: For how long the peering has been up. :vartype connected_duration: str :ivar routes_received: The number of routes learned from this peer. :vartype routes_received: long :ivar messages_sent: The number of BGP messages sent. :vartype messages_sent: long :ivar messages_received: The number of BGP messages received. :vartype messages_received: long """ _validation = { 'local_address': {'readonly': True}, 'neighbor': {'readonly': True}, 'asn': {'readonly': True, 'maximum': 4294967295, 'minimum': 0}, 'state': {'readonly': True}, 'connected_duration': {'readonly': True}, 'routes_received': {'readonly': True}, 'messages_sent': {'readonly': True}, 'messages_received': {'readonly': True}, } _attribute_map = { 'local_address': {'key': 'localAddress', 'type': 'str'}, 'neighbor': {'key': 'neighbor', 'type': 'str'}, 'asn': {'key': 'asn', 'type': 'long'}, 'state': {'key': 'state', 'type': 'str'}, 'connected_duration': {'key': 'connectedDuration', 'type': 'str'}, 'routes_received': {'key': 'routesReceived', 'type': 'long'}, 'messages_sent': {'key': 'messagesSent', 'type': 'long'}, 'messages_received': {'key': 'messagesReceived', 'type': 'long'}, } def __init__( self, **kwargs ): super(BgpPeerStatus, self).__init__(**kwargs) self.local_address = None self.neighbor = None self.asn = None self.state = None self.connected_duration = None self.routes_received = None self.messages_sent = None self.messages_received = None class BgpPeerStatusListResult(msrest.serialization.Model): """Response for list BGP peer status API service call. :param value: List of BGP peers. :type value: list[~azure.mgmt.network.v2020_04_01.models.BgpPeerStatus] """ _attribute_map = { 'value': {'key': 'value', 'type': '[BgpPeerStatus]'}, } def __init__( self, **kwargs ): super(BgpPeerStatusListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) class BgpServiceCommunity(Resource): """Service Community Properties. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param service_name: The name of the bgp community. e.g. Skype. :type service_name: str :param bgp_communities: A list of bgp communities. :type bgp_communities: list[~azure.mgmt.network.v2020_04_01.models.BGPCommunity] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'service_name': {'key': 'properties.serviceName', 'type': 'str'}, 'bgp_communities': {'key': 'properties.bgpCommunities', 'type': '[BGPCommunity]'}, } def __init__( self, **kwargs ): super(BgpServiceCommunity, self).__init__(**kwargs) self.service_name = kwargs.get('service_name', None) self.bgp_communities = kwargs.get('bgp_communities', None) class BgpServiceCommunityListResult(msrest.serialization.Model): """Response for the ListServiceCommunity API service call. :param value: A list of service community resources. :type value: list[~azure.mgmt.network.v2020_04_01.models.BgpServiceCommunity] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[BgpServiceCommunity]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(BgpServiceCommunityListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class BgpSettings(msrest.serialization.Model): """BGP settings details. :param asn: The BGP speaker's ASN. :type asn: long :param bgp_peering_address: The BGP peering address and BGP identifier of this BGP speaker. :type bgp_peering_address: str :param peer_weight: The weight added to routes learned from this BGP speaker. :type peer_weight: int :param bgp_peering_addresses: BGP peering address with IP configuration ID for virtual network gateway. :type bgp_peering_addresses: list[~azure.mgmt.network.v2020_04_01.models.IPConfigurationBgpPeeringAddress] """ _validation = { 'asn': {'maximum': 4294967295, 'minimum': 0}, } _attribute_map = { 'asn': {'key': 'asn', 'type': 'long'}, 'bgp_peering_address': {'key': 'bgpPeeringAddress', 'type': 'str'}, 'peer_weight': {'key': 'peerWeight', 'type': 'int'}, 'bgp_peering_addresses': {'key': 'bgpPeeringAddresses', 'type': '[IPConfigurationBgpPeeringAddress]'}, } def __init__( self, **kwargs ): super(BgpSettings, self).__init__(**kwargs) self.asn = kwargs.get('asn', None) self.bgp_peering_address = kwargs.get('bgp_peering_address', None) self.peer_weight = kwargs.get('peer_weight', None) self.bgp_peering_addresses = kwargs.get('bgp_peering_addresses', None) class CheckPrivateLinkServiceVisibilityRequest(msrest.serialization.Model): """Request body of the CheckPrivateLinkServiceVisibility API service call. :param private_link_service_alias: The alias of the private link service. :type private_link_service_alias: str """ _attribute_map = { 'private_link_service_alias': {'key': 'privateLinkServiceAlias', 'type': 'str'}, } def __init__( self, **kwargs ): super(CheckPrivateLinkServiceVisibilityRequest, self).__init__(**kwargs) self.private_link_service_alias = kwargs.get('private_link_service_alias', None) class CloudErrorBody(msrest.serialization.Model): """An error response from the service. :param code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. :type code: str :param message: A message describing the error, intended to be suitable for display in a user interface. :type message: str :param target: The target of the particular error. For example, the name of the property in error. :type target: str :param details: A list of additional details about the error. :type details: list[~azure.mgmt.network.v2020_04_01.models.CloudErrorBody] """ _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, } def __init__( self, **kwargs ): super(CloudErrorBody, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) self.target = kwargs.get('target', None) self.details = kwargs.get('details', None) class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. Variables are only populated by the server, and will be ignored when sending a request. :ivar principal_id: The principal id of user assigned identity. :vartype principal_id: str :ivar client_id: The client id of user assigned identity. :vartype client_id: str """ _validation = { 'principal_id': {'readonly': True}, 'client_id': {'readonly': True}, } _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, } def __init__( self, **kwargs ): super(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) self.principal_id = None self.client_id = None class ConnectionMonitor(msrest.serialization.Model): """Parameters that define the operation to create a connection monitor. :param location: Connection monitor location. :type location: str :param tags: A set of tags. Connection monitor tags. :type tags: dict[str, str] :param source: Describes the source of connection monitor. :type source: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorSource :param destination: Describes the destination of connection monitor. :type destination: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorDestination :param auto_start: Determines if the connection monitor will start automatically once created. :type auto_start: bool :param monitoring_interval_in_seconds: Monitoring interval in seconds. :type monitoring_interval_in_seconds: int :param endpoints: List of connection monitor endpoints. :type endpoints: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorEndpoint] :param test_configurations: List of connection monitor test configurations. :type test_configurations: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorTestConfiguration] :param test_groups: List of connection monitor test groups. :type test_groups: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorTestGroup] :param outputs: List of connection monitor outputs. :type outputs: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorOutput] :param notes: Optional notes to be associated with the connection monitor. :type notes: str """ _attribute_map = { 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'source': {'key': 'properties.source', 'type': 'ConnectionMonitorSource'}, 'destination': {'key': 'properties.destination', 'type': 'ConnectionMonitorDestination'}, 'auto_start': {'key': 'properties.autoStart', 'type': 'bool'}, 'monitoring_interval_in_seconds': {'key': 'properties.monitoringIntervalInSeconds', 'type': 'int'}, 'endpoints': {'key': 'properties.endpoints', 'type': '[ConnectionMonitorEndpoint]'}, 'test_configurations': {'key': 'properties.testConfigurations', 'type': '[ConnectionMonitorTestConfiguration]'}, 'test_groups': {'key': 'properties.testGroups', 'type': '[ConnectionMonitorTestGroup]'}, 'outputs': {'key': 'properties.outputs', 'type': '[ConnectionMonitorOutput]'}, 'notes': {'key': 'properties.notes', 'type': 'str'}, } def __init__( self, **kwargs ): super(ConnectionMonitor, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) self.source = kwargs.get('source', None) self.destination = kwargs.get('destination', None) self.auto_start = kwargs.get('auto_start', True) self.monitoring_interval_in_seconds = kwargs.get('monitoring_interval_in_seconds', 60) self.endpoints = kwargs.get('endpoints', None) self.test_configurations = kwargs.get('test_configurations', None) self.test_groups = kwargs.get('test_groups', None) self.outputs = kwargs.get('outputs', None) self.notes = kwargs.get('notes', None) class ConnectionMonitorDestination(msrest.serialization.Model): """Describes the destination of connection monitor. :param resource_id: The ID of the resource used as the destination by connection monitor. :type resource_id: str :param address: Address of the connection monitor destination (IP or domain name). :type address: str :param port: The destination port used by connection monitor. :type port: int """ _attribute_map = { 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'address': {'key': 'address', 'type': 'str'}, 'port': {'key': 'port', 'type': 'int'}, } def __init__( self, **kwargs ): super(ConnectionMonitorDestination, self).__init__(**kwargs) self.resource_id = kwargs.get('resource_id', None) self.address = kwargs.get('address', None) self.port = kwargs.get('port', None) class ConnectionMonitorEndpoint(msrest.serialization.Model): """Describes the connection monitor endpoint. All required parameters must be populated in order to send to Azure. :param name: Required. The name of the connection monitor endpoint. :type name: str :param resource_id: Resource ID of the connection monitor endpoint. :type resource_id: str :param address: Address of the connection monitor endpoint (IP or domain name). :type address: str :param filter: Filter for sub-items within the endpoint. :type filter: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorEndpointFilter """ _validation = { 'name': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'address': {'key': 'address', 'type': 'str'}, 'filter': {'key': 'filter', 'type': 'ConnectionMonitorEndpointFilter'}, } def __init__( self, **kwargs ): super(ConnectionMonitorEndpoint, self).__init__(**kwargs) self.name = kwargs['name'] self.resource_id = kwargs.get('resource_id', None) self.address = kwargs.get('address', None) self.filter = kwargs.get('filter', None) class ConnectionMonitorEndpointFilter(msrest.serialization.Model): """Describes the connection monitor endpoint filter. :param type: The behavior of the endpoint filter. Currently only 'Include' is supported. Possible values include: "Include". :type type: str or ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorEndpointFilterType :param items: List of items in the filter. :type items: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorEndpointFilterItem] """ _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'items': {'key': 'items', 'type': '[ConnectionMonitorEndpointFilterItem]'}, } def __init__( self, **kwargs ): super(ConnectionMonitorEndpointFilter, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.items = kwargs.get('items', None) class ConnectionMonitorEndpointFilterItem(msrest.serialization.Model): """Describes the connection monitor endpoint filter item. :param type: The type of item included in the filter. Currently only 'AgentAddress' is supported. Possible values include: "AgentAddress". :type type: str or ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorEndpointFilterItemType :param address: The address of the filter item. :type address: str """ _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'address': {'key': 'address', 'type': 'str'}, } def __init__( self, **kwargs ): super(ConnectionMonitorEndpointFilterItem, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.address = kwargs.get('address', None) class ConnectionMonitorHttpConfiguration(msrest.serialization.Model): """Describes the HTTP configuration. :param port: The port to connect to. :type port: int :param method: The HTTP method to use. Possible values include: "Get", "Post". :type method: str or ~azure.mgmt.network.v2020_04_01.models.HTTPConfigurationMethod :param path: The path component of the URI. For instance, "/dir1/dir2". :type path: str :param request_headers: The HTTP headers to transmit with the request. :type request_headers: list[~azure.mgmt.network.v2020_04_01.models.HTTPHeader] :param valid_status_code_ranges: HTTP status codes to consider successful. For instance, "2xx,301-304,418". :type valid_status_code_ranges: list[str] :param prefer_https: Value indicating whether HTTPS is preferred over HTTP in cases where the choice is not explicit. :type prefer_https: bool """ _attribute_map = { 'port': {'key': 'port', 'type': 'int'}, 'method': {'key': 'method', 'type': 'str'}, 'path': {'key': 'path', 'type': 'str'}, 'request_headers': {'key': 'requestHeaders', 'type': '[HTTPHeader]'}, 'valid_status_code_ranges': {'key': 'validStatusCodeRanges', 'type': '[str]'}, 'prefer_https': {'key': 'preferHTTPS', 'type': 'bool'}, } def __init__( self, **kwargs ): super(ConnectionMonitorHttpConfiguration, self).__init__(**kwargs) self.port = kwargs.get('port', None) self.method = kwargs.get('method', None) self.path = kwargs.get('path', None) self.request_headers = kwargs.get('request_headers', None) self.valid_status_code_ranges = kwargs.get('valid_status_code_ranges', None) self.prefer_https = kwargs.get('prefer_https', None) class ConnectionMonitorIcmpConfiguration(msrest.serialization.Model): """Describes the ICMP configuration. :param disable_trace_route: Value indicating whether path evaluation with trace route should be disabled. :type disable_trace_route: bool """ _attribute_map = { 'disable_trace_route': {'key': 'disableTraceRoute', 'type': 'bool'}, } def __init__( self, **kwargs ): super(ConnectionMonitorIcmpConfiguration, self).__init__(**kwargs) self.disable_trace_route = kwargs.get('disable_trace_route', None) class ConnectionMonitorListResult(msrest.serialization.Model): """List of connection monitors. :param value: Information about connection monitors. :type value: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorResult] """ _attribute_map = { 'value': {'key': 'value', 'type': '[ConnectionMonitorResult]'}, } def __init__( self, **kwargs ): super(ConnectionMonitorListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) class ConnectionMonitorOutput(msrest.serialization.Model): """Describes a connection monitor output destination. :param type: Connection monitor output destination type. Currently, only "Workspace" is supported. Possible values include: "Workspace". :type type: str or ~azure.mgmt.network.v2020_04_01.models.OutputType :param workspace_settings: Describes the settings for producing output into a log analytics workspace. :type workspace_settings: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorWorkspaceSettings """ _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'workspace_settings': {'key': 'workspaceSettings', 'type': 'ConnectionMonitorWorkspaceSettings'}, } def __init__( self, **kwargs ): super(ConnectionMonitorOutput, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.workspace_settings = kwargs.get('workspace_settings', None) class ConnectionMonitorParameters(msrest.serialization.Model): """Parameters that define the operation to create a connection monitor. :param source: Describes the source of connection monitor. :type source: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorSource :param destination: Describes the destination of connection monitor. :type destination: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorDestination :param auto_start: Determines if the connection monitor will start automatically once created. :type auto_start: bool :param monitoring_interval_in_seconds: Monitoring interval in seconds. :type monitoring_interval_in_seconds: int :param endpoints: List of connection monitor endpoints. :type endpoints: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorEndpoint] :param test_configurations: List of connection monitor test configurations. :type test_configurations: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorTestConfiguration] :param test_groups: List of connection monitor test groups. :type test_groups: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorTestGroup] :param outputs: List of connection monitor outputs. :type outputs: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorOutput] :param notes: Optional notes to be associated with the connection monitor. :type notes: str """ _attribute_map = { 'source': {'key': 'source', 'type': 'ConnectionMonitorSource'}, 'destination': {'key': 'destination', 'type': 'ConnectionMonitorDestination'}, 'auto_start': {'key': 'autoStart', 'type': 'bool'}, 'monitoring_interval_in_seconds': {'key': 'monitoringIntervalInSeconds', 'type': 'int'}, 'endpoints': {'key': 'endpoints', 'type': '[ConnectionMonitorEndpoint]'}, 'test_configurations': {'key': 'testConfigurations', 'type': '[ConnectionMonitorTestConfiguration]'}, 'test_groups': {'key': 'testGroups', 'type': '[ConnectionMonitorTestGroup]'}, 'outputs': {'key': 'outputs', 'type': '[ConnectionMonitorOutput]'}, 'notes': {'key': 'notes', 'type': 'str'}, } def __init__( self, **kwargs ): super(ConnectionMonitorParameters, self).__init__(**kwargs) self.source = kwargs.get('source', None) self.destination = kwargs.get('destination', None) self.auto_start = kwargs.get('auto_start', True) self.monitoring_interval_in_seconds = kwargs.get('monitoring_interval_in_seconds', 60) self.endpoints = kwargs.get('endpoints', None) self.test_configurations = kwargs.get('test_configurations', None) self.test_groups = kwargs.get('test_groups', None) self.outputs = kwargs.get('outputs', None) self.notes = kwargs.get('notes', None) class ConnectionMonitorQueryResult(msrest.serialization.Model): """List of connection states snapshots. :param source_status: Status of connection monitor source. Possible values include: "Unknown", "Active", "Inactive". :type source_status: str or ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorSourceStatus :param states: Information about connection states. :type states: list[~azure.mgmt.network.v2020_04_01.models.ConnectionStateSnapshot] """ _attribute_map = { 'source_status': {'key': 'sourceStatus', 'type': 'str'}, 'states': {'key': 'states', 'type': '[ConnectionStateSnapshot]'}, } def __init__( self, **kwargs ): super(ConnectionMonitorQueryResult, self).__init__(**kwargs) self.source_status = kwargs.get('source_status', None) self.states = kwargs.get('states', None) class ConnectionMonitorResult(msrest.serialization.Model): """Information about the connection monitor. Variables are only populated by the server, and will be ignored when sending a request. :ivar name: Name of the connection monitor. :vartype name: str :ivar id: ID of the connection monitor. :vartype id: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Connection monitor type. :vartype type: str :param location: Connection monitor location. :type location: str :param tags: A set of tags. Connection monitor tags. :type tags: dict[str, str] :param source: Describes the source of connection monitor. :type source: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorSource :param destination: Describes the destination of connection monitor. :type destination: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorDestination :param auto_start: Determines if the connection monitor will start automatically once created. :type auto_start: bool :param monitoring_interval_in_seconds: Monitoring interval in seconds. :type monitoring_interval_in_seconds: int :param endpoints: List of connection monitor endpoints. :type endpoints: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorEndpoint] :param test_configurations: List of connection monitor test configurations. :type test_configurations: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorTestConfiguration] :param test_groups: List of connection monitor test groups. :type test_groups: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorTestGroup] :param outputs: List of connection monitor outputs. :type outputs: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorOutput] :param notes: Optional notes to be associated with the connection monitor. :type notes: str :ivar provisioning_state: The provisioning state of the connection monitor. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :ivar start_time: The date and time when the connection monitor was started. :vartype start_time: ~datetime.datetime :ivar monitoring_status: The monitoring status of the connection monitor. :vartype monitoring_status: str :ivar connection_monitor_type: Type of connection monitor. Possible values include: "MultiEndpoint", "SingleSourceDestination". :vartype connection_monitor_type: str or ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorType """ _validation = { 'name': {'readonly': True}, 'id': {'readonly': True}, 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'start_time': {'readonly': True}, 'monitoring_status': {'readonly': True}, 'connection_monitor_type': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'source': {'key': 'properties.source', 'type': 'ConnectionMonitorSource'}, 'destination': {'key': 'properties.destination', 'type': 'ConnectionMonitorDestination'}, 'auto_start': {'key': 'properties.autoStart', 'type': 'bool'}, 'monitoring_interval_in_seconds': {'key': 'properties.monitoringIntervalInSeconds', 'type': 'int'}, 'endpoints': {'key': 'properties.endpoints', 'type': '[ConnectionMonitorEndpoint]'}, 'test_configurations': {'key': 'properties.testConfigurations', 'type': '[ConnectionMonitorTestConfiguration]'}, 'test_groups': {'key': 'properties.testGroups', 'type': '[ConnectionMonitorTestGroup]'}, 'outputs': {'key': 'properties.outputs', 'type': '[ConnectionMonitorOutput]'}, 'notes': {'key': 'properties.notes', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, 'connection_monitor_type': {'key': 'properties.connectionMonitorType', 'type': 'str'}, } def __init__( self, **kwargs ): super(ConnectionMonitorResult, self).__init__(**kwargs) self.name = None self.id = None self.etag = None self.type = None self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) self.source = kwargs.get('source', None) self.destination = kwargs.get('destination', None) self.auto_start = kwargs.get('auto_start', True) self.monitoring_interval_in_seconds = kwargs.get('monitoring_interval_in_seconds', 60) self.endpoints = kwargs.get('endpoints', None) self.test_configurations = kwargs.get('test_configurations', None) self.test_groups = kwargs.get('test_groups', None) self.outputs = kwargs.get('outputs', None) self.notes = kwargs.get('notes', None) self.provisioning_state = None self.start_time = None self.monitoring_status = None self.connection_monitor_type = None class ConnectionMonitorResultProperties(ConnectionMonitorParameters): """Describes the properties of a connection monitor. Variables are only populated by the server, and will be ignored when sending a request. :param source: Describes the source of connection monitor. :type source: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorSource :param destination: Describes the destination of connection monitor. :type destination: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorDestination :param auto_start: Determines if the connection monitor will start automatically once created. :type auto_start: bool :param monitoring_interval_in_seconds: Monitoring interval in seconds. :type monitoring_interval_in_seconds: int :param endpoints: List of connection monitor endpoints. :type endpoints: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorEndpoint] :param test_configurations: List of connection monitor test configurations. :type test_configurations: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorTestConfiguration] :param test_groups: List of connection monitor test groups. :type test_groups: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorTestGroup] :param outputs: List of connection monitor outputs. :type outputs: list[~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorOutput] :param notes: Optional notes to be associated with the connection monitor. :type notes: str :ivar provisioning_state: The provisioning state of the connection monitor. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :ivar start_time: The date and time when the connection monitor was started. :vartype start_time: ~datetime.datetime :ivar monitoring_status: The monitoring status of the connection monitor. :vartype monitoring_status: str :ivar connection_monitor_type: Type of connection monitor. Possible values include: "MultiEndpoint", "SingleSourceDestination". :vartype connection_monitor_type: str or ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorType """ _validation = { 'provisioning_state': {'readonly': True}, 'start_time': {'readonly': True}, 'monitoring_status': {'readonly': True}, 'connection_monitor_type': {'readonly': True}, } _attribute_map = { 'source': {'key': 'source', 'type': 'ConnectionMonitorSource'}, 'destination': {'key': 'destination', 'type': 'ConnectionMonitorDestination'}, 'auto_start': {'key': 'autoStart', 'type': 'bool'}, 'monitoring_interval_in_seconds': {'key': 'monitoringIntervalInSeconds', 'type': 'int'}, 'endpoints': {'key': 'endpoints', 'type': '[ConnectionMonitorEndpoint]'}, 'test_configurations': {'key': 'testConfigurations', 'type': '[ConnectionMonitorTestConfiguration]'}, 'test_groups': {'key': 'testGroups', 'type': '[ConnectionMonitorTestGroup]'}, 'outputs': {'key': 'outputs', 'type': '[ConnectionMonitorOutput]'}, 'notes': {'key': 'notes', 'type': 'str'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, 'connection_monitor_type': {'key': 'connectionMonitorType', 'type': 'str'}, } def __init__( self, **kwargs ): super(ConnectionMonitorResultProperties, self).__init__(**kwargs) self.provisioning_state = None self.start_time = None self.monitoring_status = None self.connection_monitor_type = None class ConnectionMonitorSource(msrest.serialization.Model): """Describes the source of connection monitor. All required parameters must be populated in order to send to Azure. :param resource_id: Required. The ID of the resource used as the source by connection monitor. :type resource_id: str :param port: The source port used by connection monitor. :type port: int """ _validation = { 'resource_id': {'required': True}, } _attribute_map = { 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'port': {'key': 'port', 'type': 'int'}, } def __init__( self, **kwargs ): super(ConnectionMonitorSource, self).__init__(**kwargs) self.resource_id = kwargs['resource_id'] self.port = kwargs.get('port', None) class ConnectionMonitorSuccessThreshold(msrest.serialization.Model): """Describes the threshold for declaring a test successful. :param checks_failed_percent: The maximum percentage of failed checks permitted for a test to evaluate as successful. :type checks_failed_percent: int :param round_trip_time_ms: The maximum round-trip time in milliseconds permitted for a test to evaluate as successful. :type round_trip_time_ms: float """ _attribute_map = { 'checks_failed_percent': {'key': 'checksFailedPercent', 'type': 'int'}, 'round_trip_time_ms': {'key': 'roundTripTimeMs', 'type': 'float'}, } def __init__( self, **kwargs ): super(ConnectionMonitorSuccessThreshold, self).__init__(**kwargs) self.checks_failed_percent = kwargs.get('checks_failed_percent', None) self.round_trip_time_ms = kwargs.get('round_trip_time_ms', None) class ConnectionMonitorTcpConfiguration(msrest.serialization.Model): """Describes the TCP configuration. :param port: The port to connect to. :type port: int :param disable_trace_route: Value indicating whether path evaluation with trace route should be disabled. :type disable_trace_route: bool """ _attribute_map = { 'port': {'key': 'port', 'type': 'int'}, 'disable_trace_route': {'key': 'disableTraceRoute', 'type': 'bool'}, } def __init__( self, **kwargs ): super(ConnectionMonitorTcpConfiguration, self).__init__(**kwargs) self.port = kwargs.get('port', None) self.disable_trace_route = kwargs.get('disable_trace_route', None) class ConnectionMonitorTestConfiguration(msrest.serialization.Model): """Describes a connection monitor test configuration. All required parameters must be populated in order to send to Azure. :param name: Required. The name of the connection monitor test configuration. :type name: str :param test_frequency_sec: The frequency of test evaluation, in seconds. :type test_frequency_sec: int :param protocol: Required. The protocol to use in test evaluation. Possible values include: "Tcp", "Http", "Icmp". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorTestConfigurationProtocol :param preferred_ip_version: The preferred IP version to use in test evaluation. The connection monitor may choose to use a different version depending on other parameters. Possible values include: "IPv4", "IPv6". :type preferred_ip_version: str or ~azure.mgmt.network.v2020_04_01.models.PreferredIPVersion :param http_configuration: The parameters used to perform test evaluation over HTTP. :type http_configuration: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorHttpConfiguration :param tcp_configuration: The parameters used to perform test evaluation over TCP. :type tcp_configuration: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorTcpConfiguration :param icmp_configuration: The parameters used to perform test evaluation over ICMP. :type icmp_configuration: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorIcmpConfiguration :param success_threshold: The threshold for declaring a test successful. :type success_threshold: ~azure.mgmt.network.v2020_04_01.models.ConnectionMonitorSuccessThreshold """ _validation = { 'name': {'required': True}, 'protocol': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'test_frequency_sec': {'key': 'testFrequencySec', 'type': 'int'}, 'protocol': {'key': 'protocol', 'type': 'str'}, 'preferred_ip_version': {'key': 'preferredIPVersion', 'type': 'str'}, 'http_configuration': {'key': 'httpConfiguration', 'type': 'ConnectionMonitorHttpConfiguration'}, 'tcp_configuration': {'key': 'tcpConfiguration', 'type': 'ConnectionMonitorTcpConfiguration'}, 'icmp_configuration': {'key': 'icmpConfiguration', 'type': 'ConnectionMonitorIcmpConfiguration'}, 'success_threshold': {'key': 'successThreshold', 'type': 'ConnectionMonitorSuccessThreshold'}, } def __init__( self, **kwargs ): super(ConnectionMonitorTestConfiguration, self).__init__(**kwargs) self.name = kwargs['name'] self.test_frequency_sec = kwargs.get('test_frequency_sec', None) self.protocol = kwargs['protocol'] self.preferred_ip_version = kwargs.get('preferred_ip_version', None) self.http_configuration = kwargs.get('http_configuration', None) self.tcp_configuration = kwargs.get('tcp_configuration', None) self.icmp_configuration = kwargs.get('icmp_configuration', None) self.success_threshold = kwargs.get('success_threshold', None) class ConnectionMonitorTestGroup(msrest.serialization.Model): """Describes the connection monitor test group. All required parameters must be populated in order to send to Azure. :param name: Required. The name of the connection monitor test group. :type name: str :param disable: Value indicating whether test group is disabled. :type disable: bool :param test_configurations: Required. List of test configuration names. :type test_configurations: list[str] :param sources: Required. List of source endpoint names. :type sources: list[str] :param destinations: Required. List of destination endpoint names. :type destinations: list[str] """ _validation = { 'name': {'required': True}, 'test_configurations': {'required': True}, 'sources': {'required': True}, 'destinations': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'disable': {'key': 'disable', 'type': 'bool'}, 'test_configurations': {'key': 'testConfigurations', 'type': '[str]'}, 'sources': {'key': 'sources', 'type': '[str]'}, 'destinations': {'key': 'destinations', 'type': '[str]'}, } def __init__( self, **kwargs ): super(ConnectionMonitorTestGroup, self).__init__(**kwargs) self.name = kwargs['name'] self.disable = kwargs.get('disable', None) self.test_configurations = kwargs['test_configurations'] self.sources = kwargs['sources'] self.destinations = kwargs['destinations'] class ConnectionMonitorWorkspaceSettings(msrest.serialization.Model): """Describes the settings for producing output into a log analytics workspace. :param workspace_resource_id: Log analytics workspace resource ID. :type workspace_resource_id: str """ _attribute_map = { 'workspace_resource_id': {'key': 'workspaceResourceId', 'type': 'str'}, } def __init__( self, **kwargs ): super(ConnectionMonitorWorkspaceSettings, self).__init__(**kwargs) self.workspace_resource_id = kwargs.get('workspace_resource_id', None) class ConnectionResetSharedKey(msrest.serialization.Model): """The virtual network connection reset shared key. All required parameters must be populated in order to send to Azure. :param key_length: Required. The virtual network connection reset shared key length, should between 1 and 128. :type key_length: int """ _validation = { 'key_length': {'required': True, 'maximum': 128, 'minimum': 1}, } _attribute_map = { 'key_length': {'key': 'keyLength', 'type': 'int'}, } def __init__( self, **kwargs ): super(ConnectionResetSharedKey, self).__init__(**kwargs) self.key_length = kwargs['key_length'] class ConnectionSharedKey(SubResource): """Response for GetConnectionSharedKey API service call. All required parameters must be populated in order to send to Azure. :param id: Resource ID. :type id: str :param value: Required. The virtual network connection shared key value. :type value: str """ _validation = { 'value': {'required': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'value': {'key': 'value', 'type': 'str'}, } def __init__( self, **kwargs ): super(ConnectionSharedKey, self).__init__(**kwargs) self.value = kwargs['value'] class ConnectionStateSnapshot(msrest.serialization.Model): """Connection state snapshot. Variables are only populated by the server, and will be ignored when sending a request. :param connection_state: The connection state. Possible values include: "Reachable", "Unreachable", "Unknown". :type connection_state: str or ~azure.mgmt.network.v2020_04_01.models.ConnectionState :param start_time: The start time of the connection snapshot. :type start_time: ~datetime.datetime :param end_time: The end time of the connection snapshot. :type end_time: ~datetime.datetime :param evaluation_state: Connectivity analysis evaluation state. Possible values include: "NotStarted", "InProgress", "Completed". :type evaluation_state: str or ~azure.mgmt.network.v2020_04_01.models.EvaluationState :param avg_latency_in_ms: Average latency in ms. :type avg_latency_in_ms: int :param min_latency_in_ms: Minimum latency in ms. :type min_latency_in_ms: int :param max_latency_in_ms: Maximum latency in ms. :type max_latency_in_ms: int :param probes_sent: The number of sent probes. :type probes_sent: int :param probes_failed: The number of failed probes. :type probes_failed: int :ivar hops: List of hops between the source and the destination. :vartype hops: list[~azure.mgmt.network.v2020_04_01.models.ConnectivityHop] """ _validation = { 'hops': {'readonly': True}, } _attribute_map = { 'connection_state': {'key': 'connectionState', 'type': 'str'}, 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, 'evaluation_state': {'key': 'evaluationState', 'type': 'str'}, 'avg_latency_in_ms': {'key': 'avgLatencyInMs', 'type': 'int'}, 'min_latency_in_ms': {'key': 'minLatencyInMs', 'type': 'int'}, 'max_latency_in_ms': {'key': 'maxLatencyInMs', 'type': 'int'}, 'probes_sent': {'key': 'probesSent', 'type': 'int'}, 'probes_failed': {'key': 'probesFailed', 'type': 'int'}, 'hops': {'key': 'hops', 'type': '[ConnectivityHop]'}, } def __init__( self, **kwargs ): super(ConnectionStateSnapshot, self).__init__(**kwargs) self.connection_state = kwargs.get('connection_state', None) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) self.evaluation_state = kwargs.get('evaluation_state', None) self.avg_latency_in_ms = kwargs.get('avg_latency_in_ms', None) self.min_latency_in_ms = kwargs.get('min_latency_in_ms', None) self.max_latency_in_ms = kwargs.get('max_latency_in_ms', None) self.probes_sent = kwargs.get('probes_sent', None) self.probes_failed = kwargs.get('probes_failed', None) self.hops = None class ConnectivityDestination(msrest.serialization.Model): """Parameters that define destination of connection. :param resource_id: The ID of the resource to which a connection attempt will be made. :type resource_id: str :param address: The IP address or URI the resource to which a connection attempt will be made. :type address: str :param port: Port on which check connectivity will be performed. :type port: int """ _attribute_map = { 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'address': {'key': 'address', 'type': 'str'}, 'port': {'key': 'port', 'type': 'int'}, } def __init__( self, **kwargs ): super(ConnectivityDestination, self).__init__(**kwargs) self.resource_id = kwargs.get('resource_id', None) self.address = kwargs.get('address', None) self.port = kwargs.get('port', None) class ConnectivityHop(msrest.serialization.Model): """Information about a hop between the source and the destination. Variables are only populated by the server, and will be ignored when sending a request. :ivar type: The type of the hop. :vartype type: str :ivar id: The ID of the hop. :vartype id: str :ivar address: The IP address of the hop. :vartype address: str :ivar resource_id: The ID of the resource corresponding to this hop. :vartype resource_id: str :ivar next_hop_ids: List of next hop identifiers. :vartype next_hop_ids: list[str] :ivar issues: List of issues. :vartype issues: list[~azure.mgmt.network.v2020_04_01.models.ConnectivityIssue] """ _validation = { 'type': {'readonly': True}, 'id': {'readonly': True}, 'address': {'readonly': True}, 'resource_id': {'readonly': True}, 'next_hop_ids': {'readonly': True}, 'issues': {'readonly': True}, } _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'address': {'key': 'address', 'type': 'str'}, 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'next_hop_ids': {'key': 'nextHopIds', 'type': '[str]'}, 'issues': {'key': 'issues', 'type': '[ConnectivityIssue]'}, } def __init__( self, **kwargs ): super(ConnectivityHop, self).__init__(**kwargs) self.type = None self.id = None self.address = None self.resource_id = None self.next_hop_ids = None self.issues = None class ConnectivityInformation(msrest.serialization.Model): """Information on the connectivity status. Variables are only populated by the server, and will be ignored when sending a request. :ivar hops: List of hops between the source and the destination. :vartype hops: list[~azure.mgmt.network.v2020_04_01.models.ConnectivityHop] :ivar connection_status: The connection status. Possible values include: "Unknown", "Connected", "Disconnected", "Degraded". :vartype connection_status: str or ~azure.mgmt.network.v2020_04_01.models.ConnectionStatus :ivar avg_latency_in_ms: Average latency in milliseconds. :vartype avg_latency_in_ms: int :ivar min_latency_in_ms: Minimum latency in milliseconds. :vartype min_latency_in_ms: int :ivar max_latency_in_ms: Maximum latency in milliseconds. :vartype max_latency_in_ms: int :ivar probes_sent: Total number of probes sent. :vartype probes_sent: int :ivar probes_failed: Number of failed probes. :vartype probes_failed: int """ _validation = { 'hops': {'readonly': True}, 'connection_status': {'readonly': True}, 'avg_latency_in_ms': {'readonly': True}, 'min_latency_in_ms': {'readonly': True}, 'max_latency_in_ms': {'readonly': True}, 'probes_sent': {'readonly': True}, 'probes_failed': {'readonly': True}, } _attribute_map = { 'hops': {'key': 'hops', 'type': '[ConnectivityHop]'}, 'connection_status': {'key': 'connectionStatus', 'type': 'str'}, 'avg_latency_in_ms': {'key': 'avgLatencyInMs', 'type': 'int'}, 'min_latency_in_ms': {'key': 'minLatencyInMs', 'type': 'int'}, 'max_latency_in_ms': {'key': 'maxLatencyInMs', 'type': 'int'}, 'probes_sent': {'key': 'probesSent', 'type': 'int'}, 'probes_failed': {'key': 'probesFailed', 'type': 'int'}, } def __init__( self, **kwargs ): super(ConnectivityInformation, self).__init__(**kwargs) self.hops = None self.connection_status = None self.avg_latency_in_ms = None self.min_latency_in_ms = None self.max_latency_in_ms = None self.probes_sent = None self.probes_failed = None class ConnectivityIssue(msrest.serialization.Model): """Information about an issue encountered in the process of checking for connectivity. Variables are only populated by the server, and will be ignored when sending a request. :ivar origin: The origin of the issue. Possible values include: "Local", "Inbound", "Outbound". :vartype origin: str or ~azure.mgmt.network.v2020_04_01.models.Origin :ivar severity: The severity of the issue. Possible values include: "Error", "Warning". :vartype severity: str or ~azure.mgmt.network.v2020_04_01.models.Severity :ivar type: The type of issue. Possible values include: "Unknown", "AgentStopped", "GuestFirewall", "DnsResolution", "SocketBind", "NetworkSecurityRule", "UserDefinedRoute", "PortThrottled", "Platform". :vartype type: str or ~azure.mgmt.network.v2020_04_01.models.IssueType :ivar context: Provides additional context on the issue. :vartype context: list[dict[str, str]] """ _validation = { 'origin': {'readonly': True}, 'severity': {'readonly': True}, 'type': {'readonly': True}, 'context': {'readonly': True}, } _attribute_map = { 'origin': {'key': 'origin', 'type': 'str'}, 'severity': {'key': 'severity', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'context': {'key': 'context', 'type': '[{str}]'}, } def __init__( self, **kwargs ): super(ConnectivityIssue, self).__init__(**kwargs) self.origin = None self.severity = None self.type = None self.context = None class ConnectivityParameters(msrest.serialization.Model): """Parameters that determine how the connectivity check will be performed. All required parameters must be populated in order to send to Azure. :param source: Required. The source of the connection. :type source: ~azure.mgmt.network.v2020_04_01.models.ConnectivitySource :param destination: Required. The destination of connection. :type destination: ~azure.mgmt.network.v2020_04_01.models.ConnectivityDestination :param protocol: Network protocol. Possible values include: "Tcp", "Http", "Https", "Icmp". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.Protocol :param protocol_configuration: Configuration of the protocol. :type protocol_configuration: ~azure.mgmt.network.v2020_04_01.models.ProtocolConfiguration :param preferred_ip_version: Preferred IP version of the connection. Possible values include: "IPv4", "IPv6". :type preferred_ip_version: str or ~azure.mgmt.network.v2020_04_01.models.IPVersion """ _validation = { 'source': {'required': True}, 'destination': {'required': True}, } _attribute_map = { 'source': {'key': 'source', 'type': 'ConnectivitySource'}, 'destination': {'key': 'destination', 'type': 'ConnectivityDestination'}, 'protocol': {'key': 'protocol', 'type': 'str'}, 'protocol_configuration': {'key': 'protocolConfiguration', 'type': 'ProtocolConfiguration'}, 'preferred_ip_version': {'key': 'preferredIPVersion', 'type': 'str'}, } def __init__( self, **kwargs ): super(ConnectivityParameters, self).__init__(**kwargs) self.source = kwargs['source'] self.destination = kwargs['destination'] self.protocol = kwargs.get('protocol', None) self.protocol_configuration = kwargs.get('protocol_configuration', None) self.preferred_ip_version = kwargs.get('preferred_ip_version', None) class ConnectivitySource(msrest.serialization.Model): """Parameters that define the source of the connection. All required parameters must be populated in order to send to Azure. :param resource_id: Required. The ID of the resource from which a connectivity check will be initiated. :type resource_id: str :param port: The source port from which a connectivity check will be performed. :type port: int """ _validation = { 'resource_id': {'required': True}, } _attribute_map = { 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'port': {'key': 'port', 'type': 'int'}, } def __init__( self, **kwargs ): super(ConnectivitySource, self).__init__(**kwargs) self.resource_id = kwargs['resource_id'] self.port = kwargs.get('port', None) class Container(SubResource): """Reference to container resource in remote resource provider. :param id: Resource ID. :type id: str """ _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, **kwargs ): super(Container, self).__init__(**kwargs) class ContainerNetworkInterface(SubResource): """Container network interface child resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource. This name can be used to access the resource. :type name: str :ivar type: Sub Resource type. :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar container_network_interface_configuration: Container network interface configuration from which this container network interface is created. :vartype container_network_interface_configuration: ~azure.mgmt.network.v2020_04_01.models.ContainerNetworkInterfaceConfiguration :param container: Reference to the container to which this container network interface is attached. :type container: ~azure.mgmt.network.v2020_04_01.models.Container :ivar ip_configurations: Reference to the ip configuration on this container nic. :vartype ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.ContainerNetworkInterfaceIpConfiguration] :ivar provisioning_state: The provisioning state of the container network interface resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'type': {'readonly': True}, 'etag': {'readonly': True}, 'container_network_interface_configuration': {'readonly': True}, 'ip_configurations': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'container_network_interface_configuration': {'key': 'properties.containerNetworkInterfaceConfiguration', 'type': 'ContainerNetworkInterfaceConfiguration'}, 'container': {'key': 'properties.container', 'type': 'Container'}, 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[ContainerNetworkInterfaceIpConfiguration]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ContainerNetworkInterface, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.type = None self.etag = None self.container_network_interface_configuration = None self.container = kwargs.get('container', None) self.ip_configurations = None self.provisioning_state = None class ContainerNetworkInterfaceConfiguration(SubResource): """Container network interface configuration child resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource. This name can be used to access the resource. :type name: str :ivar type: Sub Resource type. :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param ip_configurations: A list of ip configurations of the container network interface configuration. :type ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.IPConfigurationProfile] :param container_network_interfaces: A list of container network interfaces created from this container network interface configuration. :type container_network_interfaces: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar provisioning_state: The provisioning state of the container network interface configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[IPConfigurationProfile]'}, 'container_network_interfaces': {'key': 'properties.containerNetworkInterfaces', 'type': '[SubResource]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ContainerNetworkInterfaceConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.type = None self.etag = None self.ip_configurations = kwargs.get('ip_configurations', None) self.container_network_interfaces = kwargs.get('container_network_interfaces', None) self.provisioning_state = None class ContainerNetworkInterfaceIpConfiguration(msrest.serialization.Model): """The ip configuration for a container network interface. Variables are only populated by the server, and will be ignored when sending a request. :param name: The name of the resource. This name can be used to access the resource. :type name: str :ivar type: Sub Resource type. :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar provisioning_state: The provisioning state of the container network interface IP configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ContainerNetworkInterfaceIpConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.type = None self.etag = None self.provisioning_state = None class CustomDnsConfigPropertiesFormat(msrest.serialization.Model): """Contains custom Dns resolution configuration from customer. :param fqdn: Fqdn that resolves to private endpoint ip address. :type fqdn: str :param ip_addresses: A list of private ip addresses of the private endpoint. :type ip_addresses: list[str] """ _attribute_map = { 'fqdn': {'key': 'fqdn', 'type': 'str'}, 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, } def __init__( self, **kwargs ): super(CustomDnsConfigPropertiesFormat, self).__init__(**kwargs) self.fqdn = kwargs.get('fqdn', None) self.ip_addresses = kwargs.get('ip_addresses', None) class DdosCustomPolicy(Resource): """A DDoS custom policy in a resource group. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar resource_guid: The resource GUID property of the DDoS custom policy resource. It uniquely identifies the resource, even if the user changes its name or migrate the resource across subscriptions or resource groups. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the DDoS custom policy resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :ivar public_ip_addresses: The list of public IPs associated with the DDoS custom policy resource. This list is read-only. :vartype public_ip_addresses: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :param protocol_custom_settings: The protocol-specific DDoS policy customization parameters. :type protocol_custom_settings: list[~azure.mgmt.network.v2020_04_01.models.ProtocolCustomSettingsFormat] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'public_ip_addresses': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'public_ip_addresses': {'key': 'properties.publicIPAddresses', 'type': '[SubResource]'}, 'protocol_custom_settings': {'key': 'properties.protocolCustomSettings', 'type': '[ProtocolCustomSettingsFormat]'}, } def __init__( self, **kwargs ): super(DdosCustomPolicy, self).__init__(**kwargs) self.etag = None self.resource_guid = None self.provisioning_state = None self.public_ip_addresses = None self.protocol_custom_settings = kwargs.get('protocol_custom_settings', None) class DdosProtectionPlan(msrest.serialization.Model): """A DDoS protection plan in a resource group. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource ID. :vartype id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar resource_guid: The resource GUID property of the DDoS protection plan resource. It uniquely identifies the resource, even if the user changes its name or migrate the resource across subscriptions or resource groups. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the DDoS protection plan resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :ivar virtual_networks: The list of virtual networks associated with the DDoS protection plan resource. This list is read-only. :vartype virtual_networks: list[~azure.mgmt.network.v2020_04_01.models.SubResource] """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'virtual_networks': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'virtual_networks': {'key': 'properties.virtualNetworks', 'type': '[SubResource]'}, } def __init__( self, **kwargs ): super(DdosProtectionPlan, self).__init__(**kwargs) self.id = None self.name = None self.type = None self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) self.etag = None self.resource_guid = None self.provisioning_state = None self.virtual_networks = None class DdosProtectionPlanListResult(msrest.serialization.Model): """A list of DDoS protection plans. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of DDoS protection plans. :type value: list[~azure.mgmt.network.v2020_04_01.models.DdosProtectionPlan] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[DdosProtectionPlan]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(DdosProtectionPlanListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class DdosSettings(msrest.serialization.Model): """Contains the DDoS protection settings of the public IP. :param ddos_custom_policy: The DDoS custom policy associated with the public IP. :type ddos_custom_policy: ~azure.mgmt.network.v2020_04_01.models.SubResource :param protection_coverage: The DDoS protection policy customizability of the public IP. Only standard coverage will have the ability to be customized. Possible values include: "Basic", "Standard". :type protection_coverage: str or ~azure.mgmt.network.v2020_04_01.models.DdosSettingsProtectionCoverage :param protected_ip: Enables DDoS protection on the public IP. :type protected_ip: bool """ _attribute_map = { 'ddos_custom_policy': {'key': 'ddosCustomPolicy', 'type': 'SubResource'}, 'protection_coverage': {'key': 'protectionCoverage', 'type': 'str'}, 'protected_ip': {'key': 'protectedIP', 'type': 'bool'}, } def __init__( self, **kwargs ): super(DdosSettings, self).__init__(**kwargs) self.ddos_custom_policy = kwargs.get('ddos_custom_policy', None) self.protection_coverage = kwargs.get('protection_coverage', None) self.protected_ip = kwargs.get('protected_ip', None) class Delegation(SubResource): """Details the service to which the subnet is delegated. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a subnet. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param service_name: The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers). :type service_name: str :ivar actions: The actions permitted to the service upon delegation. :vartype actions: list[str] :ivar provisioning_state: The provisioning state of the service delegation resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'actions': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'service_name': {'key': 'properties.serviceName', 'type': 'str'}, 'actions': {'key': 'properties.actions', 'type': '[str]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(Delegation, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.service_name = kwargs.get('service_name', None) self.actions = None self.provisioning_state = None class DeviceProperties(msrest.serialization.Model): """List of properties of the device. :param device_vendor: Name of the device Vendor. :type device_vendor: str :param device_model: Model of the device. :type device_model: str :param link_speed_in_mbps: Link speed. :type link_speed_in_mbps: int """ _attribute_map = { 'device_vendor': {'key': 'deviceVendor', 'type': 'str'}, 'device_model': {'key': 'deviceModel', 'type': 'str'}, 'link_speed_in_mbps': {'key': 'linkSpeedInMbps', 'type': 'int'}, } def __init__( self, **kwargs ): super(DeviceProperties, self).__init__(**kwargs) self.device_vendor = kwargs.get('device_vendor', None) self.device_model = kwargs.get('device_model', None) self.link_speed_in_mbps = kwargs.get('link_speed_in_mbps', None) class DhcpOptions(msrest.serialization.Model): """DhcpOptions contains an array of DNS servers available to VMs deployed in the virtual network. Standard DHCP option for a subnet overrides VNET DHCP options. :param dns_servers: The list of DNS servers IP addresses. :type dns_servers: list[str] """ _attribute_map = { 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, } def __init__( self, **kwargs ): super(DhcpOptions, self).__init__(**kwargs) self.dns_servers = kwargs.get('dns_servers', None) class Dimension(msrest.serialization.Model): """Dimension of the metric. :param name: The name of the dimension. :type name: str :param display_name: The display name of the dimension. :type display_name: str :param internal_name: The internal name of the dimension. :type internal_name: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'internal_name': {'key': 'internalName', 'type': 'str'}, } def __init__( self, **kwargs ): super(Dimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) self.internal_name = kwargs.get('internal_name', None) class DnsNameAvailabilityResult(msrest.serialization.Model): """Response for the CheckDnsNameAvailability API service call. :param available: Domain availability (True/False). :type available: bool """ _attribute_map = { 'available': {'key': 'available', 'type': 'bool'}, } def __init__( self, **kwargs ): super(DnsNameAvailabilityResult, self).__init__(**kwargs) self.available = kwargs.get('available', None) class EffectiveNetworkSecurityGroup(msrest.serialization.Model): """Effective network security group. :param network_security_group: The ID of network security group that is applied. :type network_security_group: ~azure.mgmt.network.v2020_04_01.models.SubResource :param association: Associated resources. :type association: ~azure.mgmt.network.v2020_04_01.models.EffectiveNetworkSecurityGroupAssociation :param effective_security_rules: A collection of effective security rules. :type effective_security_rules: list[~azure.mgmt.network.v2020_04_01.models.EffectiveNetworkSecurityRule] :param tag_map: Mapping of tags to list of IP Addresses included within the tag. :type tag_map: str """ _attribute_map = { 'network_security_group': {'key': 'networkSecurityGroup', 'type': 'SubResource'}, 'association': {'key': 'association', 'type': 'EffectiveNetworkSecurityGroupAssociation'}, 'effective_security_rules': {'key': 'effectiveSecurityRules', 'type': '[EffectiveNetworkSecurityRule]'}, 'tag_map': {'key': 'tagMap', 'type': 'str'}, } def __init__( self, **kwargs ): super(EffectiveNetworkSecurityGroup, self).__init__(**kwargs) self.network_security_group = kwargs.get('network_security_group', None) self.association = kwargs.get('association', None) self.effective_security_rules = kwargs.get('effective_security_rules', None) self.tag_map = kwargs.get('tag_map', None) class EffectiveNetworkSecurityGroupAssociation(msrest.serialization.Model): """The effective network security group association. :param subnet: The ID of the subnet if assigned. :type subnet: ~azure.mgmt.network.v2020_04_01.models.SubResource :param network_interface: The ID of the network interface if assigned. :type network_interface: ~azure.mgmt.network.v2020_04_01.models.SubResource """ _attribute_map = { 'subnet': {'key': 'subnet', 'type': 'SubResource'}, 'network_interface': {'key': 'networkInterface', 'type': 'SubResource'}, } def __init__( self, **kwargs ): super(EffectiveNetworkSecurityGroupAssociation, self).__init__(**kwargs) self.subnet = kwargs.get('subnet', None) self.network_interface = kwargs.get('network_interface', None) class EffectiveNetworkSecurityGroupListResult(msrest.serialization.Model): """Response for list effective network security groups API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of effective network security groups. :type value: list[~azure.mgmt.network.v2020_04_01.models.EffectiveNetworkSecurityGroup] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[EffectiveNetworkSecurityGroup]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(EffectiveNetworkSecurityGroupListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class EffectiveNetworkSecurityRule(msrest.serialization.Model): """Effective network security rules. :param name: The name of the security rule specified by the user (if created by the user). :type name: str :param protocol: The network protocol this rule applies to. Possible values include: "Tcp", "Udp", "All". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.EffectiveSecurityRuleProtocol :param source_port_range: The source port or range. :type source_port_range: str :param destination_port_range: The destination port or range. :type destination_port_range: str :param source_port_ranges: The source port ranges. Expected values include a single integer between 0 and 65535, a range using '-' as separator (e.g. 100-400), or an asterisk (*). :type source_port_ranges: list[str] :param destination_port_ranges: The destination port ranges. Expected values include a single integer between 0 and 65535, a range using '-' as separator (e.g. 100-400), or an asterisk (*). :type destination_port_ranges: list[str] :param source_address_prefix: The source address prefix. :type source_address_prefix: str :param destination_address_prefix: The destination address prefix. :type destination_address_prefix: str :param source_address_prefixes: The source address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the asterisk (*). :type source_address_prefixes: list[str] :param destination_address_prefixes: The destination address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the asterisk (*). :type destination_address_prefixes: list[str] :param expanded_source_address_prefix: The expanded source address prefix. :type expanded_source_address_prefix: list[str] :param expanded_destination_address_prefix: Expanded destination address prefix. :type expanded_destination_address_prefix: list[str] :param access: Whether network traffic is allowed or denied. Possible values include: "Allow", "Deny". :type access: str or ~azure.mgmt.network.v2020_04_01.models.SecurityRuleAccess :param priority: The priority of the rule. :type priority: int :param direction: The direction of the rule. Possible values include: "Inbound", "Outbound". :type direction: str or ~azure.mgmt.network.v2020_04_01.models.SecurityRuleDirection """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'protocol': {'key': 'protocol', 'type': 'str'}, 'source_port_range': {'key': 'sourcePortRange', 'type': 'str'}, 'destination_port_range': {'key': 'destinationPortRange', 'type': 'str'}, 'source_port_ranges': {'key': 'sourcePortRanges', 'type': '[str]'}, 'destination_port_ranges': {'key': 'destinationPortRanges', 'type': '[str]'}, 'source_address_prefix': {'key': 'sourceAddressPrefix', 'type': 'str'}, 'destination_address_prefix': {'key': 'destinationAddressPrefix', 'type': 'str'}, 'source_address_prefixes': {'key': 'sourceAddressPrefixes', 'type': '[str]'}, 'destination_address_prefixes': {'key': 'destinationAddressPrefixes', 'type': '[str]'}, 'expanded_source_address_prefix': {'key': 'expandedSourceAddressPrefix', 'type': '[str]'}, 'expanded_destination_address_prefix': {'key': 'expandedDestinationAddressPrefix', 'type': '[str]'}, 'access': {'key': 'access', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'int'}, 'direction': {'key': 'direction', 'type': 'str'}, } def __init__( self, **kwargs ): super(EffectiveNetworkSecurityRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.protocol = kwargs.get('protocol', None) self.source_port_range = kwargs.get('source_port_range', None) self.destination_port_range = kwargs.get('destination_port_range', None) self.source_port_ranges = kwargs.get('source_port_ranges', None) self.destination_port_ranges = kwargs.get('destination_port_ranges', None) self.source_address_prefix = kwargs.get('source_address_prefix', None) self.destination_address_prefix = kwargs.get('destination_address_prefix', None) self.source_address_prefixes = kwargs.get('source_address_prefixes', None) self.destination_address_prefixes = kwargs.get('destination_address_prefixes', None) self.expanded_source_address_prefix = kwargs.get('expanded_source_address_prefix', None) self.expanded_destination_address_prefix = kwargs.get('expanded_destination_address_prefix', None) self.access = kwargs.get('access', None) self.priority = kwargs.get('priority', None) self.direction = kwargs.get('direction', None) class EffectiveRoute(msrest.serialization.Model): """Effective Route. :param name: The name of the user defined route. This is optional. :type name: str :param disable_bgp_route_propagation: If true, on-premises routes are not propagated to the network interfaces in the subnet. :type disable_bgp_route_propagation: bool :param source: Who created the route. Possible values include: "Unknown", "User", "VirtualNetworkGateway", "Default". :type source: str or ~azure.mgmt.network.v2020_04_01.models.EffectiveRouteSource :param state: The value of effective route. Possible values include: "Active", "Invalid". :type state: str or ~azure.mgmt.network.v2020_04_01.models.EffectiveRouteState :param address_prefix: The address prefixes of the effective routes in CIDR notation. :type address_prefix: list[str] :param next_hop_ip_address: The IP address of the next hop of the effective route. :type next_hop_ip_address: list[str] :param next_hop_type: The type of Azure hop the packet should be sent to. Possible values include: "VirtualNetworkGateway", "VnetLocal", "Internet", "VirtualAppliance", "None". :type next_hop_type: str or ~azure.mgmt.network.v2020_04_01.models.RouteNextHopType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'disable_bgp_route_propagation': {'key': 'disableBgpRoutePropagation', 'type': 'bool'}, 'source': {'key': 'source', 'type': 'str'}, 'state': {'key': 'state', 'type': 'str'}, 'address_prefix': {'key': 'addressPrefix', 'type': '[str]'}, 'next_hop_ip_address': {'key': 'nextHopIpAddress', 'type': '[str]'}, 'next_hop_type': {'key': 'nextHopType', 'type': 'str'}, } def __init__( self, **kwargs ): super(EffectiveRoute, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.disable_bgp_route_propagation = kwargs.get('disable_bgp_route_propagation', None) self.source = kwargs.get('source', None) self.state = kwargs.get('state', None) self.address_prefix = kwargs.get('address_prefix', None) self.next_hop_ip_address = kwargs.get('next_hop_ip_address', None) self.next_hop_type = kwargs.get('next_hop_type', None) class EffectiveRouteListResult(msrest.serialization.Model): """Response for list effective route API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of effective routes. :type value: list[~azure.mgmt.network.v2020_04_01.models.EffectiveRoute] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[EffectiveRoute]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(EffectiveRouteListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class EndpointServiceResult(SubResource): """Endpoint service. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Name of the endpoint service. :vartype name: str :ivar type: Type of the endpoint service. :vartype type: str """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, **kwargs ): super(EndpointServiceResult, self).__init__(**kwargs) self.name = None self.type = None class EndpointServicesListResult(msrest.serialization.Model): """Response for the ListAvailableEndpointServices API service call. :param value: List of available endpoint services in a region. :type value: list[~azure.mgmt.network.v2020_04_01.models.EndpointServiceResult] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[EndpointServiceResult]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(EndpointServicesListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class Error(msrest.serialization.Model): """Common error representation. :param code: Error code. :type code: str :param message: Error message. :type message: str :param target: Error target. :type target: str :param details: Error details. :type details: list[~azure.mgmt.network.v2020_04_01.models.ErrorDetails] :param inner_error: Inner error message. :type inner_error: str """ _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, 'details': {'key': 'details', 'type': '[ErrorDetails]'}, 'inner_error': {'key': 'innerError', 'type': 'str'}, } def __init__( self, **kwargs ): super(Error, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) self.target = kwargs.get('target', None) self.details = kwargs.get('details', None) self.inner_error = kwargs.get('inner_error', None) class ErrorDetails(msrest.serialization.Model): """Common error details representation. :param code: Error code. :type code: str :param target: Error target. :type target: str :param message: Error message. :type message: str """ _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } def __init__( self, **kwargs ): super(ErrorDetails, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.target = kwargs.get('target', None) self.message = kwargs.get('message', None) class ErrorResponse(msrest.serialization.Model): """The error object. :param error: The error details object. :type error: ~azure.mgmt.network.v2020_04_01.models.ErrorDetails """ _attribute_map = { 'error': {'key': 'error', 'type': 'ErrorDetails'}, } def __init__( self, **kwargs ): super(ErrorResponse, self).__init__(**kwargs) self.error = kwargs.get('error', None) class EvaluatedNetworkSecurityGroup(msrest.serialization.Model): """Results of network security group evaluation. Variables are only populated by the server, and will be ignored when sending a request. :param network_security_group_id: Network security group ID. :type network_security_group_id: str :param applied_to: Resource ID of nic or subnet to which network security group is applied. :type applied_to: str :param matched_rule: Matched network security rule. :type matched_rule: ~azure.mgmt.network.v2020_04_01.models.MatchedRule :ivar rules_evaluation_result: List of network security rules evaluation results. :vartype rules_evaluation_result: list[~azure.mgmt.network.v2020_04_01.models.NetworkSecurityRulesEvaluationResult] """ _validation = { 'rules_evaluation_result': {'readonly': True}, } _attribute_map = { 'network_security_group_id': {'key': 'networkSecurityGroupId', 'type': 'str'}, 'applied_to': {'key': 'appliedTo', 'type': 'str'}, 'matched_rule': {'key': 'matchedRule', 'type': 'MatchedRule'}, 'rules_evaluation_result': {'key': 'rulesEvaluationResult', 'type': '[NetworkSecurityRulesEvaluationResult]'}, } def __init__( self, **kwargs ): super(EvaluatedNetworkSecurityGroup, self).__init__(**kwargs) self.network_security_group_id = kwargs.get('network_security_group_id', None) self.applied_to = kwargs.get('applied_to', None) self.matched_rule = kwargs.get('matched_rule', None) self.rules_evaluation_result = None class ExpressRouteCircuit(Resource): """ExpressRouteCircuit resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: The SKU. :type sku: ~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitSku :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param allow_classic_operations: Allow classic operations. :type allow_classic_operations: bool :param circuit_provisioning_state: The CircuitProvisioningState state of the resource. :type circuit_provisioning_state: str :param service_provider_provisioning_state: The ServiceProviderProvisioningState state of the resource. Possible values include: "NotProvisioned", "Provisioning", "Provisioned", "Deprovisioning". :type service_provider_provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ServiceProviderProvisioningState :param authorizations: The list of authorizations. :type authorizations: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitAuthorization] :param peerings: The list of peerings. :type peerings: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitPeering] :param service_key: The ServiceKey. :type service_key: str :param service_provider_notes: The ServiceProviderNotes. :type service_provider_notes: str :param service_provider_properties: The ServiceProviderProperties. :type service_provider_properties: ~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitServiceProviderProperties :param express_route_port: The reference to the ExpressRoutePort resource when the circuit is provisioned on an ExpressRoutePort resource. :type express_route_port: ~azure.mgmt.network.v2020_04_01.models.SubResource :param bandwidth_in_gbps: The bandwidth of the circuit when the circuit is provisioned on an ExpressRoutePort resource. :type bandwidth_in_gbps: float :ivar stag: The identifier of the circuit traffic. Outer tag for QinQ encapsulation. :vartype stag: int :ivar provisioning_state: The provisioning state of the express route circuit resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param gateway_manager_etag: The GatewayManager Etag. :type gateway_manager_etag: str :param global_reach_enabled: Flag denoting global reach status. :type global_reach_enabled: bool """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'stag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'ExpressRouteCircuitSku'}, 'etag': {'key': 'etag', 'type': 'str'}, 'allow_classic_operations': {'key': 'properties.allowClassicOperations', 'type': 'bool'}, 'circuit_provisioning_state': {'key': 'properties.circuitProvisioningState', 'type': 'str'}, 'service_provider_provisioning_state': {'key': 'properties.serviceProviderProvisioningState', 'type': 'str'}, 'authorizations': {'key': 'properties.authorizations', 'type': '[ExpressRouteCircuitAuthorization]'}, 'peerings': {'key': 'properties.peerings', 'type': '[ExpressRouteCircuitPeering]'}, 'service_key': {'key': 'properties.serviceKey', 'type': 'str'}, 'service_provider_notes': {'key': 'properties.serviceProviderNotes', 'type': 'str'}, 'service_provider_properties': {'key': 'properties.serviceProviderProperties', 'type': 'ExpressRouteCircuitServiceProviderProperties'}, 'express_route_port': {'key': 'properties.expressRoutePort', 'type': 'SubResource'}, 'bandwidth_in_gbps': {'key': 'properties.bandwidthInGbps', 'type': 'float'}, 'stag': {'key': 'properties.stag', 'type': 'int'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'gateway_manager_etag': {'key': 'properties.gatewayManagerEtag', 'type': 'str'}, 'global_reach_enabled': {'key': 'properties.globalReachEnabled', 'type': 'bool'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuit, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.etag = None self.allow_classic_operations = kwargs.get('allow_classic_operations', None) self.circuit_provisioning_state = kwargs.get('circuit_provisioning_state', None) self.service_provider_provisioning_state = kwargs.get('service_provider_provisioning_state', None) self.authorizations = kwargs.get('authorizations', None) self.peerings = kwargs.get('peerings', None) self.service_key = kwargs.get('service_key', None) self.service_provider_notes = kwargs.get('service_provider_notes', None) self.service_provider_properties = kwargs.get('service_provider_properties', None) self.express_route_port = kwargs.get('express_route_port', None) self.bandwidth_in_gbps = kwargs.get('bandwidth_in_gbps', None) self.stag = None self.provisioning_state = None self.gateway_manager_etag = kwargs.get('gateway_manager_etag', None) self.global_reach_enabled = kwargs.get('global_reach_enabled', None) class ExpressRouteCircuitArpTable(msrest.serialization.Model): """The ARP table associated with the ExpressRouteCircuit. :param age: Entry age in minutes. :type age: int :param interface: Interface address. :type interface: str :param ip_address: The IP address. :type ip_address: str :param mac_address: The MAC address. :type mac_address: str """ _attribute_map = { 'age': {'key': 'age', 'type': 'int'}, 'interface': {'key': 'interface', 'type': 'str'}, 'ip_address': {'key': 'ipAddress', 'type': 'str'}, 'mac_address': {'key': 'macAddress', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitArpTable, self).__init__(**kwargs) self.age = kwargs.get('age', None) self.interface = kwargs.get('interface', None) self.ip_address = kwargs.get('ip_address', None) self.mac_address = kwargs.get('mac_address', None) class ExpressRouteCircuitAuthorization(SubResource): """Authorization in an ExpressRouteCircuit resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param authorization_key: The authorization key. :type authorization_key: str :param authorization_use_status: The authorization use status. Possible values include: "Available", "InUse". :type authorization_use_status: str or ~azure.mgmt.network.v2020_04_01.models.AuthorizationUseStatus :ivar provisioning_state: The provisioning state of the authorization resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'authorization_key': {'key': 'properties.authorizationKey', 'type': 'str'}, 'authorization_use_status': {'key': 'properties.authorizationUseStatus', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitAuthorization, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.authorization_key = kwargs.get('authorization_key', None) self.authorization_use_status = kwargs.get('authorization_use_status', None) self.provisioning_state = None class ExpressRouteCircuitConnection(SubResource): """Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param express_route_circuit_peering: Reference to Express Route Circuit Private Peering Resource of the circuit initiating connection. :type express_route_circuit_peering: ~azure.mgmt.network.v2020_04_01.models.SubResource :param peer_express_route_circuit_peering: Reference to Express Route Circuit Private Peering Resource of the peered circuit. :type peer_express_route_circuit_peering: ~azure.mgmt.network.v2020_04_01.models.SubResource :param address_prefix: /29 IP address space to carve out Customer addresses for tunnels. :type address_prefix: str :param authorization_key: The authorization key. :type authorization_key: str :param ipv6_circuit_connection_config: IPv6 Address PrefixProperties of the express route circuit connection. :type ipv6_circuit_connection_config: ~azure.mgmt.network.v2020_04_01.models.Ipv6CircuitConnectionConfig :ivar circuit_connection_status: Express Route Circuit connection state. Possible values include: "Connected", "Connecting", "Disconnected". :vartype circuit_connection_status: str or ~azure.mgmt.network.v2020_04_01.models.CircuitConnectionStatus :ivar provisioning_state: The provisioning state of the express route circuit connection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'circuit_connection_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'express_route_circuit_peering': {'key': 'properties.expressRouteCircuitPeering', 'type': 'SubResource'}, 'peer_express_route_circuit_peering': {'key': 'properties.peerExpressRouteCircuitPeering', 'type': 'SubResource'}, 'address_prefix': {'key': 'properties.addressPrefix', 'type': 'str'}, 'authorization_key': {'key': 'properties.authorizationKey', 'type': 'str'}, 'ipv6_circuit_connection_config': {'key': 'properties.ipv6CircuitConnectionConfig', 'type': 'Ipv6CircuitConnectionConfig'}, 'circuit_connection_status': {'key': 'properties.circuitConnectionStatus', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitConnection, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.express_route_circuit_peering = kwargs.get('express_route_circuit_peering', None) self.peer_express_route_circuit_peering = kwargs.get('peer_express_route_circuit_peering', None) self.address_prefix = kwargs.get('address_prefix', None) self.authorization_key = kwargs.get('authorization_key', None) self.ipv6_circuit_connection_config = kwargs.get('ipv6_circuit_connection_config', None) self.circuit_connection_status = None self.provisioning_state = None class ExpressRouteCircuitConnectionListResult(msrest.serialization.Model): """Response for ListConnections API service call retrieves all global reach connections that belongs to a Private Peering for an ExpressRouteCircuit. :param value: The global reach connection associated with Private Peering in an ExpressRoute Circuit. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitConnection] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteCircuitConnection]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitConnectionListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ExpressRouteCircuitListResult(msrest.serialization.Model): """Response for ListExpressRouteCircuit API service call. :param value: A list of ExpressRouteCircuits in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuit] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteCircuit]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ExpressRouteCircuitPeering(SubResource): """Peering in an ExpressRouteCircuit resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param peering_type: The peering type. Possible values include: "AzurePublicPeering", "AzurePrivatePeering", "MicrosoftPeering". :type peering_type: str or ~azure.mgmt.network.v2020_04_01.models.ExpressRoutePeeringType :param state: The peering state. Possible values include: "Disabled", "Enabled". :type state: str or ~azure.mgmt.network.v2020_04_01.models.ExpressRoutePeeringState :param azure_asn: The Azure ASN. :type azure_asn: int :param peer_asn: The peer ASN. :type peer_asn: long :param primary_peer_address_prefix: The primary address prefix. :type primary_peer_address_prefix: str :param secondary_peer_address_prefix: The secondary address prefix. :type secondary_peer_address_prefix: str :param primary_azure_port: The primary port. :type primary_azure_port: str :param secondary_azure_port: The secondary port. :type secondary_azure_port: str :param shared_key: The shared key. :type shared_key: str :param vlan_id: The VLAN ID. :type vlan_id: int :param microsoft_peering_config: The Microsoft peering configuration. :type microsoft_peering_config: ~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitPeeringConfig :param stats: The peering stats of express route circuit. :type stats: ~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitStats :ivar provisioning_state: The provisioning state of the express route circuit peering resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param gateway_manager_etag: The GatewayManager Etag. :type gateway_manager_etag: str :ivar last_modified_by: Who was the last to modify the peering. :vartype last_modified_by: str :param route_filter: The reference to the RouteFilter resource. :type route_filter: ~azure.mgmt.network.v2020_04_01.models.SubResource :param ipv6_peering_config: The IPv6 peering configuration. :type ipv6_peering_config: ~azure.mgmt.network.v2020_04_01.models.Ipv6ExpressRouteCircuitPeeringConfig :param express_route_connection: The ExpressRoute connection. :type express_route_connection: ~azure.mgmt.network.v2020_04_01.models.ExpressRouteConnectionId :param connections: The list of circuit connections associated with Azure Private Peering for this circuit. :type connections: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitConnection] :ivar peered_connections: The list of peered circuit connections associated with Azure Private Peering for this circuit. :vartype peered_connections: list[~azure.mgmt.network.v2020_04_01.models.PeerExpressRouteCircuitConnection] """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'peer_asn': {'maximum': 4294967295, 'minimum': 1}, 'provisioning_state': {'readonly': True}, 'last_modified_by': {'readonly': True}, 'peered_connections': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'peering_type': {'key': 'properties.peeringType', 'type': 'str'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'azure_asn': {'key': 'properties.azureASN', 'type': 'int'}, 'peer_asn': {'key': 'properties.peerASN', 'type': 'long'}, 'primary_peer_address_prefix': {'key': 'properties.primaryPeerAddressPrefix', 'type': 'str'}, 'secondary_peer_address_prefix': {'key': 'properties.secondaryPeerAddressPrefix', 'type': 'str'}, 'primary_azure_port': {'key': 'properties.primaryAzurePort', 'type': 'str'}, 'secondary_azure_port': {'key': 'properties.secondaryAzurePort', 'type': 'str'}, 'shared_key': {'key': 'properties.sharedKey', 'type': 'str'}, 'vlan_id': {'key': 'properties.vlanId', 'type': 'int'}, 'microsoft_peering_config': {'key': 'properties.microsoftPeeringConfig', 'type': 'ExpressRouteCircuitPeeringConfig'}, 'stats': {'key': 'properties.stats', 'type': 'ExpressRouteCircuitStats'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'gateway_manager_etag': {'key': 'properties.gatewayManagerEtag', 'type': 'str'}, 'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'}, 'route_filter': {'key': 'properties.routeFilter', 'type': 'SubResource'}, 'ipv6_peering_config': {'key': 'properties.ipv6PeeringConfig', 'type': 'Ipv6ExpressRouteCircuitPeeringConfig'}, 'express_route_connection': {'key': 'properties.expressRouteConnection', 'type': 'ExpressRouteConnectionId'}, 'connections': {'key': 'properties.connections', 'type': '[ExpressRouteCircuitConnection]'}, 'peered_connections': {'key': 'properties.peeredConnections', 'type': '[PeerExpressRouteCircuitConnection]'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitPeering, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.peering_type = kwargs.get('peering_type', None) self.state = kwargs.get('state', None) self.azure_asn = kwargs.get('azure_asn', None) self.peer_asn = kwargs.get('peer_asn', None) self.primary_peer_address_prefix = kwargs.get('primary_peer_address_prefix', None) self.secondary_peer_address_prefix = kwargs.get('secondary_peer_address_prefix', None) self.primary_azure_port = kwargs.get('primary_azure_port', None) self.secondary_azure_port = kwargs.get('secondary_azure_port', None) self.shared_key = kwargs.get('shared_key', None) self.vlan_id = kwargs.get('vlan_id', None) self.microsoft_peering_config = kwargs.get('microsoft_peering_config', None) self.stats = kwargs.get('stats', None) self.provisioning_state = None self.gateway_manager_etag = kwargs.get('gateway_manager_etag', None) self.last_modified_by = None self.route_filter = kwargs.get('route_filter', None) self.ipv6_peering_config = kwargs.get('ipv6_peering_config', None) self.express_route_connection = kwargs.get('express_route_connection', None) self.connections = kwargs.get('connections', None) self.peered_connections = None class ExpressRouteCircuitPeeringConfig(msrest.serialization.Model): """Specifies the peering configuration. Variables are only populated by the server, and will be ignored when sending a request. :param advertised_public_prefixes: The reference to AdvertisedPublicPrefixes. :type advertised_public_prefixes: list[str] :param advertised_communities: The communities of bgp peering. Specified for microsoft peering. :type advertised_communities: list[str] :ivar advertised_public_prefixes_state: The advertised public prefix state of the Peering resource. Possible values include: "NotConfigured", "Configuring", "Configured", "ValidationNeeded". :vartype advertised_public_prefixes_state: str or ~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitPeeringAdvertisedPublicPrefixState :param legacy_mode: The legacy mode of the peering. :type legacy_mode: int :param customer_asn: The CustomerASN of the peering. :type customer_asn: int :param routing_registry_name: The RoutingRegistryName of the configuration. :type routing_registry_name: str """ _validation = { 'advertised_public_prefixes_state': {'readonly': True}, } _attribute_map = { 'advertised_public_prefixes': {'key': 'advertisedPublicPrefixes', 'type': '[str]'}, 'advertised_communities': {'key': 'advertisedCommunities', 'type': '[str]'}, 'advertised_public_prefixes_state': {'key': 'advertisedPublicPrefixesState', 'type': 'str'}, 'legacy_mode': {'key': 'legacyMode', 'type': 'int'}, 'customer_asn': {'key': 'customerASN', 'type': 'int'}, 'routing_registry_name': {'key': 'routingRegistryName', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitPeeringConfig, self).__init__(**kwargs) self.advertised_public_prefixes = kwargs.get('advertised_public_prefixes', None) self.advertised_communities = kwargs.get('advertised_communities', None) self.advertised_public_prefixes_state = None self.legacy_mode = kwargs.get('legacy_mode', None) self.customer_asn = kwargs.get('customer_asn', None) self.routing_registry_name = kwargs.get('routing_registry_name', None) class ExpressRouteCircuitPeeringId(msrest.serialization.Model): """ExpressRoute circuit peering identifier. :param id: The ID of the ExpressRoute circuit peering. :type id: str """ _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitPeeringId, self).__init__(**kwargs) self.id = kwargs.get('id', None) class ExpressRouteCircuitPeeringListResult(msrest.serialization.Model): """Response for ListPeering API service call retrieves all peerings that belong to an ExpressRouteCircuit. :param value: The peerings in an express route circuit. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitPeering] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteCircuitPeering]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitPeeringListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ExpressRouteCircuitReference(msrest.serialization.Model): """Reference to an express route circuit. :param id: Corresponding Express Route Circuit Id. :type id: str """ _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitReference, self).__init__(**kwargs) self.id = kwargs.get('id', None) class ExpressRouteCircuitRoutesTable(msrest.serialization.Model): """The routes table associated with the ExpressRouteCircuit. :param network: IP address of a network entity. :type network: str :param next_hop: NextHop address. :type next_hop: str :param loc_prf: Local preference value as set with the set local-preference route-map configuration command. :type loc_prf: str :param weight: Route Weight. :type weight: int :param path: Autonomous system paths to the destination network. :type path: str """ _attribute_map = { 'network': {'key': 'network', 'type': 'str'}, 'next_hop': {'key': 'nextHop', 'type': 'str'}, 'loc_prf': {'key': 'locPrf', 'type': 'str'}, 'weight': {'key': 'weight', 'type': 'int'}, 'path': {'key': 'path', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitRoutesTable, self).__init__(**kwargs) self.network = kwargs.get('network', None) self.next_hop = kwargs.get('next_hop', None) self.loc_prf = kwargs.get('loc_prf', None) self.weight = kwargs.get('weight', None) self.path = kwargs.get('path', None) class ExpressRouteCircuitRoutesTableSummary(msrest.serialization.Model): """The routes table associated with the ExpressRouteCircuit. :param neighbor: IP address of the neighbor. :type neighbor: str :param v: BGP version number spoken to the neighbor. :type v: int :param as_property: Autonomous system number. :type as_property: int :param up_down: The length of time that the BGP session has been in the Established state, or the current status if not in the Established state. :type up_down: str :param state_pfx_rcd: Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group. :type state_pfx_rcd: str """ _attribute_map = { 'neighbor': {'key': 'neighbor', 'type': 'str'}, 'v': {'key': 'v', 'type': 'int'}, 'as_property': {'key': 'as', 'type': 'int'}, 'up_down': {'key': 'upDown', 'type': 'str'}, 'state_pfx_rcd': {'key': 'statePfxRcd', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitRoutesTableSummary, self).__init__(**kwargs) self.neighbor = kwargs.get('neighbor', None) self.v = kwargs.get('v', None) self.as_property = kwargs.get('as_property', None) self.up_down = kwargs.get('up_down', None) self.state_pfx_rcd = kwargs.get('state_pfx_rcd', None) class ExpressRouteCircuitsArpTableListResult(msrest.serialization.Model): """Response for ListArpTable associated with the Express Route Circuits API. :param value: A list of the ARP tables. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitArpTable] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteCircuitArpTable]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitsArpTableListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ExpressRouteCircuitServiceProviderProperties(msrest.serialization.Model): """Contains ServiceProviderProperties in an ExpressRouteCircuit. :param service_provider_name: The serviceProviderName. :type service_provider_name: str :param peering_location: The peering location. :type peering_location: str :param bandwidth_in_mbps: The BandwidthInMbps. :type bandwidth_in_mbps: int """ _attribute_map = { 'service_provider_name': {'key': 'serviceProviderName', 'type': 'str'}, 'peering_location': {'key': 'peeringLocation', 'type': 'str'}, 'bandwidth_in_mbps': {'key': 'bandwidthInMbps', 'type': 'int'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitServiceProviderProperties, self).__init__(**kwargs) self.service_provider_name = kwargs.get('service_provider_name', None) self.peering_location = kwargs.get('peering_location', None) self.bandwidth_in_mbps = kwargs.get('bandwidth_in_mbps', None) class ExpressRouteCircuitSku(msrest.serialization.Model): """Contains SKU in an ExpressRouteCircuit. :param name: The name of the SKU. :type name: str :param tier: The tier of the SKU. Possible values include: "Standard", "Premium", "Basic", "Local". :type tier: str or ~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitSkuTier :param family: The family of the SKU. Possible values include: "UnlimitedData", "MeteredData". :type family: str or ~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitSkuFamily """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'tier': {'key': 'tier', 'type': 'str'}, 'family': {'key': 'family', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitSku, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) self.family = kwargs.get('family', None) class ExpressRouteCircuitsRoutesTableListResult(msrest.serialization.Model): """Response for ListRoutesTable associated with the Express Route Circuits API. :param value: The list of routes table. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitRoutesTable] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteCircuitRoutesTable]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitsRoutesTableListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ExpressRouteCircuitsRoutesTableSummaryListResult(msrest.serialization.Model): """Response for ListRoutesTable associated with the Express Route Circuits API. :param value: A list of the routes table. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitRoutesTableSummary] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteCircuitRoutesTableSummary]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitsRoutesTableSummaryListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ExpressRouteCircuitStats(msrest.serialization.Model): """Contains stats associated with the peering. :param primarybytes_in: The Primary BytesIn of the peering. :type primarybytes_in: long :param primarybytes_out: The primary BytesOut of the peering. :type primarybytes_out: long :param secondarybytes_in: The secondary BytesIn of the peering. :type secondarybytes_in: long :param secondarybytes_out: The secondary BytesOut of the peering. :type secondarybytes_out: long """ _attribute_map = { 'primarybytes_in': {'key': 'primarybytesIn', 'type': 'long'}, 'primarybytes_out': {'key': 'primarybytesOut', 'type': 'long'}, 'secondarybytes_in': {'key': 'secondarybytesIn', 'type': 'long'}, 'secondarybytes_out': {'key': 'secondarybytesOut', 'type': 'long'}, } def __init__( self, **kwargs ): super(ExpressRouteCircuitStats, self).__init__(**kwargs) self.primarybytes_in = kwargs.get('primarybytes_in', None) self.primarybytes_out = kwargs.get('primarybytes_out', None) self.secondarybytes_in = kwargs.get('secondarybytes_in', None) self.secondarybytes_out = kwargs.get('secondarybytes_out', None) class ExpressRouteConnection(SubResource): """ExpressRouteConnection resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param id: Resource ID. :type id: str :param name: Required. The name of the resource. :type name: str :ivar provisioning_state: The provisioning state of the express route connection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param express_route_circuit_peering: The ExpressRoute circuit peering. :type express_route_circuit_peering: ~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitPeeringId :param authorization_key: Authorization key to establish the connection. :type authorization_key: str :param routing_weight: The routing weight associated to the connection. :type routing_weight: int :param enable_internet_security: Enable internet security. :type enable_internet_security: bool :param routing_configuration: The Routing Configuration indicating the associated and propagated route tables on this connection. :type routing_configuration: ~azure.mgmt.network.v2020_04_01.models.RoutingConfiguration """ _validation = { 'name': {'required': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'express_route_circuit_peering': {'key': 'properties.expressRouteCircuitPeering', 'type': 'ExpressRouteCircuitPeeringId'}, 'authorization_key': {'key': 'properties.authorizationKey', 'type': 'str'}, 'routing_weight': {'key': 'properties.routingWeight', 'type': 'int'}, 'enable_internet_security': {'key': 'properties.enableInternetSecurity', 'type': 'bool'}, 'routing_configuration': {'key': 'properties.routingConfiguration', 'type': 'RoutingConfiguration'}, } def __init__( self, **kwargs ): super(ExpressRouteConnection, self).__init__(**kwargs) self.name = kwargs['name'] self.provisioning_state = None self.express_route_circuit_peering = kwargs.get('express_route_circuit_peering', None) self.authorization_key = kwargs.get('authorization_key', None) self.routing_weight = kwargs.get('routing_weight', None) self.enable_internet_security = kwargs.get('enable_internet_security', None) self.routing_configuration = kwargs.get('routing_configuration', None) class ExpressRouteConnectionId(msrest.serialization.Model): """The ID of the ExpressRouteConnection. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: The ID of the ExpressRouteConnection. :vartype id: str """ _validation = { 'id': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteConnectionId, self).__init__(**kwargs) self.id = None class ExpressRouteConnectionList(msrest.serialization.Model): """ExpressRouteConnection list. :param value: The list of ExpressRoute connections. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteConnection] """ _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteConnection]'}, } def __init__( self, **kwargs ): super(ExpressRouteConnectionList, self).__init__(**kwargs) self.value = kwargs.get('value', None) class ExpressRouteCrossConnection(Resource): """ExpressRouteCrossConnection resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar primary_azure_port: The name of the primary port. :vartype primary_azure_port: str :ivar secondary_azure_port: The name of the secondary port. :vartype secondary_azure_port: str :ivar s_tag: The identifier of the circuit traffic. :vartype s_tag: int :param peering_location: The peering location of the ExpressRoute circuit. :type peering_location: str :param bandwidth_in_mbps: The circuit bandwidth In Mbps. :type bandwidth_in_mbps: int :param express_route_circuit: The ExpressRouteCircuit. :type express_route_circuit: ~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitReference :param service_provider_provisioning_state: The provisioning state of the circuit in the connectivity provider system. Possible values include: "NotProvisioned", "Provisioning", "Provisioned", "Deprovisioning". :type service_provider_provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ServiceProviderProvisioningState :param service_provider_notes: Additional read only notes set by the connectivity provider. :type service_provider_notes: str :ivar provisioning_state: The provisioning state of the express route cross connection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param peerings: The list of peerings. :type peerings: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCrossConnectionPeering] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'primary_azure_port': {'readonly': True}, 'secondary_azure_port': {'readonly': True}, 's_tag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'primary_azure_port': {'key': 'properties.primaryAzurePort', 'type': 'str'}, 'secondary_azure_port': {'key': 'properties.secondaryAzurePort', 'type': 'str'}, 's_tag': {'key': 'properties.sTag', 'type': 'int'}, 'peering_location': {'key': 'properties.peeringLocation', 'type': 'str'}, 'bandwidth_in_mbps': {'key': 'properties.bandwidthInMbps', 'type': 'int'}, 'express_route_circuit': {'key': 'properties.expressRouteCircuit', 'type': 'ExpressRouteCircuitReference'}, 'service_provider_provisioning_state': {'key': 'properties.serviceProviderProvisioningState', 'type': 'str'}, 'service_provider_notes': {'key': 'properties.serviceProviderNotes', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'peerings': {'key': 'properties.peerings', 'type': '[ExpressRouteCrossConnectionPeering]'}, } def __init__( self, **kwargs ): super(ExpressRouteCrossConnection, self).__init__(**kwargs) self.etag = None self.primary_azure_port = None self.secondary_azure_port = None self.s_tag = None self.peering_location = kwargs.get('peering_location', None) self.bandwidth_in_mbps = kwargs.get('bandwidth_in_mbps', None) self.express_route_circuit = kwargs.get('express_route_circuit', None) self.service_provider_provisioning_state = kwargs.get('service_provider_provisioning_state', None) self.service_provider_notes = kwargs.get('service_provider_notes', None) self.provisioning_state = None self.peerings = kwargs.get('peerings', None) class ExpressRouteCrossConnectionListResult(msrest.serialization.Model): """Response for ListExpressRouteCrossConnection API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of ExpressRouteCrossConnection resources. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCrossConnection] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteCrossConnection]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCrossConnectionListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class ExpressRouteCrossConnectionPeering(SubResource): """Peering in an ExpressRoute Cross Connection resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param peering_type: The peering type. Possible values include: "AzurePublicPeering", "AzurePrivatePeering", "MicrosoftPeering". :type peering_type: str or ~azure.mgmt.network.v2020_04_01.models.ExpressRoutePeeringType :param state: The peering state. Possible values include: "Disabled", "Enabled". :type state: str or ~azure.mgmt.network.v2020_04_01.models.ExpressRoutePeeringState :ivar azure_asn: The Azure ASN. :vartype azure_asn: int :param peer_asn: The peer ASN. :type peer_asn: long :param primary_peer_address_prefix: The primary address prefix. :type primary_peer_address_prefix: str :param secondary_peer_address_prefix: The secondary address prefix. :type secondary_peer_address_prefix: str :ivar primary_azure_port: The primary port. :vartype primary_azure_port: str :ivar secondary_azure_port: The secondary port. :vartype secondary_azure_port: str :param shared_key: The shared key. :type shared_key: str :param vlan_id: The VLAN ID. :type vlan_id: int :param microsoft_peering_config: The Microsoft peering configuration. :type microsoft_peering_config: ~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitPeeringConfig :ivar provisioning_state: The provisioning state of the express route cross connection peering resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param gateway_manager_etag: The GatewayManager Etag. :type gateway_manager_etag: str :ivar last_modified_by: Who was the last to modify the peering. :vartype last_modified_by: str :param ipv6_peering_config: The IPv6 peering configuration. :type ipv6_peering_config: ~azure.mgmt.network.v2020_04_01.models.Ipv6ExpressRouteCircuitPeeringConfig """ _validation = { 'etag': {'readonly': True}, 'azure_asn': {'readonly': True}, 'peer_asn': {'maximum': 4294967295, 'minimum': 1}, 'primary_azure_port': {'readonly': True}, 'secondary_azure_port': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'last_modified_by': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'peering_type': {'key': 'properties.peeringType', 'type': 'str'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'azure_asn': {'key': 'properties.azureASN', 'type': 'int'}, 'peer_asn': {'key': 'properties.peerASN', 'type': 'long'}, 'primary_peer_address_prefix': {'key': 'properties.primaryPeerAddressPrefix', 'type': 'str'}, 'secondary_peer_address_prefix': {'key': 'properties.secondaryPeerAddressPrefix', 'type': 'str'}, 'primary_azure_port': {'key': 'properties.primaryAzurePort', 'type': 'str'}, 'secondary_azure_port': {'key': 'properties.secondaryAzurePort', 'type': 'str'}, 'shared_key': {'key': 'properties.sharedKey', 'type': 'str'}, 'vlan_id': {'key': 'properties.vlanId', 'type': 'int'}, 'microsoft_peering_config': {'key': 'properties.microsoftPeeringConfig', 'type': 'ExpressRouteCircuitPeeringConfig'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'gateway_manager_etag': {'key': 'properties.gatewayManagerEtag', 'type': 'str'}, 'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'}, 'ipv6_peering_config': {'key': 'properties.ipv6PeeringConfig', 'type': 'Ipv6ExpressRouteCircuitPeeringConfig'}, } def __init__( self, **kwargs ): super(ExpressRouteCrossConnectionPeering, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.peering_type = kwargs.get('peering_type', None) self.state = kwargs.get('state', None) self.azure_asn = None self.peer_asn = kwargs.get('peer_asn', None) self.primary_peer_address_prefix = kwargs.get('primary_peer_address_prefix', None) self.secondary_peer_address_prefix = kwargs.get('secondary_peer_address_prefix', None) self.primary_azure_port = None self.secondary_azure_port = None self.shared_key = kwargs.get('shared_key', None) self.vlan_id = kwargs.get('vlan_id', None) self.microsoft_peering_config = kwargs.get('microsoft_peering_config', None) self.provisioning_state = None self.gateway_manager_etag = kwargs.get('gateway_manager_etag', None) self.last_modified_by = None self.ipv6_peering_config = kwargs.get('ipv6_peering_config', None) class ExpressRouteCrossConnectionPeeringList(msrest.serialization.Model): """Response for ListPeering API service call retrieves all peerings that belong to an ExpressRouteCrossConnection. Variables are only populated by the server, and will be ignored when sending a request. :param value: The peerings in an express route cross connection. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCrossConnectionPeering] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteCrossConnectionPeering]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCrossConnectionPeeringList, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class ExpressRouteCrossConnectionRoutesTableSummary(msrest.serialization.Model): """The routes table associated with the ExpressRouteCircuit. :param neighbor: IP address of Neighbor router. :type neighbor: str :param asn: Autonomous system number. :type asn: int :param up_down: The length of time that the BGP session has been in the Established state, or the current status if not in the Established state. :type up_down: str :param state_or_prefixes_received: Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group. :type state_or_prefixes_received: str """ _attribute_map = { 'neighbor': {'key': 'neighbor', 'type': 'str'}, 'asn': {'key': 'asn', 'type': 'int'}, 'up_down': {'key': 'upDown', 'type': 'str'}, 'state_or_prefixes_received': {'key': 'stateOrPrefixesReceived', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCrossConnectionRoutesTableSummary, self).__init__(**kwargs) self.neighbor = kwargs.get('neighbor', None) self.asn = kwargs.get('asn', None) self.up_down = kwargs.get('up_down', None) self.state_or_prefixes_received = kwargs.get('state_or_prefixes_received', None) class ExpressRouteCrossConnectionsRoutesTableSummaryListResult(msrest.serialization.Model): """Response for ListRoutesTable associated with the Express Route Cross Connections. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of the routes table. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCrossConnectionRoutesTableSummary] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteCrossConnectionRoutesTableSummary]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteCrossConnectionsRoutesTableSummaryListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class ExpressRouteGateway(Resource): """ExpressRoute gateway resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param auto_scale_configuration: Configuration for auto scaling. :type auto_scale_configuration: ~azure.mgmt.network.v2020_04_01.models.ExpressRouteGatewayPropertiesAutoScaleConfiguration :ivar express_route_connections: List of ExpressRoute connections to the ExpressRoute gateway. :vartype express_route_connections: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteConnection] :ivar provisioning_state: The provisioning state of the express route gateway resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param virtual_hub: The Virtual Hub where the ExpressRoute gateway is or will be deployed. :type virtual_hub: ~azure.mgmt.network.v2020_04_01.models.VirtualHubId """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'express_route_connections': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'auto_scale_configuration': {'key': 'properties.autoScaleConfiguration', 'type': 'ExpressRouteGatewayPropertiesAutoScaleConfiguration'}, 'express_route_connections': {'key': 'properties.expressRouteConnections', 'type': '[ExpressRouteConnection]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'virtual_hub': {'key': 'properties.virtualHub', 'type': 'VirtualHubId'}, } def __init__( self, **kwargs ): super(ExpressRouteGateway, self).__init__(**kwargs) self.etag = None self.auto_scale_configuration = kwargs.get('auto_scale_configuration', None) self.express_route_connections = None self.provisioning_state = None self.virtual_hub = kwargs.get('virtual_hub', None) class ExpressRouteGatewayList(msrest.serialization.Model): """List of ExpressRoute gateways. :param value: List of ExpressRoute gateways. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteGateway] """ _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteGateway]'}, } def __init__( self, **kwargs ): super(ExpressRouteGatewayList, self).__init__(**kwargs) self.value = kwargs.get('value', None) class ExpressRouteGatewayPropertiesAutoScaleConfiguration(msrest.serialization.Model): """Configuration for auto scaling. :param bounds: Minimum and maximum number of scale units to deploy. :type bounds: ~azure.mgmt.network.v2020_04_01.models.ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds """ _attribute_map = { 'bounds': {'key': 'bounds', 'type': 'ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds'}, } def __init__( self, **kwargs ): super(ExpressRouteGatewayPropertiesAutoScaleConfiguration, self).__init__(**kwargs) self.bounds = kwargs.get('bounds', None) class ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds(msrest.serialization.Model): """Minimum and maximum number of scale units to deploy. :param min: Minimum number of scale units deployed for ExpressRoute gateway. :type min: int :param max: Maximum number of scale units deployed for ExpressRoute gateway. :type max: int """ _attribute_map = { 'min': {'key': 'min', 'type': 'int'}, 'max': {'key': 'max', 'type': 'int'}, } def __init__( self, **kwargs ): super(ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds, self).__init__(**kwargs) self.min = kwargs.get('min', None) self.max = kwargs.get('max', None) class ExpressRouteLink(SubResource): """ExpressRouteLink child resource definition. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of child port resource that is unique among child port resources of the parent. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar router_name: Name of Azure router associated with physical port. :vartype router_name: str :ivar interface_name: Name of Azure router interface. :vartype interface_name: str :ivar patch_panel_id: Mapping between physical port to patch panel port. :vartype patch_panel_id: str :ivar rack_id: Mapping of physical patch panel to rack. :vartype rack_id: str :ivar connector_type: Physical fiber port type. Possible values include: "LC", "SC". :vartype connector_type: str or ~azure.mgmt.network.v2020_04_01.models.ExpressRouteLinkConnectorType :param admin_state: Administrative state of the physical port. Possible values include: "Enabled", "Disabled". :type admin_state: str or ~azure.mgmt.network.v2020_04_01.models.ExpressRouteLinkAdminState :ivar provisioning_state: The provisioning state of the express route link resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param mac_sec_config: MacSec configuration. :type mac_sec_config: ~azure.mgmt.network.v2020_04_01.models.ExpressRouteLinkMacSecConfig """ _validation = { 'etag': {'readonly': True}, 'router_name': {'readonly': True}, 'interface_name': {'readonly': True}, 'patch_panel_id': {'readonly': True}, 'rack_id': {'readonly': True}, 'connector_type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'router_name': {'key': 'properties.routerName', 'type': 'str'}, 'interface_name': {'key': 'properties.interfaceName', 'type': 'str'}, 'patch_panel_id': {'key': 'properties.patchPanelId', 'type': 'str'}, 'rack_id': {'key': 'properties.rackId', 'type': 'str'}, 'connector_type': {'key': 'properties.connectorType', 'type': 'str'}, 'admin_state': {'key': 'properties.adminState', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'mac_sec_config': {'key': 'properties.macSecConfig', 'type': 'ExpressRouteLinkMacSecConfig'}, } def __init__( self, **kwargs ): super(ExpressRouteLink, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.router_name = None self.interface_name = None self.patch_panel_id = None self.rack_id = None self.connector_type = None self.admin_state = kwargs.get('admin_state', None) self.provisioning_state = None self.mac_sec_config = kwargs.get('mac_sec_config', None) class ExpressRouteLinkListResult(msrest.serialization.Model): """Response for ListExpressRouteLinks API service call. :param value: The list of ExpressRouteLink sub-resources. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteLink] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteLink]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteLinkListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ExpressRouteLinkMacSecConfig(msrest.serialization.Model): """ExpressRouteLink Mac Security Configuration. :param ckn_secret_identifier: Keyvault Secret Identifier URL containing Mac security CKN key. :type ckn_secret_identifier: str :param cak_secret_identifier: Keyvault Secret Identifier URL containing Mac security CAK key. :type cak_secret_identifier: str :param cipher: Mac security cipher. Possible values include: "gcm-aes-128", "gcm-aes-256". :type cipher: str or ~azure.mgmt.network.v2020_04_01.models.ExpressRouteLinkMacSecCipher """ _attribute_map = { 'ckn_secret_identifier': {'key': 'cknSecretIdentifier', 'type': 'str'}, 'cak_secret_identifier': {'key': 'cakSecretIdentifier', 'type': 'str'}, 'cipher': {'key': 'cipher', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteLinkMacSecConfig, self).__init__(**kwargs) self.ckn_secret_identifier = kwargs.get('ckn_secret_identifier', None) self.cak_secret_identifier = kwargs.get('cak_secret_identifier', None) self.cipher = kwargs.get('cipher', None) class ExpressRoutePort(Resource): """ExpressRoutePort resource definition. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param identity: The identity of ExpressRoutePort, if configured. :type identity: ~azure.mgmt.network.v2020_04_01.models.ManagedServiceIdentity :param peering_location: The name of the peering location that the ExpressRoutePort is mapped to physically. :type peering_location: str :param bandwidth_in_gbps: Bandwidth of procured ports in Gbps. :type bandwidth_in_gbps: int :ivar provisioned_bandwidth_in_gbps: Aggregate Gbps of associated circuit bandwidths. :vartype provisioned_bandwidth_in_gbps: float :ivar mtu: Maximum transmission unit of the physical port pair(s). :vartype mtu: str :param encapsulation: Encapsulation method on physical ports. Possible values include: "Dot1Q", "QinQ". :type encapsulation: str or ~azure.mgmt.network.v2020_04_01.models.ExpressRoutePortsEncapsulation :ivar ether_type: Ether type of the physical port. :vartype ether_type: str :ivar allocation_date: Date of the physical port allocation to be used in Letter of Authorization. :vartype allocation_date: str :param links: The set of physical links of the ExpressRoutePort resource. :type links: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteLink] :ivar circuits: Reference the ExpressRoute circuit(s) that are provisioned on this ExpressRoutePort resource. :vartype circuits: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar provisioning_state: The provisioning state of the express route port resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :ivar resource_guid: The resource GUID property of the express route port resource. :vartype resource_guid: str """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioned_bandwidth_in_gbps': {'readonly': True}, 'mtu': {'readonly': True}, 'ether_type': {'readonly': True}, 'allocation_date': {'readonly': True}, 'circuits': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'resource_guid': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'peering_location': {'key': 'properties.peeringLocation', 'type': 'str'}, 'bandwidth_in_gbps': {'key': 'properties.bandwidthInGbps', 'type': 'int'}, 'provisioned_bandwidth_in_gbps': {'key': 'properties.provisionedBandwidthInGbps', 'type': 'float'}, 'mtu': {'key': 'properties.mtu', 'type': 'str'}, 'encapsulation': {'key': 'properties.encapsulation', 'type': 'str'}, 'ether_type': {'key': 'properties.etherType', 'type': 'str'}, 'allocation_date': {'key': 'properties.allocationDate', 'type': 'str'}, 'links': {'key': 'properties.links', 'type': '[ExpressRouteLink]'}, 'circuits': {'key': 'properties.circuits', 'type': '[SubResource]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRoutePort, self).__init__(**kwargs) self.etag = None self.identity = kwargs.get('identity', None) self.peering_location = kwargs.get('peering_location', None) self.bandwidth_in_gbps = kwargs.get('bandwidth_in_gbps', None) self.provisioned_bandwidth_in_gbps = None self.mtu = None self.encapsulation = kwargs.get('encapsulation', None) self.ether_type = None self.allocation_date = None self.links = kwargs.get('links', None) self.circuits = None self.provisioning_state = None self.resource_guid = None class ExpressRoutePortListResult(msrest.serialization.Model): """Response for ListExpressRoutePorts API service call. :param value: A list of ExpressRoutePort resources. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRoutePort] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRoutePort]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRoutePortListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ExpressRoutePortsLocation(Resource): """Definition of the ExpressRoutePorts peering location resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar address: Address of peering location. :vartype address: str :ivar contact: Contact details of peering locations. :vartype contact: str :param available_bandwidths: The inventory of available ExpressRoutePort bandwidths. :type available_bandwidths: list[~azure.mgmt.network.v2020_04_01.models.ExpressRoutePortsLocationBandwidths] :ivar provisioning_state: The provisioning state of the express route port location resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'address': {'readonly': True}, 'contact': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'address': {'key': 'properties.address', 'type': 'str'}, 'contact': {'key': 'properties.contact', 'type': 'str'}, 'available_bandwidths': {'key': 'properties.availableBandwidths', 'type': '[ExpressRoutePortsLocationBandwidths]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRoutePortsLocation, self).__init__(**kwargs) self.address = None self.contact = None self.available_bandwidths = kwargs.get('available_bandwidths', None) self.provisioning_state = None class ExpressRoutePortsLocationBandwidths(msrest.serialization.Model): """Real-time inventory of available ExpressRoute port bandwidths. Variables are only populated by the server, and will be ignored when sending a request. :ivar offer_name: Bandwidth descriptive name. :vartype offer_name: str :ivar value_in_gbps: Bandwidth value in Gbps. :vartype value_in_gbps: int """ _validation = { 'offer_name': {'readonly': True}, 'value_in_gbps': {'readonly': True}, } _attribute_map = { 'offer_name': {'key': 'offerName', 'type': 'str'}, 'value_in_gbps': {'key': 'valueInGbps', 'type': 'int'}, } def __init__( self, **kwargs ): super(ExpressRoutePortsLocationBandwidths, self).__init__(**kwargs) self.offer_name = None self.value_in_gbps = None class ExpressRoutePortsLocationListResult(msrest.serialization.Model): """Response for ListExpressRoutePortsLocations API service call. :param value: The list of all ExpressRoutePort peering locations. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRoutePortsLocation] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRoutePortsLocation]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRoutePortsLocationListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ExpressRouteServiceProvider(Resource): """A ExpressRouteResourceProvider object. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param peering_locations: A list of peering locations. :type peering_locations: list[str] :param bandwidths_offered: A list of bandwidths offered. :type bandwidths_offered: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteServiceProviderBandwidthsOffered] :ivar provisioning_state: The provisioning state of the express route service provider resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'peering_locations': {'key': 'properties.peeringLocations', 'type': '[str]'}, 'bandwidths_offered': {'key': 'properties.bandwidthsOffered', 'type': '[ExpressRouteServiceProviderBandwidthsOffered]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteServiceProvider, self).__init__(**kwargs) self.peering_locations = kwargs.get('peering_locations', None) self.bandwidths_offered = kwargs.get('bandwidths_offered', None) self.provisioning_state = None class ExpressRouteServiceProviderBandwidthsOffered(msrest.serialization.Model): """Contains bandwidths offered in ExpressRouteServiceProvider resources. :param offer_name: The OfferName. :type offer_name: str :param value_in_mbps: The ValueInMbps. :type value_in_mbps: int """ _attribute_map = { 'offer_name': {'key': 'offerName', 'type': 'str'}, 'value_in_mbps': {'key': 'valueInMbps', 'type': 'int'}, } def __init__( self, **kwargs ): super(ExpressRouteServiceProviderBandwidthsOffered, self).__init__(**kwargs) self.offer_name = kwargs.get('offer_name', None) self.value_in_mbps = kwargs.get('value_in_mbps', None) class ExpressRouteServiceProviderListResult(msrest.serialization.Model): """Response for the ListExpressRouteServiceProvider API service call. :param value: A list of ExpressRouteResourceProvider resources. :type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteServiceProvider] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteServiceProvider]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ExpressRouteServiceProviderListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class FirewallPolicy(Resource): """FirewallPolicy Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar rule_groups: List of references to FirewallPolicyRuleGroups. :vartype rule_groups: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar provisioning_state: The provisioning state of the firewall policy resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param base_policy: The parent firewall policy from which rules are inherited. :type base_policy: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar firewalls: List of references to Azure Firewalls that this Firewall Policy is associated with. :vartype firewalls: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar child_policies: List of references to Child Firewall Policies. :vartype child_policies: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :param threat_intel_mode: The operation mode for Threat Intelligence. Possible values include: "Alert", "Deny", "Off". :type threat_intel_mode: str or ~azure.mgmt.network.v2020_04_01.models.AzureFirewallThreatIntelMode :param threat_intel_whitelist: ThreatIntel Whitelist for Firewall Policy. :type threat_intel_whitelist: ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyThreatIntelWhitelist """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'rule_groups': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'firewalls': {'readonly': True}, 'child_policies': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'rule_groups': {'key': 'properties.ruleGroups', 'type': '[SubResource]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'base_policy': {'key': 'properties.basePolicy', 'type': 'SubResource'}, 'firewalls': {'key': 'properties.firewalls', 'type': '[SubResource]'}, 'child_policies': {'key': 'properties.childPolicies', 'type': '[SubResource]'}, 'threat_intel_mode': {'key': 'properties.threatIntelMode', 'type': 'str'}, 'threat_intel_whitelist': {'key': 'properties.threatIntelWhitelist', 'type': 'FirewallPolicyThreatIntelWhitelist'}, } def __init__( self, **kwargs ): super(FirewallPolicy, self).__init__(**kwargs) self.etag = None self.rule_groups = None self.provisioning_state = None self.base_policy = kwargs.get('base_policy', None) self.firewalls = None self.child_policies = None self.threat_intel_mode = kwargs.get('threat_intel_mode', None) self.threat_intel_whitelist = kwargs.get('threat_intel_whitelist', None) class FirewallPolicyRule(msrest.serialization.Model): """Properties of the rule. You probably want to use the sub-classes and not this class directly. Known sub-classes are: FirewallPolicyFilterRule, FirewallPolicyNatRule. All required parameters must be populated in order to send to Azure. :param rule_type: Required. The type of the rule.Constant filled by server. Possible values include: "FirewallPolicyNatRule", "FirewallPolicyFilterRule". :type rule_type: str or ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleType :param name: The name of the rule. :type name: str :param priority: Priority of the Firewall Policy Rule resource. :type priority: int """ _validation = { 'rule_type': {'required': True}, 'priority': {'maximum': 65000, 'minimum': 100}, } _attribute_map = { 'rule_type': {'key': 'ruleType', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'int'}, } _subtype_map = { 'rule_type': {'FirewallPolicyFilterRule': 'FirewallPolicyFilterRule', 'FirewallPolicyNatRule': 'FirewallPolicyNatRule'} } def __init__( self, **kwargs ): super(FirewallPolicyRule, self).__init__(**kwargs) self.rule_type = None # type: Optional[str] self.name = kwargs.get('name', None) self.priority = kwargs.get('priority', None) class FirewallPolicyFilterRule(FirewallPolicyRule): """Firewall Policy Filter Rule. All required parameters must be populated in order to send to Azure. :param rule_type: Required. The type of the rule.Constant filled by server. Possible values include: "FirewallPolicyNatRule", "FirewallPolicyFilterRule". :type rule_type: str or ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleType :param name: The name of the rule. :type name: str :param priority: Priority of the Firewall Policy Rule resource. :type priority: int :param action: The action type of a Filter rule. :type action: ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyFilterRuleAction :param rule_conditions: Collection of rule conditions used by a rule. :type rule_conditions: list[~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleCondition] """ _validation = { 'rule_type': {'required': True}, 'priority': {'maximum': 65000, 'minimum': 100}, } _attribute_map = { 'rule_type': {'key': 'ruleType', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'int'}, 'action': {'key': 'action', 'type': 'FirewallPolicyFilterRuleAction'}, 'rule_conditions': {'key': 'ruleConditions', 'type': '[FirewallPolicyRuleCondition]'}, } def __init__( self, **kwargs ): super(FirewallPolicyFilterRule, self).__init__(**kwargs) self.rule_type = 'FirewallPolicyFilterRule' # type: str self.action = kwargs.get('action', None) self.rule_conditions = kwargs.get('rule_conditions', None) class FirewallPolicyFilterRuleAction(msrest.serialization.Model): """Properties of the FirewallPolicyFilterRuleAction. :param type: The type of action. Possible values include: "Allow", "Deny". :type type: str or ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyFilterRuleActionType """ _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, **kwargs ): super(FirewallPolicyFilterRuleAction, self).__init__(**kwargs) self.type = kwargs.get('type', None) class FirewallPolicyListResult(msrest.serialization.Model): """Response for ListFirewallPolicies API service call. :param value: List of Firewall Policies in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.FirewallPolicy] :param next_link: URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[FirewallPolicy]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(FirewallPolicyListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class FirewallPolicyNatRule(FirewallPolicyRule): """Firewall Policy NAT Rule. All required parameters must be populated in order to send to Azure. :param rule_type: Required. The type of the rule.Constant filled by server. Possible values include: "FirewallPolicyNatRule", "FirewallPolicyFilterRule". :type rule_type: str or ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleType :param name: The name of the rule. :type name: str :param priority: Priority of the Firewall Policy Rule resource. :type priority: int :param action: The action type of a Nat rule. :type action: ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyNatRuleAction :param translated_address: The translated address for this NAT rule. :type translated_address: str :param translated_port: The translated port for this NAT rule. :type translated_port: str :param rule_condition: The match conditions for incoming traffic. :type rule_condition: ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleCondition """ _validation = { 'rule_type': {'required': True}, 'priority': {'maximum': 65000, 'minimum': 100}, } _attribute_map = { 'rule_type': {'key': 'ruleType', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'int'}, 'action': {'key': 'action', 'type': 'FirewallPolicyNatRuleAction'}, 'translated_address': {'key': 'translatedAddress', 'type': 'str'}, 'translated_port': {'key': 'translatedPort', 'type': 'str'}, 'rule_condition': {'key': 'ruleCondition', 'type': 'FirewallPolicyRuleCondition'}, } def __init__( self, **kwargs ): super(FirewallPolicyNatRule, self).__init__(**kwargs) self.rule_type = 'FirewallPolicyNatRule' # type: str self.action = kwargs.get('action', None) self.translated_address = kwargs.get('translated_address', None) self.translated_port = kwargs.get('translated_port', None) self.rule_condition = kwargs.get('rule_condition', None) class FirewallPolicyNatRuleAction(msrest.serialization.Model): """Properties of the FirewallPolicyNatRuleAction. :param type: The type of action. Possible values include: "DNAT". :type type: str or ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyNatRuleActionType """ _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, **kwargs ): super(FirewallPolicyNatRuleAction, self).__init__(**kwargs) self.type = kwargs.get('type', None) class FirewallPolicyRuleConditionApplicationProtocol(msrest.serialization.Model): """Properties of the application rule protocol. :param protocol_type: Protocol type. Possible values include: "Http", "Https". :type protocol_type: str or ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleConditionApplicationProtocolType :param port: Port number for the protocol, cannot be greater than 64000. :type port: int """ _validation = { 'port': {'maximum': 64000, 'minimum': 0}, } _attribute_map = { 'protocol_type': {'key': 'protocolType', 'type': 'str'}, 'port': {'key': 'port', 'type': 'int'}, } def __init__( self, **kwargs ): super(FirewallPolicyRuleConditionApplicationProtocol, self).__init__(**kwargs) self.protocol_type = kwargs.get('protocol_type', None) self.port = kwargs.get('port', None) class FirewallPolicyRuleGroup(SubResource): """Rule Group resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Rule Group type. :vartype type: str :param priority: Priority of the Firewall Policy Rule Group resource. :type priority: int :param rules: Group of Firewall Policy rules. :type rules: list[~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRule] :ivar provisioning_state: The provisioning state of the firewall policy rule group resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'priority': {'maximum': 65000, 'minimum': 100}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'priority': {'key': 'properties.priority', 'type': 'int'}, 'rules': {'key': 'properties.rules', 'type': '[FirewallPolicyRule]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(FirewallPolicyRuleGroup, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.priority = kwargs.get('priority', None) self.rules = kwargs.get('rules', None) self.provisioning_state = None class FirewallPolicyRuleGroupListResult(msrest.serialization.Model): """Response for ListFirewallPolicyRuleGroups API service call. :param value: List of FirewallPolicyRuleGroups in a FirewallPolicy. :type value: list[~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleGroup] :param next_link: URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[FirewallPolicyRuleGroup]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(FirewallPolicyRuleGroupListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class FirewallPolicyThreatIntelWhitelist(msrest.serialization.Model): """ThreatIntel Whitelist for Firewall Policy. :param ip_addresses: List of IP addresses for the ThreatIntel Whitelist. :type ip_addresses: list[str] :param fqdns: List of FQDNs for the ThreatIntel Whitelist. :type fqdns: list[str] """ _attribute_map = { 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, 'fqdns': {'key': 'fqdns', 'type': '[str]'}, } def __init__( self, **kwargs ): super(FirewallPolicyThreatIntelWhitelist, self).__init__(**kwargs) self.ip_addresses = kwargs.get('ip_addresses', None) self.fqdns = kwargs.get('fqdns', None) class FlowLog(Resource): """A flow log resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param target_resource_id: ID of network security group to which flow log will be applied. :type target_resource_id: str :ivar target_resource_guid: Guid of network security group to which flow log will be applied. :vartype target_resource_guid: str :param storage_id: ID of the storage account which is used to store the flow log. :type storage_id: str :param enabled: Flag to enable/disable flow logging. :type enabled: bool :param retention_policy: Parameters that define the retention policy for flow log. :type retention_policy: ~azure.mgmt.network.v2020_04_01.models.RetentionPolicyParameters :param format: Parameters that define the flow log format. :type format: ~azure.mgmt.network.v2020_04_01.models.FlowLogFormatParameters :param flow_analytics_configuration: Parameters that define the configuration of traffic analytics. :type flow_analytics_configuration: ~azure.mgmt.network.v2020_04_01.models.TrafficAnalyticsProperties :ivar provisioning_state: The provisioning state of the flow log. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'target_resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'target_resource_id': {'key': 'properties.targetResourceId', 'type': 'str'}, 'target_resource_guid': {'key': 'properties.targetResourceGuid', 'type': 'str'}, 'storage_id': {'key': 'properties.storageId', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'retention_policy': {'key': 'properties.retentionPolicy', 'type': 'RetentionPolicyParameters'}, 'format': {'key': 'properties.format', 'type': 'FlowLogFormatParameters'}, 'flow_analytics_configuration': {'key': 'properties.flowAnalyticsConfiguration', 'type': 'TrafficAnalyticsProperties'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(FlowLog, self).__init__(**kwargs) self.etag = None self.target_resource_id = kwargs.get('target_resource_id', None) self.target_resource_guid = None self.storage_id = kwargs.get('storage_id', None) self.enabled = kwargs.get('enabled', None) self.retention_policy = kwargs.get('retention_policy', None) self.format = kwargs.get('format', None) self.flow_analytics_configuration = kwargs.get('flow_analytics_configuration', None) self.provisioning_state = None class FlowLogFormatParameters(msrest.serialization.Model): """Parameters that define the flow log format. :param type: The file type of flow log. Possible values include: "JSON". :type type: str or ~azure.mgmt.network.v2020_04_01.models.FlowLogFormatType :param version: The version (revision) of the flow log. :type version: int """ _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'version': {'key': 'version', 'type': 'int'}, } def __init__( self, **kwargs ): super(FlowLogFormatParameters, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.version = kwargs.get('version', 0) class FlowLogInformation(msrest.serialization.Model): """Information on the configuration of flow log and traffic analytics (optional) . All required parameters must be populated in order to send to Azure. :param target_resource_id: Required. The ID of the resource to configure for flow log and traffic analytics (optional) . :type target_resource_id: str :param flow_analytics_configuration: Parameters that define the configuration of traffic analytics. :type flow_analytics_configuration: ~azure.mgmt.network.v2020_04_01.models.TrafficAnalyticsProperties :param storage_id: Required. ID of the storage account which is used to store the flow log. :type storage_id: str :param enabled: Required. Flag to enable/disable flow logging. :type enabled: bool :param retention_policy: Parameters that define the retention policy for flow log. :type retention_policy: ~azure.mgmt.network.v2020_04_01.models.RetentionPolicyParameters :param format: Parameters that define the flow log format. :type format: ~azure.mgmt.network.v2020_04_01.models.FlowLogFormatParameters """ _validation = { 'target_resource_id': {'required': True}, 'storage_id': {'required': True}, 'enabled': {'required': True}, } _attribute_map = { 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, 'flow_analytics_configuration': {'key': 'flowAnalyticsConfiguration', 'type': 'TrafficAnalyticsProperties'}, 'storage_id': {'key': 'properties.storageId', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'retention_policy': {'key': 'properties.retentionPolicy', 'type': 'RetentionPolicyParameters'}, 'format': {'key': 'properties.format', 'type': 'FlowLogFormatParameters'}, } def __init__( self, **kwargs ): super(FlowLogInformation, self).__init__(**kwargs) self.target_resource_id = kwargs['target_resource_id'] self.flow_analytics_configuration = kwargs.get('flow_analytics_configuration', None) self.storage_id = kwargs['storage_id'] self.enabled = kwargs['enabled'] self.retention_policy = kwargs.get('retention_policy', None) self.format = kwargs.get('format', None) class FlowLogListResult(msrest.serialization.Model): """List of flow logs. Variables are only populated by the server, and will be ignored when sending a request. :param value: Information about flow log resource. :type value: list[~azure.mgmt.network.v2020_04_01.models.FlowLog] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[FlowLog]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(FlowLogListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class FlowLogStatusParameters(msrest.serialization.Model): """Parameters that define a resource to query flow log and traffic analytics (optional) status. All required parameters must be populated in order to send to Azure. :param target_resource_id: Required. The target resource where getting the flow log and traffic analytics (optional) status. :type target_resource_id: str """ _validation = { 'target_resource_id': {'required': True}, } _attribute_map = { 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, } def __init__( self, **kwargs ): super(FlowLogStatusParameters, self).__init__(**kwargs) self.target_resource_id = kwargs['target_resource_id'] class FrontendIPConfiguration(SubResource): """Frontend IP address of the load balancer. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within the set of frontend IP configurations used by the load balancer. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param zones: A list of availability zones denoting the IP allocated for the resource needs to come from. :type zones: list[str] :ivar inbound_nat_rules: An array of references to inbound rules that use this frontend IP. :vartype inbound_nat_rules: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar inbound_nat_pools: An array of references to inbound pools that use this frontend IP. :vartype inbound_nat_pools: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar outbound_rules: An array of references to outbound rules that use this frontend IP. :vartype outbound_rules: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar load_balancing_rules: An array of references to load balancing rules that use this frontend IP. :vartype load_balancing_rules: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :param private_ip_address: The private IP address of the IP configuration. :type private_ip_address: str :param private_ip_allocation_method: The Private IP allocation method. Possible values include: "Static", "Dynamic". :type private_ip_allocation_method: str or ~azure.mgmt.network.v2020_04_01.models.IPAllocationMethod :param private_ip_address_version: Whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values include: "IPv4", "IPv6". :type private_ip_address_version: str or ~azure.mgmt.network.v2020_04_01.models.IPVersion :param subnet: The reference to the subnet resource. :type subnet: ~azure.mgmt.network.v2020_04_01.models.Subnet :param public_ip_address: The reference to the Public IP resource. :type public_ip_address: ~azure.mgmt.network.v2020_04_01.models.PublicIPAddress :param public_ip_prefix: The reference to the Public IP Prefix resource. :type public_ip_prefix: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar provisioning_state: The provisioning state of the frontend IP configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'inbound_nat_rules': {'readonly': True}, 'inbound_nat_pools': {'readonly': True}, 'outbound_rules': {'readonly': True}, 'load_balancing_rules': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'zones': {'key': 'zones', 'type': '[str]'}, 'inbound_nat_rules': {'key': 'properties.inboundNatRules', 'type': '[SubResource]'}, 'inbound_nat_pools': {'key': 'properties.inboundNatPools', 'type': '[SubResource]'}, 'outbound_rules': {'key': 'properties.outboundRules', 'type': '[SubResource]'}, 'load_balancing_rules': {'key': 'properties.loadBalancingRules', 'type': '[SubResource]'}, 'private_ip_address': {'key': 'properties.privateIPAddress', 'type': 'str'}, 'private_ip_allocation_method': {'key': 'properties.privateIPAllocationMethod', 'type': 'str'}, 'private_ip_address_version': {'key': 'properties.privateIPAddressVersion', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'Subnet'}, 'public_ip_address': {'key': 'properties.publicIPAddress', 'type': 'PublicIPAddress'}, 'public_ip_prefix': {'key': 'properties.publicIPPrefix', 'type': 'SubResource'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(FrontendIPConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.zones = kwargs.get('zones', None) self.inbound_nat_rules = None self.inbound_nat_pools = None self.outbound_rules = None self.load_balancing_rules = None self.private_ip_address = kwargs.get('private_ip_address', None) self.private_ip_allocation_method = kwargs.get('private_ip_allocation_method', None) self.private_ip_address_version = kwargs.get('private_ip_address_version', None) self.subnet = kwargs.get('subnet', None) self.public_ip_address = kwargs.get('public_ip_address', None) self.public_ip_prefix = kwargs.get('public_ip_prefix', None) self.provisioning_state = None class GatewayRoute(msrest.serialization.Model): """Gateway routing details. Variables are only populated by the server, and will be ignored when sending a request. :ivar local_address: The gateway's local address. :vartype local_address: str :ivar network: The route's network prefix. :vartype network: str :ivar next_hop: The route's next hop. :vartype next_hop: str :ivar source_peer: The peer this route was learned from. :vartype source_peer: str :ivar origin: The source this route was learned from. :vartype origin: str :ivar as_path: The route's AS path sequence. :vartype as_path: str :ivar weight: The route's weight. :vartype weight: int """ _validation = { 'local_address': {'readonly': True}, 'network': {'readonly': True}, 'next_hop': {'readonly': True}, 'source_peer': {'readonly': True}, 'origin': {'readonly': True}, 'as_path': {'readonly': True}, 'weight': {'readonly': True}, } _attribute_map = { 'local_address': {'key': 'localAddress', 'type': 'str'}, 'network': {'key': 'network', 'type': 'str'}, 'next_hop': {'key': 'nextHop', 'type': 'str'}, 'source_peer': {'key': 'sourcePeer', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'as_path': {'key': 'asPath', 'type': 'str'}, 'weight': {'key': 'weight', 'type': 'int'}, } def __init__( self, **kwargs ): super(GatewayRoute, self).__init__(**kwargs) self.local_address = None self.network = None self.next_hop = None self.source_peer = None self.origin = None self.as_path = None self.weight = None class GatewayRouteListResult(msrest.serialization.Model): """List of virtual network gateway routes. :param value: List of gateway routes. :type value: list[~azure.mgmt.network.v2020_04_01.models.GatewayRoute] """ _attribute_map = { 'value': {'key': 'value', 'type': '[GatewayRoute]'}, } def __init__( self, **kwargs ): super(GatewayRouteListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) class GetVpnSitesConfigurationRequest(msrest.serialization.Model): """List of Vpn-Sites. All required parameters must be populated in order to send to Azure. :param vpn_sites: List of resource-ids of the vpn-sites for which config is to be downloaded. :type vpn_sites: list[str] :param output_blob_sas_url: Required. The sas-url to download the configurations for vpn-sites. :type output_blob_sas_url: str """ _validation = { 'output_blob_sas_url': {'required': True}, } _attribute_map = { 'vpn_sites': {'key': 'vpnSites', 'type': '[str]'}, 'output_blob_sas_url': {'key': 'outputBlobSasUrl', 'type': 'str'}, } def __init__( self, **kwargs ): super(GetVpnSitesConfigurationRequest, self).__init__(**kwargs) self.vpn_sites = kwargs.get('vpn_sites', None) self.output_blob_sas_url = kwargs['output_blob_sas_url'] class HTTPConfiguration(msrest.serialization.Model): """HTTP configuration of the connectivity check. :param method: HTTP method. Possible values include: "Get". :type method: str or ~azure.mgmt.network.v2020_04_01.models.HTTPMethod :param headers: List of HTTP headers. :type headers: list[~azure.mgmt.network.v2020_04_01.models.HTTPHeader] :param valid_status_codes: Valid status codes. :type valid_status_codes: list[int] """ _attribute_map = { 'method': {'key': 'method', 'type': 'str'}, 'headers': {'key': 'headers', 'type': '[HTTPHeader]'}, 'valid_status_codes': {'key': 'validStatusCodes', 'type': '[int]'}, } def __init__( self, **kwargs ): super(HTTPConfiguration, self).__init__(**kwargs) self.method = kwargs.get('method', None) self.headers = kwargs.get('headers', None) self.valid_status_codes = kwargs.get('valid_status_codes', None) class HTTPHeader(msrest.serialization.Model): """The HTTP header. :param name: The name in HTTP header. :type name: str :param value: The value in HTTP header. :type value: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'value': {'key': 'value', 'type': 'str'}, } def __init__( self, **kwargs ): super(HTTPHeader, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) class HubIPAddresses(msrest.serialization.Model): """IP addresses associated with azure firewall. :param public_ip_addresses: List of Public IP addresses associated with azure firewall. :type public_ip_addresses: list[~azure.mgmt.network.v2020_04_01.models.AzureFirewallPublicIPAddress] :param private_ip_address: Private IP Address associated with azure firewall. :type private_ip_address: str """ _attribute_map = { 'public_ip_addresses': {'key': 'publicIPAddresses', 'type': '[AzureFirewallPublicIPAddress]'}, 'private_ip_address': {'key': 'privateIPAddress', 'type': 'str'}, } def __init__( self, **kwargs ): super(HubIPAddresses, self).__init__(**kwargs) self.public_ip_addresses = kwargs.get('public_ip_addresses', None) self.private_ip_address = kwargs.get('private_ip_address', None) class HubRoute(msrest.serialization.Model): """RouteTable route. All required parameters must be populated in order to send to Azure. :param name: Required. The name of the Route that is unique within a RouteTable. This name can be used to access this route. :type name: str :param destination_type: Required. The type of destinations (eg: CIDR, ResourceId, Service). :type destination_type: str :param destinations: Required. List of all destinations. :type destinations: list[str] :param next_hop_type: Required. The type of next hop (eg: ResourceId). :type next_hop_type: str :param next_hop: Required. NextHop resource ID. :type next_hop: str """ _validation = { 'name': {'required': True}, 'destination_type': {'required': True}, 'destinations': {'required': True}, 'next_hop_type': {'required': True}, 'next_hop': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'destination_type': {'key': 'destinationType', 'type': 'str'}, 'destinations': {'key': 'destinations', 'type': '[str]'}, 'next_hop_type': {'key': 'nextHopType', 'type': 'str'}, 'next_hop': {'key': 'nextHop', 'type': 'str'}, } def __init__( self, **kwargs ): super(HubRoute, self).__init__(**kwargs) self.name = kwargs['name'] self.destination_type = kwargs['destination_type'] self.destinations = kwargs['destinations'] self.next_hop_type = kwargs['next_hop_type'] self.next_hop = kwargs['next_hop'] class HubRouteTable(SubResource): """RouteTable resource in a virtual hub. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Resource type. :vartype type: str :param routes: List of all routes. :type routes: list[~azure.mgmt.network.v2020_04_01.models.HubRoute] :param labels: List of labels associated with this route table. :type labels: list[str] :ivar associated_connections: List of all connections associated with this route table. :vartype associated_connections: list[str] :ivar propagating_connections: List of all connections that advertise to this route table. :vartype propagating_connections: list[str] :ivar provisioning_state: The provisioning state of the RouteTable resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'associated_connections': {'readonly': True}, 'propagating_connections': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'routes': {'key': 'properties.routes', 'type': '[HubRoute]'}, 'labels': {'key': 'properties.labels', 'type': '[str]'}, 'associated_connections': {'key': 'properties.associatedConnections', 'type': '[str]'}, 'propagating_connections': {'key': 'properties.propagatingConnections', 'type': '[str]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(HubRouteTable, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.routes = kwargs.get('routes', None) self.labels = kwargs.get('labels', None) self.associated_connections = None self.propagating_connections = None self.provisioning_state = None class HubVirtualNetworkConnection(SubResource): """HubVirtualNetworkConnection Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param remote_virtual_network: Reference to the remote virtual network. :type remote_virtual_network: ~azure.mgmt.network.v2020_04_01.models.SubResource :param allow_hub_to_remote_vnet_transit: VirtualHub to RemoteVnet transit to enabled or not. :type allow_hub_to_remote_vnet_transit: bool :param allow_remote_vnet_to_use_hub_vnet_gateways: Allow RemoteVnet to use Virtual Hub's gateways. :type allow_remote_vnet_to_use_hub_vnet_gateways: bool :param enable_internet_security: Enable internet security. :type enable_internet_security: bool :param routing_configuration: The Routing Configuration indicating the associated and propagated route tables on this connection. :type routing_configuration: ~azure.mgmt.network.v2020_04_01.models.RoutingConfiguration :ivar provisioning_state: The provisioning state of the hub virtual network connection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'remote_virtual_network': {'key': 'properties.remoteVirtualNetwork', 'type': 'SubResource'}, 'allow_hub_to_remote_vnet_transit': {'key': 'properties.allowHubToRemoteVnetTransit', 'type': 'bool'}, 'allow_remote_vnet_to_use_hub_vnet_gateways': {'key': 'properties.allowRemoteVnetToUseHubVnetGateways', 'type': 'bool'}, 'enable_internet_security': {'key': 'properties.enableInternetSecurity', 'type': 'bool'}, 'routing_configuration': {'key': 'properties.routingConfiguration', 'type': 'RoutingConfiguration'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(HubVirtualNetworkConnection, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.remote_virtual_network = kwargs.get('remote_virtual_network', None) self.allow_hub_to_remote_vnet_transit = kwargs.get('allow_hub_to_remote_vnet_transit', None) self.allow_remote_vnet_to_use_hub_vnet_gateways = kwargs.get('allow_remote_vnet_to_use_hub_vnet_gateways', None) self.enable_internet_security = kwargs.get('enable_internet_security', None) self.routing_configuration = kwargs.get('routing_configuration', None) self.provisioning_state = None class InboundNatPool(SubResource): """Inbound NAT pool of the load balancer. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within the set of inbound NAT pools used by the load balancer. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param frontend_ip_configuration: A reference to frontend IP addresses. :type frontend_ip_configuration: ~azure.mgmt.network.v2020_04_01.models.SubResource :param protocol: The reference to the transport protocol used by the inbound NAT pool. Possible values include: "Udp", "Tcp", "All". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.TransportProtocol :param frontend_port_range_start: The first port number in the range of external ports that will be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range between 1 and 65534. :type frontend_port_range_start: int :param frontend_port_range_end: The last port number in the range of external ports that will be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range between 1 and 65535. :type frontend_port_range_end: int :param backend_port: The port used for internal connections on the endpoint. Acceptable values are between 1 and 65535. :type backend_port: int :param idle_timeout_in_minutes: The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP. :type idle_timeout_in_minutes: int :param enable_floating_ip: Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint. :type enable_floating_ip: bool :param enable_tcp_reset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP. :type enable_tcp_reset: bool :ivar provisioning_state: The provisioning state of the inbound NAT pool resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'frontend_ip_configuration': {'key': 'properties.frontendIPConfiguration', 'type': 'SubResource'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, 'frontend_port_range_start': {'key': 'properties.frontendPortRangeStart', 'type': 'int'}, 'frontend_port_range_end': {'key': 'properties.frontendPortRangeEnd', 'type': 'int'}, 'backend_port': {'key': 'properties.backendPort', 'type': 'int'}, 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, 'enable_floating_ip': {'key': 'properties.enableFloatingIP', 'type': 'bool'}, 'enable_tcp_reset': {'key': 'properties.enableTcpReset', 'type': 'bool'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(InboundNatPool, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.frontend_ip_configuration = kwargs.get('frontend_ip_configuration', None) self.protocol = kwargs.get('protocol', None) self.frontend_port_range_start = kwargs.get('frontend_port_range_start', None) self.frontend_port_range_end = kwargs.get('frontend_port_range_end', None) self.backend_port = kwargs.get('backend_port', None) self.idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes', None) self.enable_floating_ip = kwargs.get('enable_floating_ip', None) self.enable_tcp_reset = kwargs.get('enable_tcp_reset', None) self.provisioning_state = None class InboundNatRule(SubResource): """Inbound NAT rule of the load balancer. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within the set of inbound NAT rules used by the load balancer. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param frontend_ip_configuration: A reference to frontend IP addresses. :type frontend_ip_configuration: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar backend_ip_configuration: A reference to a private IP address defined on a network interface of a VM. Traffic sent to the frontend port of each of the frontend IP configurations is forwarded to the backend IP. :vartype backend_ip_configuration: ~azure.mgmt.network.v2020_04_01.models.NetworkInterfaceIPConfiguration :param protocol: The reference to the transport protocol used by the load balancing rule. Possible values include: "Udp", "Tcp", "All". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.TransportProtocol :param frontend_port: The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer. Acceptable values range from 1 to 65534. :type frontend_port: int :param backend_port: The port used for the internal endpoint. Acceptable values range from 1 to 65535. :type backend_port: int :param idle_timeout_in_minutes: The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP. :type idle_timeout_in_minutes: int :param enable_floating_ip: Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint. :type enable_floating_ip: bool :param enable_tcp_reset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP. :type enable_tcp_reset: bool :ivar provisioning_state: The provisioning state of the inbound NAT rule resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'backend_ip_configuration': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'frontend_ip_configuration': {'key': 'properties.frontendIPConfiguration', 'type': 'SubResource'}, 'backend_ip_configuration': {'key': 'properties.backendIPConfiguration', 'type': 'NetworkInterfaceIPConfiguration'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, 'frontend_port': {'key': 'properties.frontendPort', 'type': 'int'}, 'backend_port': {'key': 'properties.backendPort', 'type': 'int'}, 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, 'enable_floating_ip': {'key': 'properties.enableFloatingIP', 'type': 'bool'}, 'enable_tcp_reset': {'key': 'properties.enableTcpReset', 'type': 'bool'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(InboundNatRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.frontend_ip_configuration = kwargs.get('frontend_ip_configuration', None) self.backend_ip_configuration = None self.protocol = kwargs.get('protocol', None) self.frontend_port = kwargs.get('frontend_port', None) self.backend_port = kwargs.get('backend_port', None) self.idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes', None) self.enable_floating_ip = kwargs.get('enable_floating_ip', None) self.enable_tcp_reset = kwargs.get('enable_tcp_reset', None) self.provisioning_state = None class InboundNatRuleListResult(msrest.serialization.Model): """Response for ListInboundNatRule API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of inbound nat rules in a load balancer. :type value: list[~azure.mgmt.network.v2020_04_01.models.InboundNatRule] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[InboundNatRule]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(InboundNatRuleListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class IPAddressAvailabilityResult(msrest.serialization.Model): """Response for CheckIPAddressAvailability API service call. :param available: Private IP address availability. :type available: bool :param available_ip_addresses: Contains other available private IP addresses if the asked for address is taken. :type available_ip_addresses: list[str] """ _attribute_map = { 'available': {'key': 'available', 'type': 'bool'}, 'available_ip_addresses': {'key': 'availableIPAddresses', 'type': '[str]'}, } def __init__( self, **kwargs ): super(IPAddressAvailabilityResult, self).__init__(**kwargs) self.available = kwargs.get('available', None) self.available_ip_addresses = kwargs.get('available_ip_addresses', None) class IpAllocation(Resource): """IpAllocation resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar subnet: The Subnet that using the prefix of this IpAllocation resource. :vartype subnet: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar virtual_network: The VirtualNetwork that using the prefix of this IpAllocation resource. :vartype virtual_network: ~azure.mgmt.network.v2020_04_01.models.SubResource :param type_properties_type: The type for the IpAllocation. Possible values include: "Undefined", "Hypernet". :type type_properties_type: str or ~azure.mgmt.network.v2020_04_01.models.IpAllocationType :param prefix: The address prefix for the IpAllocation. :type prefix: str :param prefix_length: The address prefix length for the IpAllocation. :type prefix_length: int :param prefix_type: The address prefix Type for the IpAllocation. Possible values include: "IPv4", "IPv6". :type prefix_type: str or ~azure.mgmt.network.v2020_04_01.models.IPVersion :param ipam_allocation_id: The IPAM allocation ID. :type ipam_allocation_id: str :param allocation_tags: IpAllocation tags. :type allocation_tags: dict[str, str] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'subnet': {'readonly': True}, 'virtual_network': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'SubResource'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'SubResource'}, 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, 'prefix': {'key': 'properties.prefix', 'type': 'str'}, 'prefix_length': {'key': 'properties.prefixLength', 'type': 'int'}, 'prefix_type': {'key': 'properties.prefixType', 'type': 'str'}, 'ipam_allocation_id': {'key': 'properties.ipamAllocationId', 'type': 'str'}, 'allocation_tags': {'key': 'properties.allocationTags', 'type': '{str}'}, } def __init__( self, **kwargs ): super(IpAllocation, self).__init__(**kwargs) self.etag = None self.subnet = None self.virtual_network = None self.type_properties_type = kwargs.get('type_properties_type', None) self.prefix = kwargs.get('prefix', None) self.prefix_length = kwargs.get('prefix_length', 0) self.prefix_type = kwargs.get('prefix_type', None) self.ipam_allocation_id = kwargs.get('ipam_allocation_id', None) self.allocation_tags = kwargs.get('allocation_tags', None) class IpAllocationListResult(msrest.serialization.Model): """Response for the ListIpAllocations API service call. :param value: A list of IpAllocation resources. :type value: list[~azure.mgmt.network.v2020_04_01.models.IpAllocation] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[IpAllocation]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(IpAllocationListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class IPConfiguration(SubResource): """IP configuration. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param private_ip_address: The private IP address of the IP configuration. :type private_ip_address: str :param private_ip_allocation_method: The private IP address allocation method. Possible values include: "Static", "Dynamic". :type private_ip_allocation_method: str or ~azure.mgmt.network.v2020_04_01.models.IPAllocationMethod :param subnet: The reference to the subnet resource. :type subnet: ~azure.mgmt.network.v2020_04_01.models.Subnet :param public_ip_address: The reference to the public IP resource. :type public_ip_address: ~azure.mgmt.network.v2020_04_01.models.PublicIPAddress :ivar provisioning_state: The provisioning state of the IP configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'private_ip_address': {'key': 'properties.privateIPAddress', 'type': 'str'}, 'private_ip_allocation_method': {'key': 'properties.privateIPAllocationMethod', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'Subnet'}, 'public_ip_address': {'key': 'properties.publicIPAddress', 'type': 'PublicIPAddress'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(IPConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.private_ip_address = kwargs.get('private_ip_address', None) self.private_ip_allocation_method = kwargs.get('private_ip_allocation_method', None) self.subnet = kwargs.get('subnet', None) self.public_ip_address = kwargs.get('public_ip_address', None) self.provisioning_state = None class IPConfigurationBgpPeeringAddress(msrest.serialization.Model): """Properties of IPConfigurationBgpPeeringAddress. Variables are only populated by the server, and will be ignored when sending a request. :param ipconfiguration_id: The ID of IP configuration which belongs to gateway. :type ipconfiguration_id: str :ivar default_bgp_ip_addresses: The list of default BGP peering addresses which belong to IP configuration. :vartype default_bgp_ip_addresses: list[str] :param custom_bgp_ip_addresses: The list of custom BGP peering addresses which belong to IP configuration. :type custom_bgp_ip_addresses: list[str] :ivar tunnel_ip_addresses: The list of tunnel public IP addresses which belong to IP configuration. :vartype tunnel_ip_addresses: list[str] """ _validation = { 'default_bgp_ip_addresses': {'readonly': True}, 'tunnel_ip_addresses': {'readonly': True}, } _attribute_map = { 'ipconfiguration_id': {'key': 'ipconfigurationId', 'type': 'str'}, 'default_bgp_ip_addresses': {'key': 'defaultBgpIpAddresses', 'type': '[str]'}, 'custom_bgp_ip_addresses': {'key': 'customBgpIpAddresses', 'type': '[str]'}, 'tunnel_ip_addresses': {'key': 'tunnelIpAddresses', 'type': '[str]'}, } def __init__( self, **kwargs ): super(IPConfigurationBgpPeeringAddress, self).__init__(**kwargs) self.ipconfiguration_id = kwargs.get('ipconfiguration_id', None) self.default_bgp_ip_addresses = None self.custom_bgp_ip_addresses = kwargs.get('custom_bgp_ip_addresses', None) self.tunnel_ip_addresses = None class IPConfigurationProfile(SubResource): """IP configuration profile child resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource. This name can be used to access the resource. :type name: str :ivar type: Sub Resource type. :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param subnet: The reference to the subnet resource to create a container network interface ip configuration. :type subnet: ~azure.mgmt.network.v2020_04_01.models.Subnet :ivar provisioning_state: The provisioning state of the IP configuration profile resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'Subnet'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(IPConfigurationProfile, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.type = None self.etag = None self.subnet = kwargs.get('subnet', None) self.provisioning_state = None class IpGroup(Resource): """The IpGroups resource information. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar provisioning_state: The provisioning state of the IpGroups resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param ip_addresses: IpAddresses/IpAddressPrefixes in the IpGroups resource. :type ip_addresses: list[str] :ivar firewalls: List of references to Azure resources that this IpGroups is associated with. :vartype firewalls: list[~azure.mgmt.network.v2020_04_01.models.SubResource] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'firewalls': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'ip_addresses': {'key': 'properties.ipAddresses', 'type': '[str]'}, 'firewalls': {'key': 'properties.firewalls', 'type': '[SubResource]'}, } def __init__( self, **kwargs ): super(IpGroup, self).__init__(**kwargs) self.etag = None self.provisioning_state = None self.ip_addresses = kwargs.get('ip_addresses', None) self.firewalls = None class IpGroupListResult(msrest.serialization.Model): """Response for the ListIpGroups API service call. :param value: The list of IpGroups information resources. :type value: list[~azure.mgmt.network.v2020_04_01.models.IpGroup] :param next_link: URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[IpGroup]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(IpGroupListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class IpsecPolicy(msrest.serialization.Model): """An IPSec Policy configuration for a virtual network gateway connection. All required parameters must be populated in order to send to Azure. :param sa_life_time_seconds: Required. The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for a site to site VPN tunnel. :type sa_life_time_seconds: int :param sa_data_size_kilobytes: Required. The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for a site to site VPN tunnel. :type sa_data_size_kilobytes: int :param ipsec_encryption: Required. The IPSec encryption algorithm (IKE phase 1). Possible values include: "None", "DES", "DES3", "AES128", "AES192", "AES256", "GCMAES128", "GCMAES192", "GCMAES256". :type ipsec_encryption: str or ~azure.mgmt.network.v2020_04_01.models.IpsecEncryption :param ipsec_integrity: Required. The IPSec integrity algorithm (IKE phase 1). Possible values include: "MD5", "SHA1", "SHA256", "GCMAES128", "GCMAES192", "GCMAES256". :type ipsec_integrity: str or ~azure.mgmt.network.v2020_04_01.models.IpsecIntegrity :param ike_encryption: Required. The IKE encryption algorithm (IKE phase 2). Possible values include: "DES", "DES3", "AES128", "AES192", "AES256", "GCMAES256", "GCMAES128". :type ike_encryption: str or ~azure.mgmt.network.v2020_04_01.models.IkeEncryption :param ike_integrity: Required. The IKE integrity algorithm (IKE phase 2). Possible values include: "MD5", "SHA1", "SHA256", "SHA384", "GCMAES256", "GCMAES128". :type ike_integrity: str or ~azure.mgmt.network.v2020_04_01.models.IkeIntegrity :param dh_group: Required. The DH Group used in IKE Phase 1 for initial SA. Possible values include: "None", "DHGroup1", "DHGroup2", "DHGroup14", "DHGroup2048", "ECP256", "ECP384", "DHGroup24". :type dh_group: str or ~azure.mgmt.network.v2020_04_01.models.DhGroup :param pfs_group: Required. The Pfs Group used in IKE Phase 2 for new child SA. Possible values include: "None", "PFS1", "PFS2", "PFS2048", "ECP256", "ECP384", "PFS24", "PFS14", "PFSMM". :type pfs_group: str or ~azure.mgmt.network.v2020_04_01.models.PfsGroup """ _validation = { 'sa_life_time_seconds': {'required': True}, 'sa_data_size_kilobytes': {'required': True}, 'ipsec_encryption': {'required': True}, 'ipsec_integrity': {'required': True}, 'ike_encryption': {'required': True}, 'ike_integrity': {'required': True}, 'dh_group': {'required': True}, 'pfs_group': {'required': True}, } _attribute_map = { 'sa_life_time_seconds': {'key': 'saLifeTimeSeconds', 'type': 'int'}, 'sa_data_size_kilobytes': {'key': 'saDataSizeKilobytes', 'type': 'int'}, 'ipsec_encryption': {'key': 'ipsecEncryption', 'type': 'str'}, 'ipsec_integrity': {'key': 'ipsecIntegrity', 'type': 'str'}, 'ike_encryption': {'key': 'ikeEncryption', 'type': 'str'}, 'ike_integrity': {'key': 'ikeIntegrity', 'type': 'str'}, 'dh_group': {'key': 'dhGroup', 'type': 'str'}, 'pfs_group': {'key': 'pfsGroup', 'type': 'str'}, } def __init__( self, **kwargs ): super(IpsecPolicy, self).__init__(**kwargs) self.sa_life_time_seconds = kwargs['sa_life_time_seconds'] self.sa_data_size_kilobytes = kwargs['sa_data_size_kilobytes'] self.ipsec_encryption = kwargs['ipsec_encryption'] self.ipsec_integrity = kwargs['ipsec_integrity'] self.ike_encryption = kwargs['ike_encryption'] self.ike_integrity = kwargs['ike_integrity'] self.dh_group = kwargs['dh_group'] self.pfs_group = kwargs['pfs_group'] class IpTag(msrest.serialization.Model): """Contains the IpTag associated with the object. :param ip_tag_type: The IP tag type. Example: FirstPartyUsage. :type ip_tag_type: str :param tag: The value of the IP tag associated with the public IP. Example: SQL. :type tag: str """ _attribute_map = { 'ip_tag_type': {'key': 'ipTagType', 'type': 'str'}, 'tag': {'key': 'tag', 'type': 'str'}, } def __init__( self, **kwargs ): super(IpTag, self).__init__(**kwargs) self.ip_tag_type = kwargs.get('ip_tag_type', None) self.tag = kwargs.get('tag', None) class Ipv6CircuitConnectionConfig(msrest.serialization.Model): """IPv6 Circuit Connection properties for global reach. Variables are only populated by the server, and will be ignored when sending a request. :param address_prefix: /125 IP address space to carve out customer addresses for global reach. :type address_prefix: str :ivar circuit_connection_status: Express Route Circuit connection state. Possible values include: "Connected", "Connecting", "Disconnected". :vartype circuit_connection_status: str or ~azure.mgmt.network.v2020_04_01.models.CircuitConnectionStatus """ _validation = { 'circuit_connection_status': {'readonly': True}, } _attribute_map = { 'address_prefix': {'key': 'addressPrefix', 'type': 'str'}, 'circuit_connection_status': {'key': 'circuitConnectionStatus', 'type': 'str'}, } def __init__( self, **kwargs ): super(Ipv6CircuitConnectionConfig, self).__init__(**kwargs) self.address_prefix = kwargs.get('address_prefix', None) self.circuit_connection_status = None class Ipv6ExpressRouteCircuitPeeringConfig(msrest.serialization.Model): """Contains IPv6 peering config. :param primary_peer_address_prefix: The primary address prefix. :type primary_peer_address_prefix: str :param secondary_peer_address_prefix: The secondary address prefix. :type secondary_peer_address_prefix: str :param microsoft_peering_config: The Microsoft peering configuration. :type microsoft_peering_config: ~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitPeeringConfig :param route_filter: The reference to the RouteFilter resource. :type route_filter: ~azure.mgmt.network.v2020_04_01.models.SubResource :param state: The state of peering. Possible values include: "Disabled", "Enabled". :type state: str or ~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitPeeringState """ _attribute_map = { 'primary_peer_address_prefix': {'key': 'primaryPeerAddressPrefix', 'type': 'str'}, 'secondary_peer_address_prefix': {'key': 'secondaryPeerAddressPrefix', 'type': 'str'}, 'microsoft_peering_config': {'key': 'microsoftPeeringConfig', 'type': 'ExpressRouteCircuitPeeringConfig'}, 'route_filter': {'key': 'routeFilter', 'type': 'SubResource'}, 'state': {'key': 'state', 'type': 'str'}, } def __init__( self, **kwargs ): super(Ipv6ExpressRouteCircuitPeeringConfig, self).__init__(**kwargs) self.primary_peer_address_prefix = kwargs.get('primary_peer_address_prefix', None) self.secondary_peer_address_prefix = kwargs.get('secondary_peer_address_prefix', None) self.microsoft_peering_config = kwargs.get('microsoft_peering_config', None) self.route_filter = kwargs.get('route_filter', None) self.state = kwargs.get('state', None) class ListHubRouteTablesResult(msrest.serialization.Model): """List of RouteTables and a URL nextLink to get the next set of results. :param value: List of RouteTables. :type value: list[~azure.mgmt.network.v2020_04_01.models.HubRouteTable] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[HubRouteTable]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ListHubRouteTablesResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ListHubVirtualNetworkConnectionsResult(msrest.serialization.Model): """List of HubVirtualNetworkConnections and a URL nextLink to get the next set of results. :param value: List of HubVirtualNetworkConnections. :type value: list[~azure.mgmt.network.v2020_04_01.models.HubVirtualNetworkConnection] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[HubVirtualNetworkConnection]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ListHubVirtualNetworkConnectionsResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ListP2SVpnGatewaysResult(msrest.serialization.Model): """Result of the request to list P2SVpnGateways. It contains a list of P2SVpnGateways and a URL nextLink to get the next set of results. :param value: List of P2SVpnGateways. :type value: list[~azure.mgmt.network.v2020_04_01.models.P2SVpnGateway] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[P2SVpnGateway]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ListP2SVpnGatewaysResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ListVirtualHubRouteTableV2SResult(msrest.serialization.Model): """List of VirtualHubRouteTableV2s and a URL nextLink to get the next set of results. :param value: List of VirtualHubRouteTableV2s. :type value: list[~azure.mgmt.network.v2020_04_01.models.VirtualHubRouteTableV2] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VirtualHubRouteTableV2]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ListVirtualHubRouteTableV2SResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ListVirtualHubsResult(msrest.serialization.Model): """Result of the request to list VirtualHubs. It contains a list of VirtualHubs and a URL nextLink to get the next set of results. :param value: List of VirtualHubs. :type value: list[~azure.mgmt.network.v2020_04_01.models.VirtualHub] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VirtualHub]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ListVirtualHubsResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ListVirtualWANsResult(msrest.serialization.Model): """Result of the request to list VirtualWANs. It contains a list of VirtualWANs and a URL nextLink to get the next set of results. :param value: List of VirtualWANs. :type value: list[~azure.mgmt.network.v2020_04_01.models.VirtualWAN] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VirtualWAN]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ListVirtualWANsResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ListVpnConnectionsResult(msrest.serialization.Model): """Result of the request to list all vpn connections to a virtual wan vpn gateway. It contains a list of Vpn Connections and a URL nextLink to get the next set of results. :param value: List of Vpn Connections. :type value: list[~azure.mgmt.network.v2020_04_01.models.VpnConnection] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VpnConnection]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ListVpnConnectionsResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ListVpnGatewaysResult(msrest.serialization.Model): """Result of the request to list VpnGateways. It contains a list of VpnGateways and a URL nextLink to get the next set of results. :param value: List of VpnGateways. :type value: list[~azure.mgmt.network.v2020_04_01.models.VpnGateway] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VpnGateway]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ListVpnGatewaysResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ListVpnServerConfigurationsResult(msrest.serialization.Model): """Result of the request to list all VpnServerConfigurations. It contains a list of VpnServerConfigurations and a URL nextLink to get the next set of results. :param value: List of VpnServerConfigurations. :type value: list[~azure.mgmt.network.v2020_04_01.models.VpnServerConfiguration] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VpnServerConfiguration]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ListVpnServerConfigurationsResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ListVpnSiteLinkConnectionsResult(msrest.serialization.Model): """Result of the request to list all vpn connections to a virtual wan vpn gateway. It contains a list of Vpn Connections and a URL nextLink to get the next set of results. :param value: List of VpnSiteLinkConnections. :type value: list[~azure.mgmt.network.v2020_04_01.models.VpnSiteLinkConnection] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VpnSiteLinkConnection]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ListVpnSiteLinkConnectionsResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ListVpnSiteLinksResult(msrest.serialization.Model): """Result of the request to list VpnSiteLinks. It contains a list of VpnSiteLinks and a URL nextLink to get the next set of results. :param value: List of VpnSitesLinks. :type value: list[~azure.mgmt.network.v2020_04_01.models.VpnSiteLink] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VpnSiteLink]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ListVpnSiteLinksResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ListVpnSitesResult(msrest.serialization.Model): """Result of the request to list VpnSites. It contains a list of VpnSites and a URL nextLink to get the next set of results. :param value: List of VpnSites. :type value: list[~azure.mgmt.network.v2020_04_01.models.VpnSite] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VpnSite]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ListVpnSitesResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class LoadBalancer(Resource): """LoadBalancer resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: The load balancer SKU. :type sku: ~azure.mgmt.network.v2020_04_01.models.LoadBalancerSku :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param frontend_ip_configurations: Object representing the frontend IPs to be used for the load balancer. :type frontend_ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.FrontendIPConfiguration] :param backend_address_pools: Collection of backend address pools used by a load balancer. :type backend_address_pools: list[~azure.mgmt.network.v2020_04_01.models.BackendAddressPool] :param load_balancing_rules: Object collection representing the load balancing rules Gets the provisioning. :type load_balancing_rules: list[~azure.mgmt.network.v2020_04_01.models.LoadBalancingRule] :param probes: Collection of probe objects used in the load balancer. :type probes: list[~azure.mgmt.network.v2020_04_01.models.Probe] :param inbound_nat_rules: Collection of inbound NAT Rules used by a load balancer. Defining inbound NAT rules on your load balancer is mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with individual virtual machines cannot reference an Inbound NAT pool. They have to reference individual inbound NAT rules. :type inbound_nat_rules: list[~azure.mgmt.network.v2020_04_01.models.InboundNatRule] :param inbound_nat_pools: Defines an external port range for inbound NAT to a single backend port on NICs associated with a load balancer. Inbound NAT rules are created automatically for each NIC associated with the Load Balancer using an external port from this range. Defining an Inbound NAT pool on your Load Balancer is mutually exclusive with defining inbound Nat rules. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with individual virtual machines cannot reference an inbound NAT pool. They have to reference individual inbound NAT rules. :type inbound_nat_pools: list[~azure.mgmt.network.v2020_04_01.models.InboundNatPool] :param outbound_rules: The outbound rules. :type outbound_rules: list[~azure.mgmt.network.v2020_04_01.models.OutboundRule] :ivar resource_guid: The resource GUID property of the load balancer resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the load balancer resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'LoadBalancerSku'}, 'etag': {'key': 'etag', 'type': 'str'}, 'frontend_ip_configurations': {'key': 'properties.frontendIPConfigurations', 'type': '[FrontendIPConfiguration]'}, 'backend_address_pools': {'key': 'properties.backendAddressPools', 'type': '[BackendAddressPool]'}, 'load_balancing_rules': {'key': 'properties.loadBalancingRules', 'type': '[LoadBalancingRule]'}, 'probes': {'key': 'properties.probes', 'type': '[Probe]'}, 'inbound_nat_rules': {'key': 'properties.inboundNatRules', 'type': '[InboundNatRule]'}, 'inbound_nat_pools': {'key': 'properties.inboundNatPools', 'type': '[InboundNatPool]'}, 'outbound_rules': {'key': 'properties.outboundRules', 'type': '[OutboundRule]'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(LoadBalancer, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.etag = None self.frontend_ip_configurations = kwargs.get('frontend_ip_configurations', None) self.backend_address_pools = kwargs.get('backend_address_pools', None) self.load_balancing_rules = kwargs.get('load_balancing_rules', None) self.probes = kwargs.get('probes', None) self.inbound_nat_rules = kwargs.get('inbound_nat_rules', None) self.inbound_nat_pools = kwargs.get('inbound_nat_pools', None) self.outbound_rules = kwargs.get('outbound_rules', None) self.resource_guid = None self.provisioning_state = None class LoadBalancerBackendAddress(msrest.serialization.Model): """Load balancer backend addresses. Variables are only populated by the server, and will be ignored when sending a request. :param name: Name of the backend address. :type name: str :param virtual_network: Reference to an existing virtual network. :type virtual_network: ~azure.mgmt.network.v2020_04_01.models.SubResource :param ip_address: IP Address belonging to the referenced virtual network. :type ip_address: str :ivar network_interface_ip_configuration: Reference to IP address defined in network interfaces. :vartype network_interface_ip_configuration: ~azure.mgmt.network.v2020_04_01.models.SubResource """ _validation = { 'network_interface_ip_configuration': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'SubResource'}, 'ip_address': {'key': 'properties.ipAddress', 'type': 'str'}, 'network_interface_ip_configuration': {'key': 'properties.networkInterfaceIPConfiguration', 'type': 'SubResource'}, } def __init__( self, **kwargs ): super(LoadBalancerBackendAddress, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.virtual_network = kwargs.get('virtual_network', None) self.ip_address = kwargs.get('ip_address', None) self.network_interface_ip_configuration = None class LoadBalancerBackendAddressPoolListResult(msrest.serialization.Model): """Response for ListBackendAddressPool API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of backend address pools in a load balancer. :type value: list[~azure.mgmt.network.v2020_04_01.models.BackendAddressPool] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[BackendAddressPool]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(LoadBalancerBackendAddressPoolListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class LoadBalancerFrontendIPConfigurationListResult(msrest.serialization.Model): """Response for ListFrontendIPConfiguration API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of frontend IP configurations in a load balancer. :type value: list[~azure.mgmt.network.v2020_04_01.models.FrontendIPConfiguration] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[FrontendIPConfiguration]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(LoadBalancerFrontendIPConfigurationListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class LoadBalancerListResult(msrest.serialization.Model): """Response for ListLoadBalancers API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of load balancers in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.LoadBalancer] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[LoadBalancer]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(LoadBalancerListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class LoadBalancerLoadBalancingRuleListResult(msrest.serialization.Model): """Response for ListLoadBalancingRule API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of load balancing rules in a load balancer. :type value: list[~azure.mgmt.network.v2020_04_01.models.LoadBalancingRule] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[LoadBalancingRule]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(LoadBalancerLoadBalancingRuleListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class LoadBalancerOutboundRuleListResult(msrest.serialization.Model): """Response for ListOutboundRule API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of outbound rules in a load balancer. :type value: list[~azure.mgmt.network.v2020_04_01.models.OutboundRule] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[OutboundRule]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(LoadBalancerOutboundRuleListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class LoadBalancerProbeListResult(msrest.serialization.Model): """Response for ListProbe API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of probes in a load balancer. :type value: list[~azure.mgmt.network.v2020_04_01.models.Probe] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[Probe]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(LoadBalancerProbeListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class LoadBalancerSku(msrest.serialization.Model): """SKU of a load balancer. :param name: Name of a load balancer SKU. Possible values include: "Basic", "Standard". :type name: str or ~azure.mgmt.network.v2020_04_01.models.LoadBalancerSkuName """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, } def __init__( self, **kwargs ): super(LoadBalancerSku, self).__init__(**kwargs) self.name = kwargs.get('name', None) class LoadBalancingRule(SubResource): """A load balancing rule for a load balancer. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within the set of load balancing rules used by the load balancer. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param frontend_ip_configuration: A reference to frontend IP addresses. :type frontend_ip_configuration: ~azure.mgmt.network.v2020_04_01.models.SubResource :param backend_address_pool: A reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend IPs. :type backend_address_pool: ~azure.mgmt.network.v2020_04_01.models.SubResource :param probe: The reference to the load balancer probe used by the load balancing rule. :type probe: ~azure.mgmt.network.v2020_04_01.models.SubResource :param protocol: The reference to the transport protocol used by the load balancing rule. Possible values include: "Udp", "Tcp", "All". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.TransportProtocol :param load_distribution: The load distribution policy for this rule. Possible values include: "Default", "SourceIP", "SourceIPProtocol". :type load_distribution: str or ~azure.mgmt.network.v2020_04_01.models.LoadDistribution :param frontend_port: The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer. Acceptable values are between 0 and 65534. Note that value 0 enables "Any Port". :type frontend_port: int :param backend_port: The port used for internal connections on the endpoint. Acceptable values are between 0 and 65535. Note that value 0 enables "Any Port". :type backend_port: int :param idle_timeout_in_minutes: The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP. :type idle_timeout_in_minutes: int :param enable_floating_ip: Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint. :type enable_floating_ip: bool :param enable_tcp_reset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP. :type enable_tcp_reset: bool :param disable_outbound_snat: Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the frontend of the load balancing rule. :type disable_outbound_snat: bool :ivar provisioning_state: The provisioning state of the load balancing rule resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'frontend_ip_configuration': {'key': 'properties.frontendIPConfiguration', 'type': 'SubResource'}, 'backend_address_pool': {'key': 'properties.backendAddressPool', 'type': 'SubResource'}, 'probe': {'key': 'properties.probe', 'type': 'SubResource'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, 'load_distribution': {'key': 'properties.loadDistribution', 'type': 'str'}, 'frontend_port': {'key': 'properties.frontendPort', 'type': 'int'}, 'backend_port': {'key': 'properties.backendPort', 'type': 'int'}, 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, 'enable_floating_ip': {'key': 'properties.enableFloatingIP', 'type': 'bool'}, 'enable_tcp_reset': {'key': 'properties.enableTcpReset', 'type': 'bool'}, 'disable_outbound_snat': {'key': 'properties.disableOutboundSnat', 'type': 'bool'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(LoadBalancingRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.frontend_ip_configuration = kwargs.get('frontend_ip_configuration', None) self.backend_address_pool = kwargs.get('backend_address_pool', None) self.probe = kwargs.get('probe', None) self.protocol = kwargs.get('protocol', None) self.load_distribution = kwargs.get('load_distribution', None) self.frontend_port = kwargs.get('frontend_port', None) self.backend_port = kwargs.get('backend_port', None) self.idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes', None) self.enable_floating_ip = kwargs.get('enable_floating_ip', None) self.enable_tcp_reset = kwargs.get('enable_tcp_reset', None) self.disable_outbound_snat = kwargs.get('disable_outbound_snat', None) self.provisioning_state = None class LocalNetworkGateway(Resource): """A common class for general resource information. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param local_network_address_space: Local network site address space. :type local_network_address_space: ~azure.mgmt.network.v2020_04_01.models.AddressSpace :param gateway_ip_address: IP address of local network gateway. :type gateway_ip_address: str :param fqdn: FQDN of local network gateway. :type fqdn: str :param bgp_settings: Local network gateway's BGP speaker settings. :type bgp_settings: ~azure.mgmt.network.v2020_04_01.models.BgpSettings :ivar resource_guid: The resource GUID property of the local network gateway resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the local network gateway resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'local_network_address_space': {'key': 'properties.localNetworkAddressSpace', 'type': 'AddressSpace'}, 'gateway_ip_address': {'key': 'properties.gatewayIpAddress', 'type': 'str'}, 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, 'bgp_settings': {'key': 'properties.bgpSettings', 'type': 'BgpSettings'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(LocalNetworkGateway, self).__init__(**kwargs) self.etag = None self.local_network_address_space = kwargs.get('local_network_address_space', None) self.gateway_ip_address = kwargs.get('gateway_ip_address', None) self.fqdn = kwargs.get('fqdn', None) self.bgp_settings = kwargs.get('bgp_settings', None) self.resource_guid = None self.provisioning_state = None class LocalNetworkGatewayListResult(msrest.serialization.Model): """Response for ListLocalNetworkGateways API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of local network gateways that exists in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.LocalNetworkGateway] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[LocalNetworkGateway]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(LocalNetworkGatewayListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class LogSpecification(msrest.serialization.Model): """Description of logging specification. :param name: The name of the specification. :type name: str :param display_name: The display name of the specification. :type display_name: str :param blob_duration: Duration of the blob. :type blob_duration: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } def __init__( self, **kwargs ): super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) self.blob_duration = kwargs.get('blob_duration', None) class ManagedRuleGroupOverride(msrest.serialization.Model): """Defines a managed rule group override setting. All required parameters must be populated in order to send to Azure. :param rule_group_name: Required. The managed rule group to override. :type rule_group_name: str :param rules: List of rules that will be disabled. If none specified, all rules in the group will be disabled. :type rules: list[~azure.mgmt.network.v2020_04_01.models.ManagedRuleOverride] """ _validation = { 'rule_group_name': {'required': True}, } _attribute_map = { 'rule_group_name': {'key': 'ruleGroupName', 'type': 'str'}, 'rules': {'key': 'rules', 'type': '[ManagedRuleOverride]'}, } def __init__( self, **kwargs ): super(ManagedRuleGroupOverride, self).__init__(**kwargs) self.rule_group_name = kwargs['rule_group_name'] self.rules = kwargs.get('rules', None) class ManagedRuleOverride(msrest.serialization.Model): """Defines a managed rule group override setting. All required parameters must be populated in order to send to Azure. :param rule_id: Required. Identifier for the managed rule. :type rule_id: str :param state: The state of the managed rule. Defaults to Disabled if not specified. Possible values include: "Disabled". :type state: str or ~azure.mgmt.network.v2020_04_01.models.ManagedRuleEnabledState """ _validation = { 'rule_id': {'required': True}, } _attribute_map = { 'rule_id': {'key': 'ruleId', 'type': 'str'}, 'state': {'key': 'state', 'type': 'str'}, } def __init__( self, **kwargs ): super(ManagedRuleOverride, self).__init__(**kwargs) self.rule_id = kwargs['rule_id'] self.state = kwargs.get('state', None) class ManagedRulesDefinition(msrest.serialization.Model): """Allow to exclude some variable satisfy the condition for the WAF check. All required parameters must be populated in order to send to Azure. :param exclusions: The Exclusions that are applied on the policy. :type exclusions: list[~azure.mgmt.network.v2020_04_01.models.OwaspCrsExclusionEntry] :param managed_rule_sets: Required. The managed rule sets that are associated with the policy. :type managed_rule_sets: list[~azure.mgmt.network.v2020_04_01.models.ManagedRuleSet] """ _validation = { 'managed_rule_sets': {'required': True}, } _attribute_map = { 'exclusions': {'key': 'exclusions', 'type': '[OwaspCrsExclusionEntry]'}, 'managed_rule_sets': {'key': 'managedRuleSets', 'type': '[ManagedRuleSet]'}, } def __init__( self, **kwargs ): super(ManagedRulesDefinition, self).__init__(**kwargs) self.exclusions = kwargs.get('exclusions', None) self.managed_rule_sets = kwargs['managed_rule_sets'] class ManagedRuleSet(msrest.serialization.Model): """Defines a managed rule set. All required parameters must be populated in order to send to Azure. :param rule_set_type: Required. Defines the rule set type to use. :type rule_set_type: str :param rule_set_version: Required. Defines the version of the rule set to use. :type rule_set_version: str :param rule_group_overrides: Defines the rule group overrides to apply to the rule set. :type rule_group_overrides: list[~azure.mgmt.network.v2020_04_01.models.ManagedRuleGroupOverride] """ _validation = { 'rule_set_type': {'required': True}, 'rule_set_version': {'required': True}, } _attribute_map = { 'rule_set_type': {'key': 'ruleSetType', 'type': 'str'}, 'rule_set_version': {'key': 'ruleSetVersion', 'type': 'str'}, 'rule_group_overrides': {'key': 'ruleGroupOverrides', 'type': '[ManagedRuleGroupOverride]'}, } def __init__( self, **kwargs ): super(ManagedRuleSet, self).__init__(**kwargs) self.rule_set_type = kwargs['rule_set_type'] self.rule_set_version = kwargs['rule_set_version'] self.rule_group_overrides = kwargs.get('rule_group_overrides', None) class ManagedServiceIdentity(msrest.serialization.Model): """Identity for the resource. Variables are only populated by the server, and will be ignored when sending a request. :ivar principal_id: The principal id of the system assigned identity. This property will only be provided for a system assigned identity. :vartype principal_id: str :ivar tenant_id: The tenant id of the system assigned identity. This property will only be provided for a system assigned identity. :vartype tenant_id: str :param type: The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". :type type: str or ~azure.mgmt.network.v2020_04_01.models.ResourceIdentityType :param user_assigned_identities: The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :type user_assigned_identities: dict[str, ~azure.mgmt.network.v2020_04_01.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] """ _validation = { 'principal_id': {'readonly': True}, 'tenant_id': {'readonly': True}, } _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, } def __init__( self, **kwargs ): super(ManagedServiceIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = kwargs.get('type', None) self.user_assigned_identities = kwargs.get('user_assigned_identities', None) class MatchCondition(msrest.serialization.Model): """Define match conditions. All required parameters must be populated in order to send to Azure. :param match_variables: Required. List of match variables. :type match_variables: list[~azure.mgmt.network.v2020_04_01.models.MatchVariable] :param operator: Required. The operator to be matched. Possible values include: "IPMatch", "Equal", "Contains", "LessThan", "GreaterThan", "LessThanOrEqual", "GreaterThanOrEqual", "BeginsWith", "EndsWith", "Regex", "GeoMatch". :type operator: str or ~azure.mgmt.network.v2020_04_01.models.WebApplicationFirewallOperator :param negation_conditon: Whether this is negate condition or not. :type negation_conditon: bool :param match_values: Required. Match value. :type match_values: list[str] :param transforms: List of transforms. :type transforms: list[str or ~azure.mgmt.network.v2020_04_01.models.WebApplicationFirewallTransform] """ _validation = { 'match_variables': {'required': True}, 'operator': {'required': True}, 'match_values': {'required': True}, } _attribute_map = { 'match_variables': {'key': 'matchVariables', 'type': '[MatchVariable]'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negation_conditon': {'key': 'negationConditon', 'type': 'bool'}, 'match_values': {'key': 'matchValues', 'type': '[str]'}, 'transforms': {'key': 'transforms', 'type': '[str]'}, } def __init__( self, **kwargs ): super(MatchCondition, self).__init__(**kwargs) self.match_variables = kwargs['match_variables'] self.operator = kwargs['operator'] self.negation_conditon = kwargs.get('negation_conditon', None) self.match_values = kwargs['match_values'] self.transforms = kwargs.get('transforms', None) class MatchedRule(msrest.serialization.Model): """Matched rule. :param rule_name: Name of the matched network security rule. :type rule_name: str :param action: The network traffic is allowed or denied. Possible values are 'Allow' and 'Deny'. :type action: str """ _attribute_map = { 'rule_name': {'key': 'ruleName', 'type': 'str'}, 'action': {'key': 'action', 'type': 'str'}, } def __init__( self, **kwargs ): super(MatchedRule, self).__init__(**kwargs) self.rule_name = kwargs.get('rule_name', None) self.action = kwargs.get('action', None) class MatchVariable(msrest.serialization.Model): """Define match variables. All required parameters must be populated in order to send to Azure. :param variable_name: Required. Match Variable. Possible values include: "RemoteAddr", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeaders", "RequestBody", "RequestCookies". :type variable_name: str or ~azure.mgmt.network.v2020_04_01.models.WebApplicationFirewallMatchVariable :param selector: The selector of match variable. :type selector: str """ _validation = { 'variable_name': {'required': True}, } _attribute_map = { 'variable_name': {'key': 'variableName', 'type': 'str'}, 'selector': {'key': 'selector', 'type': 'str'}, } def __init__( self, **kwargs ): super(MatchVariable, self).__init__(**kwargs) self.variable_name = kwargs['variable_name'] self.selector = kwargs.get('selector', None) class MetricSpecification(msrest.serialization.Model): """Description of metrics specification. :param name: The name of the metric. :type name: str :param display_name: The display name of the metric. :type display_name: str :param display_description: The description of the metric. :type display_description: str :param unit: Units the metric to be displayed in. :type unit: str :param aggregation_type: The aggregation type. :type aggregation_type: str :param availabilities: List of availability. :type availabilities: list[~azure.mgmt.network.v2020_04_01.models.Availability] :param enable_regional_mdm_account: Whether regional MDM account enabled. :type enable_regional_mdm_account: bool :param fill_gap_with_zero: Whether gaps would be filled with zeros. :type fill_gap_with_zero: bool :param metric_filter_pattern: Pattern for the filter of the metric. :type metric_filter_pattern: str :param dimensions: List of dimensions. :type dimensions: list[~azure.mgmt.network.v2020_04_01.models.Dimension] :param is_internal: Whether the metric is internal. :type is_internal: bool :param source_mdm_account: The source MDM account. :type source_mdm_account: str :param source_mdm_namespace: The source MDM namespace. :type source_mdm_namespace: str :param resource_id_dimension_name_override: The resource Id dimension name override. :type resource_id_dimension_name_override: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'display_description': {'key': 'displayDescription', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, 'availabilities': {'key': 'availabilities', 'type': '[Availability]'}, 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'bool'}, 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, 'metric_filter_pattern': {'key': 'metricFilterPattern', 'type': 'str'}, 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, 'is_internal': {'key': 'isInternal', 'type': 'bool'}, 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, } def __init__( self, **kwargs ): super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) self.display_description = kwargs.get('display_description', None) self.unit = kwargs.get('unit', None) self.aggregation_type = kwargs.get('aggregation_type', None) self.availabilities = kwargs.get('availabilities', None) self.enable_regional_mdm_account = kwargs.get('enable_regional_mdm_account', None) self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) self.metric_filter_pattern = kwargs.get('metric_filter_pattern', None) self.dimensions = kwargs.get('dimensions', None) self.is_internal = kwargs.get('is_internal', None) self.source_mdm_account = kwargs.get('source_mdm_account', None) self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) class NatGateway(Resource): """Nat Gateway resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: The nat gateway SKU. :type sku: ~azure.mgmt.network.v2020_04_01.models.NatGatewaySku :param zones: A list of availability zones denoting the zone in which Nat Gateway should be deployed. :type zones: list[str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param idle_timeout_in_minutes: The idle timeout of the nat gateway. :type idle_timeout_in_minutes: int :param public_ip_addresses: An array of public ip addresses associated with the nat gateway resource. :type public_ip_addresses: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :param public_ip_prefixes: An array of public ip prefixes associated with the nat gateway resource. :type public_ip_prefixes: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar subnets: An array of references to the subnets using this nat gateway resource. :vartype subnets: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar resource_guid: The resource GUID property of the NAT gateway resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the NAT gateway resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'subnets': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'NatGatewaySku'}, 'zones': {'key': 'zones', 'type': '[str]'}, 'etag': {'key': 'etag', 'type': 'str'}, 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, 'public_ip_addresses': {'key': 'properties.publicIpAddresses', 'type': '[SubResource]'}, 'public_ip_prefixes': {'key': 'properties.publicIpPrefixes', 'type': '[SubResource]'}, 'subnets': {'key': 'properties.subnets', 'type': '[SubResource]'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(NatGateway, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.zones = kwargs.get('zones', None) self.etag = None self.idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes', None) self.public_ip_addresses = kwargs.get('public_ip_addresses', None) self.public_ip_prefixes = kwargs.get('public_ip_prefixes', None) self.subnets = None self.resource_guid = None self.provisioning_state = None class NatGatewayListResult(msrest.serialization.Model): """Response for ListNatGateways API service call. :param value: A list of Nat Gateways that exists in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.NatGateway] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[NatGateway]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(NatGatewayListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class NatGatewaySku(msrest.serialization.Model): """SKU of nat gateway. :param name: Name of Nat Gateway SKU. Possible values include: "Standard". :type name: str or ~azure.mgmt.network.v2020_04_01.models.NatGatewaySkuName """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, } def __init__( self, **kwargs ): super(NatGatewaySku, self).__init__(**kwargs) self.name = kwargs.get('name', None) class NatRuleCondition(FirewallPolicyRuleCondition): """Rule condition of type nat. All required parameters must be populated in order to send to Azure. :param name: Name of the rule condition. :type name: str :param description: Description of the rule condition. :type description: str :param rule_condition_type: Required. Rule Condition Type.Constant filled by server. Possible values include: "ApplicationRuleCondition", "NetworkRuleCondition", "NatRuleCondition". :type rule_condition_type: str or ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleConditionType :param ip_protocols: Array of FirewallPolicyRuleConditionNetworkProtocols. :type ip_protocols: list[str or ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleConditionNetworkProtocol] :param source_addresses: List of source IP addresses for this rule. :type source_addresses: list[str] :param destination_addresses: List of destination IP addresses or Service Tags. :type destination_addresses: list[str] :param destination_ports: List of destination ports. :type destination_ports: list[str] :param source_ip_groups: List of source IpGroups for this rule. :type source_ip_groups: list[str] """ _validation = { 'rule_condition_type': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'rule_condition_type': {'key': 'ruleConditionType', 'type': 'str'}, 'ip_protocols': {'key': 'ipProtocols', 'type': '[str]'}, 'source_addresses': {'key': 'sourceAddresses', 'type': '[str]'}, 'destination_addresses': {'key': 'destinationAddresses', 'type': '[str]'}, 'destination_ports': {'key': 'destinationPorts', 'type': '[str]'}, 'source_ip_groups': {'key': 'sourceIpGroups', 'type': '[str]'}, } def __init__( self, **kwargs ): super(NatRuleCondition, self).__init__(**kwargs) self.rule_condition_type = 'NatRuleCondition' # type: str self.ip_protocols = kwargs.get('ip_protocols', None) self.source_addresses = kwargs.get('source_addresses', None) self.destination_addresses = kwargs.get('destination_addresses', None) self.destination_ports = kwargs.get('destination_ports', None) self.source_ip_groups = kwargs.get('source_ip_groups', None) class NetworkConfigurationDiagnosticParameters(msrest.serialization.Model): """Parameters to get network configuration diagnostic. All required parameters must be populated in order to send to Azure. :param target_resource_id: Required. The ID of the target resource to perform network configuration diagnostic. Valid options are VM, NetworkInterface, VMSS/NetworkInterface and Application Gateway. :type target_resource_id: str :param verbosity_level: Verbosity level. Possible values include: "Normal", "Minimum", "Full". :type verbosity_level: str or ~azure.mgmt.network.v2020_04_01.models.VerbosityLevel :param profiles: Required. List of network configuration diagnostic profiles. :type profiles: list[~azure.mgmt.network.v2020_04_01.models.NetworkConfigurationDiagnosticProfile] """ _validation = { 'target_resource_id': {'required': True}, 'profiles': {'required': True}, } _attribute_map = { 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, 'verbosity_level': {'key': 'verbosityLevel', 'type': 'str'}, 'profiles': {'key': 'profiles', 'type': '[NetworkConfigurationDiagnosticProfile]'}, } def __init__( self, **kwargs ): super(NetworkConfigurationDiagnosticParameters, self).__init__(**kwargs) self.target_resource_id = kwargs['target_resource_id'] self.verbosity_level = kwargs.get('verbosity_level', None) self.profiles = kwargs['profiles'] class NetworkConfigurationDiagnosticProfile(msrest.serialization.Model): """Parameters to compare with network configuration. All required parameters must be populated in order to send to Azure. :param direction: Required. The direction of the traffic. Possible values include: "Inbound", "Outbound". :type direction: str or ~azure.mgmt.network.v2020_04_01.models.Direction :param protocol: Required. Protocol to be verified on. Accepted values are '*', TCP, UDP. :type protocol: str :param source: Required. Traffic source. Accepted values are '*', IP Address/CIDR, Service Tag. :type source: str :param destination: Required. Traffic destination. Accepted values are: '*', IP Address/CIDR, Service Tag. :type destination: str :param destination_port: Required. Traffic destination port. Accepted values are '*' and a single port in the range (0 - 65535). :type destination_port: str """ _validation = { 'direction': {'required': True}, 'protocol': {'required': True}, 'source': {'required': True}, 'destination': {'required': True}, 'destination_port': {'required': True}, } _attribute_map = { 'direction': {'key': 'direction', 'type': 'str'}, 'protocol': {'key': 'protocol', 'type': 'str'}, 'source': {'key': 'source', 'type': 'str'}, 'destination': {'key': 'destination', 'type': 'str'}, 'destination_port': {'key': 'destinationPort', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkConfigurationDiagnosticProfile, self).__init__(**kwargs) self.direction = kwargs['direction'] self.protocol = kwargs['protocol'] self.source = kwargs['source'] self.destination = kwargs['destination'] self.destination_port = kwargs['destination_port'] class NetworkConfigurationDiagnosticResponse(msrest.serialization.Model): """Results of network configuration diagnostic on the target resource. Variables are only populated by the server, and will be ignored when sending a request. :ivar results: List of network configuration diagnostic results. :vartype results: list[~azure.mgmt.network.v2020_04_01.models.NetworkConfigurationDiagnosticResult] """ _validation = { 'results': {'readonly': True}, } _attribute_map = { 'results': {'key': 'results', 'type': '[NetworkConfigurationDiagnosticResult]'}, } def __init__( self, **kwargs ): super(NetworkConfigurationDiagnosticResponse, self).__init__(**kwargs) self.results = None class NetworkConfigurationDiagnosticResult(msrest.serialization.Model): """Network configuration diagnostic result corresponded to provided traffic query. :param profile: Network configuration diagnostic profile. :type profile: ~azure.mgmt.network.v2020_04_01.models.NetworkConfigurationDiagnosticProfile :param network_security_group_result: Network security group result. :type network_security_group_result: ~azure.mgmt.network.v2020_04_01.models.NetworkSecurityGroupResult """ _attribute_map = { 'profile': {'key': 'profile', 'type': 'NetworkConfigurationDiagnosticProfile'}, 'network_security_group_result': {'key': 'networkSecurityGroupResult', 'type': 'NetworkSecurityGroupResult'}, } def __init__( self, **kwargs ): super(NetworkConfigurationDiagnosticResult, self).__init__(**kwargs) self.profile = kwargs.get('profile', None) self.network_security_group_result = kwargs.get('network_security_group_result', None) class NetworkIntentPolicy(Resource): """Network Intent Policy resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkIntentPolicy, self).__init__(**kwargs) self.etag = None class NetworkIntentPolicyConfiguration(msrest.serialization.Model): """Details of NetworkIntentPolicyConfiguration for PrepareNetworkPoliciesRequest. :param network_intent_policy_name: The name of the Network Intent Policy for storing in target subscription. :type network_intent_policy_name: str :param source_network_intent_policy: Source network intent policy. :type source_network_intent_policy: ~azure.mgmt.network.v2020_04_01.models.NetworkIntentPolicy """ _attribute_map = { 'network_intent_policy_name': {'key': 'networkIntentPolicyName', 'type': 'str'}, 'source_network_intent_policy': {'key': 'sourceNetworkIntentPolicy', 'type': 'NetworkIntentPolicy'}, } def __init__( self, **kwargs ): super(NetworkIntentPolicyConfiguration, self).__init__(**kwargs) self.network_intent_policy_name = kwargs.get('network_intent_policy_name', None) self.source_network_intent_policy = kwargs.get('source_network_intent_policy', None) class NetworkInterface(Resource): """A network interface in a resource group. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar virtual_machine: The reference to a virtual machine. :vartype virtual_machine: ~azure.mgmt.network.v2020_04_01.models.SubResource :param network_security_group: The reference to the NetworkSecurityGroup resource. :type network_security_group: ~azure.mgmt.network.v2020_04_01.models.NetworkSecurityGroup :ivar private_endpoint: A reference to the private endpoint to which the network interface is linked. :vartype private_endpoint: ~azure.mgmt.network.v2020_04_01.models.PrivateEndpoint :param ip_configurations: A list of IPConfigurations of the network interface. :type ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.NetworkInterfaceIPConfiguration] :ivar tap_configurations: A list of TapConfigurations of the network interface. :vartype tap_configurations: list[~azure.mgmt.network.v2020_04_01.models.NetworkInterfaceTapConfiguration] :param dns_settings: The DNS settings in network interface. :type dns_settings: ~azure.mgmt.network.v2020_04_01.models.NetworkInterfaceDnsSettings :ivar mac_address: The MAC address of the network interface. :vartype mac_address: str :ivar primary: Whether this is a primary network interface on a virtual machine. :vartype primary: bool :param enable_accelerated_networking: If the network interface is accelerated networking enabled. :type enable_accelerated_networking: bool :param enable_ip_forwarding: Indicates whether IP forwarding is enabled on this network interface. :type enable_ip_forwarding: bool :ivar hosted_workloads: A list of references to linked BareMetal resources. :vartype hosted_workloads: list[str] :ivar resource_guid: The resource GUID property of the network interface resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the network interface resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'virtual_machine': {'readonly': True}, 'private_endpoint': {'readonly': True}, 'tap_configurations': {'readonly': True}, 'mac_address': {'readonly': True}, 'primary': {'readonly': True}, 'hosted_workloads': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'virtual_machine': {'key': 'properties.virtualMachine', 'type': 'SubResource'}, 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'NetworkSecurityGroup'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[NetworkInterfaceIPConfiguration]'}, 'tap_configurations': {'key': 'properties.tapConfigurations', 'type': '[NetworkInterfaceTapConfiguration]'}, 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'NetworkInterfaceDnsSettings'}, 'mac_address': {'key': 'properties.macAddress', 'type': 'str'}, 'primary': {'key': 'properties.primary', 'type': 'bool'}, 'enable_accelerated_networking': {'key': 'properties.enableAcceleratedNetworking', 'type': 'bool'}, 'enable_ip_forwarding': {'key': 'properties.enableIPForwarding', 'type': 'bool'}, 'hosted_workloads': {'key': 'properties.hostedWorkloads', 'type': '[str]'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkInterface, self).__init__(**kwargs) self.etag = None self.virtual_machine = None self.network_security_group = kwargs.get('network_security_group', None) self.private_endpoint = None self.ip_configurations = kwargs.get('ip_configurations', None) self.tap_configurations = None self.dns_settings = kwargs.get('dns_settings', None) self.mac_address = None self.primary = None self.enable_accelerated_networking = kwargs.get('enable_accelerated_networking', None) self.enable_ip_forwarding = kwargs.get('enable_ip_forwarding', None) self.hosted_workloads = None self.resource_guid = None self.provisioning_state = None class NetworkInterfaceAssociation(msrest.serialization.Model): """Network interface and its custom security rules. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Network interface ID. :vartype id: str :param security_rules: Collection of custom security rules. :type security_rules: list[~azure.mgmt.network.v2020_04_01.models.SecurityRule] """ _validation = { 'id': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'security_rules': {'key': 'securityRules', 'type': '[SecurityRule]'}, } def __init__( self, **kwargs ): super(NetworkInterfaceAssociation, self).__init__(**kwargs) self.id = None self.security_rules = kwargs.get('security_rules', None) class NetworkInterfaceDnsSettings(msrest.serialization.Model): """DNS settings of a network interface. Variables are only populated by the server, and will be ignored when sending a request. :param dns_servers: List of DNS servers IP addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it must be the only value in dnsServers collection. :type dns_servers: list[str] :ivar applied_dns_servers: If the VM that uses this NIC is part of an Availability Set, then this list will have the union of all DNS servers from all NICs that are part of the Availability Set. This property is what is configured on each of those VMs. :vartype applied_dns_servers: list[str] :param internal_dns_name_label: Relative DNS name for this NIC used for internal communications between VMs in the same virtual network. :type internal_dns_name_label: str :ivar internal_fqdn: Fully qualified DNS name supporting internal communications between VMs in the same virtual network. :vartype internal_fqdn: str :ivar internal_domain_name_suffix: Even if internalDnsNameLabel is not specified, a DNS entry is created for the primary NIC of the VM. This DNS name can be constructed by concatenating the VM name with the value of internalDomainNameSuffix. :vartype internal_domain_name_suffix: str """ _validation = { 'applied_dns_servers': {'readonly': True}, 'internal_fqdn': {'readonly': True}, 'internal_domain_name_suffix': {'readonly': True}, } _attribute_map = { 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, 'applied_dns_servers': {'key': 'appliedDnsServers', 'type': '[str]'}, 'internal_dns_name_label': {'key': 'internalDnsNameLabel', 'type': 'str'}, 'internal_fqdn': {'key': 'internalFqdn', 'type': 'str'}, 'internal_domain_name_suffix': {'key': 'internalDomainNameSuffix', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkInterfaceDnsSettings, self).__init__(**kwargs) self.dns_servers = kwargs.get('dns_servers', None) self.applied_dns_servers = None self.internal_dns_name_label = kwargs.get('internal_dns_name_label', None) self.internal_fqdn = None self.internal_domain_name_suffix = None class NetworkInterfaceIPConfiguration(SubResource): """IPConfiguration in a network interface. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param virtual_network_taps: The reference to Virtual Network Taps. :type virtual_network_taps: list[~azure.mgmt.network.v2020_04_01.models.VirtualNetworkTap] :param application_gateway_backend_address_pools: The reference to ApplicationGatewayBackendAddressPool resource. :type application_gateway_backend_address_pools: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGatewayBackendAddressPool] :param load_balancer_backend_address_pools: The reference to LoadBalancerBackendAddressPool resource. :type load_balancer_backend_address_pools: list[~azure.mgmt.network.v2020_04_01.models.BackendAddressPool] :param load_balancer_inbound_nat_rules: A list of references of LoadBalancerInboundNatRules. :type load_balancer_inbound_nat_rules: list[~azure.mgmt.network.v2020_04_01.models.InboundNatRule] :param private_ip_address: Private IP address of the IP configuration. :type private_ip_address: str :param private_ip_allocation_method: The private IP address allocation method. Possible values include: "Static", "Dynamic". :type private_ip_allocation_method: str or ~azure.mgmt.network.v2020_04_01.models.IPAllocationMethod :param private_ip_address_version: Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4. Possible values include: "IPv4", "IPv6". :type private_ip_address_version: str or ~azure.mgmt.network.v2020_04_01.models.IPVersion :param subnet: Subnet bound to the IP configuration. :type subnet: ~azure.mgmt.network.v2020_04_01.models.Subnet :param primary: Whether this is a primary customer address on the network interface. :type primary: bool :param public_ip_address: Public IP address bound to the IP configuration. :type public_ip_address: ~azure.mgmt.network.v2020_04_01.models.PublicIPAddress :param application_security_groups: Application security groups in which the IP configuration is included. :type application_security_groups: list[~azure.mgmt.network.v2020_04_01.models.ApplicationSecurityGroup] :ivar provisioning_state: The provisioning state of the network interface IP configuration. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :ivar private_link_connection_properties: PrivateLinkConnection properties for the network interface. :vartype private_link_connection_properties: ~azure.mgmt.network.v2020_04_01.models.NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties """ _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'private_link_connection_properties': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'virtual_network_taps': {'key': 'properties.virtualNetworkTaps', 'type': '[VirtualNetworkTap]'}, 'application_gateway_backend_address_pools': {'key': 'properties.applicationGatewayBackendAddressPools', 'type': '[ApplicationGatewayBackendAddressPool]'}, 'load_balancer_backend_address_pools': {'key': 'properties.loadBalancerBackendAddressPools', 'type': '[BackendAddressPool]'}, 'load_balancer_inbound_nat_rules': {'key': 'properties.loadBalancerInboundNatRules', 'type': '[InboundNatRule]'}, 'private_ip_address': {'key': 'properties.privateIPAddress', 'type': 'str'}, 'private_ip_allocation_method': {'key': 'properties.privateIPAllocationMethod', 'type': 'str'}, 'private_ip_address_version': {'key': 'properties.privateIPAddressVersion', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'Subnet'}, 'primary': {'key': 'properties.primary', 'type': 'bool'}, 'public_ip_address': {'key': 'properties.publicIPAddress', 'type': 'PublicIPAddress'}, 'application_security_groups': {'key': 'properties.applicationSecurityGroups', 'type': '[ApplicationSecurityGroup]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'private_link_connection_properties': {'key': 'properties.privateLinkConnectionProperties', 'type': 'NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties'}, } def __init__( self, **kwargs ): super(NetworkInterfaceIPConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.virtual_network_taps = kwargs.get('virtual_network_taps', None) self.application_gateway_backend_address_pools = kwargs.get('application_gateway_backend_address_pools', None) self.load_balancer_backend_address_pools = kwargs.get('load_balancer_backend_address_pools', None) self.load_balancer_inbound_nat_rules = kwargs.get('load_balancer_inbound_nat_rules', None) self.private_ip_address = kwargs.get('private_ip_address', None) self.private_ip_allocation_method = kwargs.get('private_ip_allocation_method', None) self.private_ip_address_version = kwargs.get('private_ip_address_version', None) self.subnet = kwargs.get('subnet', None) self.primary = kwargs.get('primary', None) self.public_ip_address = kwargs.get('public_ip_address', None) self.application_security_groups = kwargs.get('application_security_groups', None) self.provisioning_state = None self.private_link_connection_properties = None class NetworkInterfaceIPConfigurationListResult(msrest.serialization.Model): """Response for list ip configurations API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of ip configurations. :type value: list[~azure.mgmt.network.v2020_04_01.models.NetworkInterfaceIPConfiguration] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[NetworkInterfaceIPConfiguration]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkInterfaceIPConfigurationListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties(msrest.serialization.Model): """PrivateLinkConnection properties for the network interface. Variables are only populated by the server, and will be ignored when sending a request. :ivar group_id: The group ID for current private link connection. :vartype group_id: str :ivar required_member_name: The required member name for current private link connection. :vartype required_member_name: str :ivar fqdns: List of FQDNs for current private link connection. :vartype fqdns: list[str] """ _validation = { 'group_id': {'readonly': True}, 'required_member_name': {'readonly': True}, 'fqdns': {'readonly': True}, } _attribute_map = { 'group_id': {'key': 'groupId', 'type': 'str'}, 'required_member_name': {'key': 'requiredMemberName', 'type': 'str'}, 'fqdns': {'key': 'fqdns', 'type': '[str]'}, } def __init__( self, **kwargs ): super(NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties, self).__init__(**kwargs) self.group_id = None self.required_member_name = None self.fqdns = None class NetworkInterfaceListResult(msrest.serialization.Model): """Response for the ListNetworkInterface API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of network interfaces in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.NetworkInterface] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[NetworkInterface]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkInterfaceListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class NetworkInterfaceLoadBalancerListResult(msrest.serialization.Model): """Response for list ip configurations API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of load balancers. :type value: list[~azure.mgmt.network.v2020_04_01.models.LoadBalancer] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[LoadBalancer]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkInterfaceLoadBalancerListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class NetworkInterfaceTapConfiguration(SubResource): """Tap configuration in a Network Interface. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Sub Resource type. :vartype type: str :param virtual_network_tap: The reference to the Virtual Network Tap resource. :type virtual_network_tap: ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkTap :ivar provisioning_state: The provisioning state of the network interface tap configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'virtual_network_tap': {'key': 'properties.virtualNetworkTap', 'type': 'VirtualNetworkTap'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkInterfaceTapConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.virtual_network_tap = kwargs.get('virtual_network_tap', None) self.provisioning_state = None class NetworkInterfaceTapConfigurationListResult(msrest.serialization.Model): """Response for list tap configurations API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of tap configurations. :type value: list[~azure.mgmt.network.v2020_04_01.models.NetworkInterfaceTapConfiguration] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[NetworkInterfaceTapConfiguration]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkInterfaceTapConfigurationListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class NetworkProfile(Resource): """Network profile resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar container_network_interfaces: List of child container network interfaces. :vartype container_network_interfaces: list[~azure.mgmt.network.v2020_04_01.models.ContainerNetworkInterface] :param container_network_interface_configurations: List of chid container network interface configurations. :type container_network_interface_configurations: list[~azure.mgmt.network.v2020_04_01.models.ContainerNetworkInterfaceConfiguration] :ivar resource_guid: The resource GUID property of the network profile resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the network profile resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'container_network_interfaces': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'container_network_interfaces': {'key': 'properties.containerNetworkInterfaces', 'type': '[ContainerNetworkInterface]'}, 'container_network_interface_configurations': {'key': 'properties.containerNetworkInterfaceConfigurations', 'type': '[ContainerNetworkInterfaceConfiguration]'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkProfile, self).__init__(**kwargs) self.etag = None self.container_network_interfaces = None self.container_network_interface_configurations = kwargs.get('container_network_interface_configurations', None) self.resource_guid = None self.provisioning_state = None class NetworkProfileListResult(msrest.serialization.Model): """Response for ListNetworkProfiles API service call. :param value: A list of network profiles that exist in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.NetworkProfile] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[NetworkProfile]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkProfileListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class NetworkRuleCondition(FirewallPolicyRuleCondition): """Rule condition of type network. All required parameters must be populated in order to send to Azure. :param name: Name of the rule condition. :type name: str :param description: Description of the rule condition. :type description: str :param rule_condition_type: Required. Rule Condition Type.Constant filled by server. Possible values include: "ApplicationRuleCondition", "NetworkRuleCondition", "NatRuleCondition". :type rule_condition_type: str or ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleConditionType :param ip_protocols: Array of FirewallPolicyRuleConditionNetworkProtocols. :type ip_protocols: list[str or ~azure.mgmt.network.v2020_04_01.models.FirewallPolicyRuleConditionNetworkProtocol] :param source_addresses: List of source IP addresses for this rule. :type source_addresses: list[str] :param destination_addresses: List of destination IP addresses or Service Tags. :type destination_addresses: list[str] :param destination_ports: List of destination ports. :type destination_ports: list[str] :param source_ip_groups: List of source IpGroups for this rule. :type source_ip_groups: list[str] :param destination_ip_groups: List of destination IpGroups for this rule. :type destination_ip_groups: list[str] """ _validation = { 'rule_condition_type': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'rule_condition_type': {'key': 'ruleConditionType', 'type': 'str'}, 'ip_protocols': {'key': 'ipProtocols', 'type': '[str]'}, 'source_addresses': {'key': 'sourceAddresses', 'type': '[str]'}, 'destination_addresses': {'key': 'destinationAddresses', 'type': '[str]'}, 'destination_ports': {'key': 'destinationPorts', 'type': '[str]'}, 'source_ip_groups': {'key': 'sourceIpGroups', 'type': '[str]'}, 'destination_ip_groups': {'key': 'destinationIpGroups', 'type': '[str]'}, } def __init__( self, **kwargs ): super(NetworkRuleCondition, self).__init__(**kwargs) self.rule_condition_type = 'NetworkRuleCondition' # type: str self.ip_protocols = kwargs.get('ip_protocols', None) self.source_addresses = kwargs.get('source_addresses', None) self.destination_addresses = kwargs.get('destination_addresses', None) self.destination_ports = kwargs.get('destination_ports', None) self.source_ip_groups = kwargs.get('source_ip_groups', None) self.destination_ip_groups = kwargs.get('destination_ip_groups', None) class NetworkSecurityGroup(Resource): """NetworkSecurityGroup resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param security_rules: A collection of security rules of the network security group. :type security_rules: list[~azure.mgmt.network.v2020_04_01.models.SecurityRule] :ivar default_security_rules: The default security rules of network security group. :vartype default_security_rules: list[~azure.mgmt.network.v2020_04_01.models.SecurityRule] :ivar network_interfaces: A collection of references to network interfaces. :vartype network_interfaces: list[~azure.mgmt.network.v2020_04_01.models.NetworkInterface] :ivar subnets: A collection of references to subnets. :vartype subnets: list[~azure.mgmt.network.v2020_04_01.models.Subnet] :ivar flow_logs: A collection of references to flow log resources. :vartype flow_logs: list[~azure.mgmt.network.v2020_04_01.models.FlowLog] :ivar resource_guid: The resource GUID property of the network security group resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the network security group resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'default_security_rules': {'readonly': True}, 'network_interfaces': {'readonly': True}, 'subnets': {'readonly': True}, 'flow_logs': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'security_rules': {'key': 'properties.securityRules', 'type': '[SecurityRule]'}, 'default_security_rules': {'key': 'properties.defaultSecurityRules', 'type': '[SecurityRule]'}, 'network_interfaces': {'key': 'properties.networkInterfaces', 'type': '[NetworkInterface]'}, 'subnets': {'key': 'properties.subnets', 'type': '[Subnet]'}, 'flow_logs': {'key': 'properties.flowLogs', 'type': '[FlowLog]'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkSecurityGroup, self).__init__(**kwargs) self.etag = None self.security_rules = kwargs.get('security_rules', None) self.default_security_rules = None self.network_interfaces = None self.subnets = None self.flow_logs = None self.resource_guid = None self.provisioning_state = None class NetworkSecurityGroupListResult(msrest.serialization.Model): """Response for ListNetworkSecurityGroups API service call. :param value: A list of NetworkSecurityGroup resources. :type value: list[~azure.mgmt.network.v2020_04_01.models.NetworkSecurityGroup] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[NetworkSecurityGroup]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkSecurityGroupListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class NetworkSecurityGroupResult(msrest.serialization.Model): """Network configuration diagnostic result corresponded provided traffic query. Variables are only populated by the server, and will be ignored when sending a request. :param security_rule_access_result: The network traffic is allowed or denied. Possible values include: "Allow", "Deny". :type security_rule_access_result: str or ~azure.mgmt.network.v2020_04_01.models.SecurityRuleAccess :ivar evaluated_network_security_groups: List of results network security groups diagnostic. :vartype evaluated_network_security_groups: list[~azure.mgmt.network.v2020_04_01.models.EvaluatedNetworkSecurityGroup] """ _validation = { 'evaluated_network_security_groups': {'readonly': True}, } _attribute_map = { 'security_rule_access_result': {'key': 'securityRuleAccessResult', 'type': 'str'}, 'evaluated_network_security_groups': {'key': 'evaluatedNetworkSecurityGroups', 'type': '[EvaluatedNetworkSecurityGroup]'}, } def __init__( self, **kwargs ): super(NetworkSecurityGroupResult, self).__init__(**kwargs) self.security_rule_access_result = kwargs.get('security_rule_access_result', None) self.evaluated_network_security_groups = None class NetworkSecurityRulesEvaluationResult(msrest.serialization.Model): """Network security rules evaluation result. :param name: Name of the network security rule. :type name: str :param protocol_matched: Value indicating whether protocol is matched. :type protocol_matched: bool :param source_matched: Value indicating whether source is matched. :type source_matched: bool :param source_port_matched: Value indicating whether source port is matched. :type source_port_matched: bool :param destination_matched: Value indicating whether destination is matched. :type destination_matched: bool :param destination_port_matched: Value indicating whether destination port is matched. :type destination_port_matched: bool """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'protocol_matched': {'key': 'protocolMatched', 'type': 'bool'}, 'source_matched': {'key': 'sourceMatched', 'type': 'bool'}, 'source_port_matched': {'key': 'sourcePortMatched', 'type': 'bool'}, 'destination_matched': {'key': 'destinationMatched', 'type': 'bool'}, 'destination_port_matched': {'key': 'destinationPortMatched', 'type': 'bool'}, } def __init__( self, **kwargs ): super(NetworkSecurityRulesEvaluationResult, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.protocol_matched = kwargs.get('protocol_matched', None) self.source_matched = kwargs.get('source_matched', None) self.source_port_matched = kwargs.get('source_port_matched', None) self.destination_matched = kwargs.get('destination_matched', None) self.destination_port_matched = kwargs.get('destination_port_matched', None) class NetworkVirtualAppliance(Resource): """NetworkVirtualAppliance Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param identity: The service principal that has read access to cloud-init and config blob. :type identity: ~azure.mgmt.network.v2020_04_01.models.ManagedServiceIdentity :param sku: Network Virtual Appliance SKU. :type sku: ~azure.mgmt.network.v2020_04_01.models.VirtualApplianceSkuProperties :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param boot_strap_configuration_blob: BootStrapConfigurationBlob storage URLs. :type boot_strap_configuration_blob: list[str] :param virtual_hub: The Virtual Hub where Network Virtual Appliance is being deployed. :type virtual_hub: ~azure.mgmt.network.v2020_04_01.models.SubResource :param cloud_init_configuration_blob: CloudInitConfigurationBlob storage URLs. :type cloud_init_configuration_blob: list[str] :param virtual_appliance_asn: VirtualAppliance ASN. :type virtual_appliance_asn: long :ivar virtual_appliance_nics: List of Virtual Appliance Network Interfaces. :vartype virtual_appliance_nics: list[~azure.mgmt.network.v2020_04_01.models.VirtualApplianceNicProperties] :ivar provisioning_state: The provisioning state of the resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'virtual_appliance_asn': {'maximum': 4294967295, 'minimum': 0}, 'virtual_appliance_nics': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'sku': {'key': 'sku', 'type': 'VirtualApplianceSkuProperties'}, 'etag': {'key': 'etag', 'type': 'str'}, 'boot_strap_configuration_blob': {'key': 'properties.bootStrapConfigurationBlob', 'type': '[str]'}, 'virtual_hub': {'key': 'properties.virtualHub', 'type': 'SubResource'}, 'cloud_init_configuration_blob': {'key': 'properties.cloudInitConfigurationBlob', 'type': '[str]'}, 'virtual_appliance_asn': {'key': 'properties.virtualApplianceAsn', 'type': 'long'}, 'virtual_appliance_nics': {'key': 'properties.virtualApplianceNics', 'type': '[VirtualApplianceNicProperties]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkVirtualAppliance, self).__init__(**kwargs) self.identity = kwargs.get('identity', None) self.sku = kwargs.get('sku', None) self.etag = None self.boot_strap_configuration_blob = kwargs.get('boot_strap_configuration_blob', None) self.virtual_hub = kwargs.get('virtual_hub', None) self.cloud_init_configuration_blob = kwargs.get('cloud_init_configuration_blob', None) self.virtual_appliance_asn = kwargs.get('virtual_appliance_asn', None) self.virtual_appliance_nics = None self.provisioning_state = None class NetworkVirtualApplianceListResult(msrest.serialization.Model): """Response for ListNetworkVirtualAppliances API service call. :param value: List of Network Virtual Appliances. :type value: list[~azure.mgmt.network.v2020_04_01.models.NetworkVirtualAppliance] :param next_link: URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[NetworkVirtualAppliance]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkVirtualApplianceListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class NetworkWatcher(Resource): """Network watcher in a resource group. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar provisioning_state: The provisioning state of the network watcher resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(NetworkWatcher, self).__init__(**kwargs) self.etag = None self.provisioning_state = None class NetworkWatcherListResult(msrest.serialization.Model): """Response for ListNetworkWatchers API service call. :param value: List of network watcher resources. :type value: list[~azure.mgmt.network.v2020_04_01.models.NetworkWatcher] """ _attribute_map = { 'value': {'key': 'value', 'type': '[NetworkWatcher]'}, } def __init__( self, **kwargs ): super(NetworkWatcherListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) class NextHopParameters(msrest.serialization.Model): """Parameters that define the source and destination endpoint. All required parameters must be populated in order to send to Azure. :param target_resource_id: Required. The resource identifier of the target resource against which the action is to be performed. :type target_resource_id: str :param source_ip_address: Required. The source IP address. :type source_ip_address: str :param destination_ip_address: Required. The destination IP address. :type destination_ip_address: str :param target_nic_resource_id: The NIC ID. (If VM has multiple NICs and IP forwarding is enabled on any of the nics, then this parameter must be specified. Otherwise optional). :type target_nic_resource_id: str """ _validation = { 'target_resource_id': {'required': True}, 'source_ip_address': {'required': True}, 'destination_ip_address': {'required': True}, } _attribute_map = { 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, 'source_ip_address': {'key': 'sourceIPAddress', 'type': 'str'}, 'destination_ip_address': {'key': 'destinationIPAddress', 'type': 'str'}, 'target_nic_resource_id': {'key': 'targetNicResourceId', 'type': 'str'}, } def __init__( self, **kwargs ): super(NextHopParameters, self).__init__(**kwargs) self.target_resource_id = kwargs['target_resource_id'] self.source_ip_address = kwargs['source_ip_address'] self.destination_ip_address = kwargs['destination_ip_address'] self.target_nic_resource_id = kwargs.get('target_nic_resource_id', None) class NextHopResult(msrest.serialization.Model): """The information about next hop from the specified VM. :param next_hop_type: Next hop type. Possible values include: "Internet", "VirtualAppliance", "VirtualNetworkGateway", "VnetLocal", "HyperNetGateway", "None". :type next_hop_type: str or ~azure.mgmt.network.v2020_04_01.models.NextHopType :param next_hop_ip_address: Next hop IP Address. :type next_hop_ip_address: str :param route_table_id: The resource identifier for the route table associated with the route being returned. If the route being returned does not correspond to any user created routes then this field will be the string 'System Route'. :type route_table_id: str """ _attribute_map = { 'next_hop_type': {'key': 'nextHopType', 'type': 'str'}, 'next_hop_ip_address': {'key': 'nextHopIpAddress', 'type': 'str'}, 'route_table_id': {'key': 'routeTableId', 'type': 'str'}, } def __init__( self, **kwargs ): super(NextHopResult, self).__init__(**kwargs) self.next_hop_type = kwargs.get('next_hop_type', None) self.next_hop_ip_address = kwargs.get('next_hop_ip_address', None) self.route_table_id = kwargs.get('route_table_id', None) class Operation(msrest.serialization.Model): """Network REST API operation definition. :param name: Operation name: {provider}/{resource}/{operation}. :type name: str :param display: Display metadata associated with the operation. :type display: ~azure.mgmt.network.v2020_04_01.models.OperationDisplay :param origin: Origin of the operation. :type origin: str :param service_specification: Specification of the service. :type service_specification: ~azure.mgmt.network.v2020_04_01.models.OperationPropertiesFormatServiceSpecification """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationPropertiesFormatServiceSpecification'}, } def __init__( self, **kwargs ): super(Operation, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) self.origin = kwargs.get('origin', None) self.service_specification = kwargs.get('service_specification', None) class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. :param provider: Service provider: Microsoft Network. :type provider: str :param resource: Resource on which the operation is performed. :type resource: str :param operation: Type of the operation: get, read, delete, etc. :type operation: str :param description: Description of the operation. :type description: str """ _attribute_map = { 'provider': {'key': 'provider', 'type': 'str'}, 'resource': {'key': 'resource', 'type': 'str'}, 'operation': {'key': 'operation', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, } def __init__( self, **kwargs ): super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) self.operation = kwargs.get('operation', None) self.description = kwargs.get('description', None) class OperationListResult(msrest.serialization.Model): """Result of the request to list Network operations. It contains a list of operations and a URL link to get the next set of results. :param value: List of Network operations supported by the Network resource provider. :type value: list[~azure.mgmt.network.v2020_04_01.models.Operation] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[Operation]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(OperationListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class OperationPropertiesFormatServiceSpecification(msrest.serialization.Model): """Specification of the service. :param metric_specifications: Operation service specification. :type metric_specifications: list[~azure.mgmt.network.v2020_04_01.models.MetricSpecification] :param log_specifications: Operation log specification. :type log_specifications: list[~azure.mgmt.network.v2020_04_01.models.LogSpecification] """ _attribute_map = { 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, } def __init__( self, **kwargs ): super(OperationPropertiesFormatServiceSpecification, self).__init__(**kwargs) self.metric_specifications = kwargs.get('metric_specifications', None) self.log_specifications = kwargs.get('log_specifications', None) class OutboundRule(SubResource): """Outbound rule of the load balancer. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within the set of outbound rules used by the load balancer. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param allocated_outbound_ports: The number of outbound ports to be used for NAT. :type allocated_outbound_ports: int :param frontend_ip_configurations: The Frontend IP addresses of the load balancer. :type frontend_ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :param backend_address_pool: A reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend IPs. :type backend_address_pool: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar provisioning_state: The provisioning state of the outbound rule resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param protocol: The protocol for the outbound rule in load balancer. Possible values include: "Tcp", "Udp", "All". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.LoadBalancerOutboundRuleProtocol :param enable_tcp_reset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP. :type enable_tcp_reset: bool :param idle_timeout_in_minutes: The timeout for the TCP idle connection. :type idle_timeout_in_minutes: int """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'allocated_outbound_ports': {'key': 'properties.allocatedOutboundPorts', 'type': 'int'}, 'frontend_ip_configurations': {'key': 'properties.frontendIPConfigurations', 'type': '[SubResource]'}, 'backend_address_pool': {'key': 'properties.backendAddressPool', 'type': 'SubResource'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, 'enable_tcp_reset': {'key': 'properties.enableTcpReset', 'type': 'bool'}, 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, } def __init__( self, **kwargs ): super(OutboundRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.allocated_outbound_ports = kwargs.get('allocated_outbound_ports', None) self.frontend_ip_configurations = kwargs.get('frontend_ip_configurations', None) self.backend_address_pool = kwargs.get('backend_address_pool', None) self.provisioning_state = None self.protocol = kwargs.get('protocol', None) self.enable_tcp_reset = kwargs.get('enable_tcp_reset', None) self.idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes', None) class OwaspCrsExclusionEntry(msrest.serialization.Model): """Allow to exclude some variable satisfy the condition for the WAF check. All required parameters must be populated in order to send to Azure. :param match_variable: Required. The variable to be excluded. Possible values include: "RequestHeaderNames", "RequestCookieNames", "RequestArgNames". :type match_variable: str or ~azure.mgmt.network.v2020_04_01.models.OwaspCrsExclusionEntryMatchVariable :param selector_match_operator: Required. When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to. Possible values include: "Equals", "Contains", "StartsWith", "EndsWith", "EqualsAny". :type selector_match_operator: str or ~azure.mgmt.network.v2020_04_01.models.OwaspCrsExclusionEntrySelectorMatchOperator :param selector: Required. When matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to. :type selector: str """ _validation = { 'match_variable': {'required': True}, 'selector_match_operator': {'required': True}, 'selector': {'required': True}, } _attribute_map = { 'match_variable': {'key': 'matchVariable', 'type': 'str'}, 'selector_match_operator': {'key': 'selectorMatchOperator', 'type': 'str'}, 'selector': {'key': 'selector', 'type': 'str'}, } def __init__( self, **kwargs ): super(OwaspCrsExclusionEntry, self).__init__(**kwargs) self.match_variable = kwargs['match_variable'] self.selector_match_operator = kwargs['selector_match_operator'] self.selector = kwargs['selector'] class P2SConnectionConfiguration(SubResource): """P2SConnectionConfiguration Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param vpn_client_address_pool: The reference to the address space resource which represents Address space for P2S VpnClient. :type vpn_client_address_pool: ~azure.mgmt.network.v2020_04_01.models.AddressSpace :param routing_configuration: The Routing Configuration indicating the associated and propagated route tables on this connection. :type routing_configuration: ~azure.mgmt.network.v2020_04_01.models.RoutingConfiguration :ivar provisioning_state: The provisioning state of the P2SConnectionConfiguration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'vpn_client_address_pool': {'key': 'properties.vpnClientAddressPool', 'type': 'AddressSpace'}, 'routing_configuration': {'key': 'properties.routingConfiguration', 'type': 'RoutingConfiguration'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(P2SConnectionConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.vpn_client_address_pool = kwargs.get('vpn_client_address_pool', None) self.routing_configuration = kwargs.get('routing_configuration', None) self.provisioning_state = None class P2SVpnConnectionHealth(msrest.serialization.Model): """P2S Vpn connection detailed health written to sas url. :param sas_url: Returned sas url of the blob to which the p2s vpn connection detailed health will be written. :type sas_url: str """ _attribute_map = { 'sas_url': {'key': 'sasUrl', 'type': 'str'}, } def __init__( self, **kwargs ): super(P2SVpnConnectionHealth, self).__init__(**kwargs) self.sas_url = kwargs.get('sas_url', None) class P2SVpnConnectionHealthRequest(msrest.serialization.Model): """List of P2S Vpn connection health request. :param vpn_user_names_filter: The list of p2s vpn user names whose p2s vpn connection detailed health to retrieve for. :type vpn_user_names_filter: list[str] :param output_blob_sas_url: The sas-url to download the P2S Vpn connection health detail. :type output_blob_sas_url: str """ _attribute_map = { 'vpn_user_names_filter': {'key': 'vpnUserNamesFilter', 'type': '[str]'}, 'output_blob_sas_url': {'key': 'outputBlobSasUrl', 'type': 'str'}, } def __init__( self, **kwargs ): super(P2SVpnConnectionHealthRequest, self).__init__(**kwargs) self.vpn_user_names_filter = kwargs.get('vpn_user_names_filter', None) self.output_blob_sas_url = kwargs.get('output_blob_sas_url', None) class P2SVpnConnectionRequest(msrest.serialization.Model): """List of p2s vpn connections to be disconnected. :param vpn_connection_ids: List of p2s vpn connection Ids. :type vpn_connection_ids: list[str] """ _attribute_map = { 'vpn_connection_ids': {'key': 'vpnConnectionIds', 'type': '[str]'}, } def __init__( self, **kwargs ): super(P2SVpnConnectionRequest, self).__init__(**kwargs) self.vpn_connection_ids = kwargs.get('vpn_connection_ids', None) class P2SVpnGateway(Resource): """P2SVpnGateway Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param virtual_hub: The VirtualHub to which the gateway belongs. :type virtual_hub: ~azure.mgmt.network.v2020_04_01.models.SubResource :param p2_s_connection_configurations: List of all p2s connection configurations of the gateway. :type p2_s_connection_configurations: list[~azure.mgmt.network.v2020_04_01.models.P2SConnectionConfiguration] :ivar provisioning_state: The provisioning state of the P2S VPN gateway resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param vpn_gateway_scale_unit: The scale unit for this p2s vpn gateway. :type vpn_gateway_scale_unit: int :param vpn_server_configuration: The VpnServerConfiguration to which the p2sVpnGateway is attached to. :type vpn_server_configuration: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar vpn_client_connection_health: All P2S VPN clients' connection health status. :vartype vpn_client_connection_health: ~azure.mgmt.network.v2020_04_01.models.VpnClientConnectionHealth """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'vpn_client_connection_health': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'virtual_hub': {'key': 'properties.virtualHub', 'type': 'SubResource'}, 'p2_s_connection_configurations': {'key': 'properties.p2SConnectionConfigurations', 'type': '[P2SConnectionConfiguration]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'vpn_gateway_scale_unit': {'key': 'properties.vpnGatewayScaleUnit', 'type': 'int'}, 'vpn_server_configuration': {'key': 'properties.vpnServerConfiguration', 'type': 'SubResource'}, 'vpn_client_connection_health': {'key': 'properties.vpnClientConnectionHealth', 'type': 'VpnClientConnectionHealth'}, } def __init__( self, **kwargs ): super(P2SVpnGateway, self).__init__(**kwargs) self.etag = None self.virtual_hub = kwargs.get('virtual_hub', None) self.p2_s_connection_configurations = kwargs.get('p2_s_connection_configurations', None) self.provisioning_state = None self.vpn_gateway_scale_unit = kwargs.get('vpn_gateway_scale_unit', None) self.vpn_server_configuration = kwargs.get('vpn_server_configuration', None) self.vpn_client_connection_health = None class P2SVpnProfileParameters(msrest.serialization.Model): """Vpn Client Parameters for package generation. :param authentication_method: VPN client authentication method. Possible values include: "EAPTLS", "EAPMSCHAPv2". :type authentication_method: str or ~azure.mgmt.network.v2020_04_01.models.AuthenticationMethod """ _attribute_map = { 'authentication_method': {'key': 'authenticationMethod', 'type': 'str'}, } def __init__( self, **kwargs ): super(P2SVpnProfileParameters, self).__init__(**kwargs) self.authentication_method = kwargs.get('authentication_method', None) class PacketCapture(msrest.serialization.Model): """Parameters that define the create packet capture operation. All required parameters must be populated in order to send to Azure. :param target: Required. The ID of the targeted resource, only VM is currently supported. :type target: str :param bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes are truncated. :type bytes_to_capture_per_packet: int :param total_bytes_per_session: Maximum size of the capture output. :type total_bytes_per_session: int :param time_limit_in_seconds: Maximum duration of the capture session in seconds. :type time_limit_in_seconds: int :param storage_location: Required. The storage location for a packet capture session. :type storage_location: ~azure.mgmt.network.v2020_04_01.models.PacketCaptureStorageLocation :param filters: A list of packet capture filters. :type filters: list[~azure.mgmt.network.v2020_04_01.models.PacketCaptureFilter] """ _validation = { 'target': {'required': True}, 'storage_location': {'required': True}, } _attribute_map = { 'target': {'key': 'properties.target', 'type': 'str'}, 'bytes_to_capture_per_packet': {'key': 'properties.bytesToCapturePerPacket', 'type': 'int'}, 'total_bytes_per_session': {'key': 'properties.totalBytesPerSession', 'type': 'int'}, 'time_limit_in_seconds': {'key': 'properties.timeLimitInSeconds', 'type': 'int'}, 'storage_location': {'key': 'properties.storageLocation', 'type': 'PacketCaptureStorageLocation'}, 'filters': {'key': 'properties.filters', 'type': '[PacketCaptureFilter]'}, } def __init__( self, **kwargs ): super(PacketCapture, self).__init__(**kwargs) self.target = kwargs['target'] self.bytes_to_capture_per_packet = kwargs.get('bytes_to_capture_per_packet', 0) self.total_bytes_per_session = kwargs.get('total_bytes_per_session', 1073741824) self.time_limit_in_seconds = kwargs.get('time_limit_in_seconds', 18000) self.storage_location = kwargs['storage_location'] self.filters = kwargs.get('filters', None) class PacketCaptureFilter(msrest.serialization.Model): """Filter that is applied to packet capture request. Multiple filters can be applied. :param protocol: Protocol to be filtered on. Possible values include: "TCP", "UDP", "Any". Default value: "Any". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.PcProtocol :param local_ip_address: Local IP Address to be filtered on. Notation: "127.0.0.1" for single address entry. "127.0.0.1-127.0.0.255" for range. "127.0.0.1;127.0.0.5"? for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null. :type local_ip_address: str :param remote_ip_address: Local IP Address to be filtered on. Notation: "127.0.0.1" for single address entry. "127.0.0.1-127.0.0.255" for range. "127.0.0.1;127.0.0.5;" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null. :type remote_ip_address: str :param local_port: Local port to be filtered on. Notation: "80" for single port entry."80-85" for range. "80;443;" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null. :type local_port: str :param remote_port: Remote port to be filtered on. Notation: "80" for single port entry."80-85" for range. "80;443;" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null. :type remote_port: str """ _attribute_map = { 'protocol': {'key': 'protocol', 'type': 'str'}, 'local_ip_address': {'key': 'localIPAddress', 'type': 'str'}, 'remote_ip_address': {'key': 'remoteIPAddress', 'type': 'str'}, 'local_port': {'key': 'localPort', 'type': 'str'}, 'remote_port': {'key': 'remotePort', 'type': 'str'}, } def __init__( self, **kwargs ): super(PacketCaptureFilter, self).__init__(**kwargs) self.protocol = kwargs.get('protocol', "Any") self.local_ip_address = kwargs.get('local_ip_address', None) self.remote_ip_address = kwargs.get('remote_ip_address', None) self.local_port = kwargs.get('local_port', None) self.remote_port = kwargs.get('remote_port', None) class PacketCaptureListResult(msrest.serialization.Model): """List of packet capture sessions. :param value: Information about packet capture sessions. :type value: list[~azure.mgmt.network.v2020_04_01.models.PacketCaptureResult] """ _attribute_map = { 'value': {'key': 'value', 'type': '[PacketCaptureResult]'}, } def __init__( self, **kwargs ): super(PacketCaptureListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) class PacketCaptureParameters(msrest.serialization.Model): """Parameters that define the create packet capture operation. All required parameters must be populated in order to send to Azure. :param target: Required. The ID of the targeted resource, only VM is currently supported. :type target: str :param bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes are truncated. :type bytes_to_capture_per_packet: int :param total_bytes_per_session: Maximum size of the capture output. :type total_bytes_per_session: int :param time_limit_in_seconds: Maximum duration of the capture session in seconds. :type time_limit_in_seconds: int :param storage_location: Required. The storage location for a packet capture session. :type storage_location: ~azure.mgmt.network.v2020_04_01.models.PacketCaptureStorageLocation :param filters: A list of packet capture filters. :type filters: list[~azure.mgmt.network.v2020_04_01.models.PacketCaptureFilter] """ _validation = { 'target': {'required': True}, 'storage_location': {'required': True}, } _attribute_map = { 'target': {'key': 'target', 'type': 'str'}, 'bytes_to_capture_per_packet': {'key': 'bytesToCapturePerPacket', 'type': 'int'}, 'total_bytes_per_session': {'key': 'totalBytesPerSession', 'type': 'int'}, 'time_limit_in_seconds': {'key': 'timeLimitInSeconds', 'type': 'int'}, 'storage_location': {'key': 'storageLocation', 'type': 'PacketCaptureStorageLocation'}, 'filters': {'key': 'filters', 'type': '[PacketCaptureFilter]'}, } def __init__( self, **kwargs ): super(PacketCaptureParameters, self).__init__(**kwargs) self.target = kwargs['target'] self.bytes_to_capture_per_packet = kwargs.get('bytes_to_capture_per_packet', 0) self.total_bytes_per_session = kwargs.get('total_bytes_per_session', 1073741824) self.time_limit_in_seconds = kwargs.get('time_limit_in_seconds', 18000) self.storage_location = kwargs['storage_location'] self.filters = kwargs.get('filters', None) class PacketCaptureQueryStatusResult(msrest.serialization.Model): """Status of packet capture session. :param name: The name of the packet capture resource. :type name: str :param id: The ID of the packet capture resource. :type id: str :param capture_start_time: The start time of the packet capture session. :type capture_start_time: ~datetime.datetime :param packet_capture_status: The status of the packet capture session. Possible values include: "NotStarted", "Running", "Stopped", "Error", "Unknown". :type packet_capture_status: str or ~azure.mgmt.network.v2020_04_01.models.PcStatus :param stop_reason: The reason the current packet capture session was stopped. :type stop_reason: str :param packet_capture_error: List of errors of packet capture session. :type packet_capture_error: list[str or ~azure.mgmt.network.v2020_04_01.models.PcError] """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'capture_start_time': {'key': 'captureStartTime', 'type': 'iso-8601'}, 'packet_capture_status': {'key': 'packetCaptureStatus', 'type': 'str'}, 'stop_reason': {'key': 'stopReason', 'type': 'str'}, 'packet_capture_error': {'key': 'packetCaptureError', 'type': '[str]'}, } def __init__( self, **kwargs ): super(PacketCaptureQueryStatusResult, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.id = kwargs.get('id', None) self.capture_start_time = kwargs.get('capture_start_time', None) self.packet_capture_status = kwargs.get('packet_capture_status', None) self.stop_reason = kwargs.get('stop_reason', None) self.packet_capture_error = kwargs.get('packet_capture_error', None) class PacketCaptureResult(msrest.serialization.Model): """Information about packet capture session. Variables are only populated by the server, and will be ignored when sending a request. :ivar name: Name of the packet capture session. :vartype name: str :ivar id: ID of the packet capture operation. :vartype id: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param target: The ID of the targeted resource, only VM is currently supported. :type target: str :param bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes are truncated. :type bytes_to_capture_per_packet: int :param total_bytes_per_session: Maximum size of the capture output. :type total_bytes_per_session: int :param time_limit_in_seconds: Maximum duration of the capture session in seconds. :type time_limit_in_seconds: int :param storage_location: The storage location for a packet capture session. :type storage_location: ~azure.mgmt.network.v2020_04_01.models.PacketCaptureStorageLocation :param filters: A list of packet capture filters. :type filters: list[~azure.mgmt.network.v2020_04_01.models.PacketCaptureFilter] :ivar provisioning_state: The provisioning state of the packet capture session. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'id': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'target': {'key': 'properties.target', 'type': 'str'}, 'bytes_to_capture_per_packet': {'key': 'properties.bytesToCapturePerPacket', 'type': 'int'}, 'total_bytes_per_session': {'key': 'properties.totalBytesPerSession', 'type': 'int'}, 'time_limit_in_seconds': {'key': 'properties.timeLimitInSeconds', 'type': 'int'}, 'storage_location': {'key': 'properties.storageLocation', 'type': 'PacketCaptureStorageLocation'}, 'filters': {'key': 'properties.filters', 'type': '[PacketCaptureFilter]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(PacketCaptureResult, self).__init__(**kwargs) self.name = None self.id = None self.etag = None self.target = kwargs.get('target', None) self.bytes_to_capture_per_packet = kwargs.get('bytes_to_capture_per_packet', 0) self.total_bytes_per_session = kwargs.get('total_bytes_per_session', 1073741824) self.time_limit_in_seconds = kwargs.get('time_limit_in_seconds', 18000) self.storage_location = kwargs.get('storage_location', None) self.filters = kwargs.get('filters', None) self.provisioning_state = None class PacketCaptureResultProperties(PacketCaptureParameters): """The properties of a packet capture session. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param target: Required. The ID of the targeted resource, only VM is currently supported. :type target: str :param bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes are truncated. :type bytes_to_capture_per_packet: int :param total_bytes_per_session: Maximum size of the capture output. :type total_bytes_per_session: int :param time_limit_in_seconds: Maximum duration of the capture session in seconds. :type time_limit_in_seconds: int :param storage_location: Required. The storage location for a packet capture session. :type storage_location: ~azure.mgmt.network.v2020_04_01.models.PacketCaptureStorageLocation :param filters: A list of packet capture filters. :type filters: list[~azure.mgmt.network.v2020_04_01.models.PacketCaptureFilter] :ivar provisioning_state: The provisioning state of the packet capture session. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'target': {'required': True}, 'storage_location': {'required': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'target': {'key': 'target', 'type': 'str'}, 'bytes_to_capture_per_packet': {'key': 'bytesToCapturePerPacket', 'type': 'int'}, 'total_bytes_per_session': {'key': 'totalBytesPerSession', 'type': 'int'}, 'time_limit_in_seconds': {'key': 'timeLimitInSeconds', 'type': 'int'}, 'storage_location': {'key': 'storageLocation', 'type': 'PacketCaptureStorageLocation'}, 'filters': {'key': 'filters', 'type': '[PacketCaptureFilter]'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(PacketCaptureResultProperties, self).__init__(**kwargs) self.provisioning_state = None class PacketCaptureStorageLocation(msrest.serialization.Model): """The storage location for a packet capture session. :param storage_id: The ID of the storage account to save the packet capture session. Required if no local file path is provided. :type storage_id: str :param storage_path: The URI of the storage path to save the packet capture. Must be a well-formed URI describing the location to save the packet capture. :type storage_path: str :param file_path: A valid local path on the targeting VM. Must include the name of the capture file (*.cap). For linux virtual machine it must start with /var/captures. Required if no storage ID is provided, otherwise optional. :type file_path: str """ _attribute_map = { 'storage_id': {'key': 'storageId', 'type': 'str'}, 'storage_path': {'key': 'storagePath', 'type': 'str'}, 'file_path': {'key': 'filePath', 'type': 'str'}, } def __init__( self, **kwargs ): super(PacketCaptureStorageLocation, self).__init__(**kwargs) self.storage_id = kwargs.get('storage_id', None) self.storage_path = kwargs.get('storage_path', None) self.file_path = kwargs.get('file_path', None) class PatchRouteFilter(SubResource): """Route Filter Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :vartype name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Resource type. :vartype type: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param rules: Collection of RouteFilterRules contained within a route filter. :type rules: list[~azure.mgmt.network.v2020_04_01.models.RouteFilterRule] :ivar peerings: A collection of references to express route circuit peerings. :vartype peerings: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitPeering] :ivar ipv6_peerings: A collection of references to express route circuit ipv6 peerings. :vartype ipv6_peerings: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitPeering] :ivar provisioning_state: The provisioning state of the route filter resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'etag': {'readonly': True}, 'type': {'readonly': True}, 'peerings': {'readonly': True}, 'ipv6_peerings': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'rules': {'key': 'properties.rules', 'type': '[RouteFilterRule]'}, 'peerings': {'key': 'properties.peerings', 'type': '[ExpressRouteCircuitPeering]'}, 'ipv6_peerings': {'key': 'properties.ipv6Peerings', 'type': '[ExpressRouteCircuitPeering]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(PatchRouteFilter, self).__init__(**kwargs) self.name = None self.etag = None self.type = None self.tags = kwargs.get('tags', None) self.rules = kwargs.get('rules', None) self.peerings = None self.ipv6_peerings = None self.provisioning_state = None class PatchRouteFilterRule(SubResource): """Route Filter Rule Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :vartype name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param access: The access type of the rule. Possible values include: "Allow", "Deny". :type access: str or ~azure.mgmt.network.v2020_04_01.models.Access :param route_filter_rule_type: The rule type of the rule. Possible values include: "Community". :type route_filter_rule_type: str or ~azure.mgmt.network.v2020_04_01.models.RouteFilterRuleType :param communities: The collection for bgp community values to filter on. e.g. ['12076:5010','12076:5020']. :type communities: list[str] :ivar provisioning_state: The provisioning state of the route filter rule resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'access': {'key': 'properties.access', 'type': 'str'}, 'route_filter_rule_type': {'key': 'properties.routeFilterRuleType', 'type': 'str'}, 'communities': {'key': 'properties.communities', 'type': '[str]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(PatchRouteFilterRule, self).__init__(**kwargs) self.name = None self.etag = None self.access = kwargs.get('access', None) self.route_filter_rule_type = kwargs.get('route_filter_rule_type', None) self.communities = kwargs.get('communities', None) self.provisioning_state = None class PeerExpressRouteCircuitConnection(SubResource): """Peer Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param express_route_circuit_peering: Reference to Express Route Circuit Private Peering Resource of the circuit. :type express_route_circuit_peering: ~azure.mgmt.network.v2020_04_01.models.SubResource :param peer_express_route_circuit_peering: Reference to Express Route Circuit Private Peering Resource of the peered circuit. :type peer_express_route_circuit_peering: ~azure.mgmt.network.v2020_04_01.models.SubResource :param address_prefix: /29 IP address space to carve out Customer addresses for tunnels. :type address_prefix: str :ivar circuit_connection_status: Express Route Circuit connection state. Possible values include: "Connected", "Connecting", "Disconnected". :vartype circuit_connection_status: str or ~azure.mgmt.network.v2020_04_01.models.CircuitConnectionStatus :param connection_name: The name of the express route circuit connection resource. :type connection_name: str :param auth_resource_guid: The resource guid of the authorization used for the express route circuit connection. :type auth_resource_guid: str :ivar provisioning_state: The provisioning state of the peer express route circuit connection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'circuit_connection_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'express_route_circuit_peering': {'key': 'properties.expressRouteCircuitPeering', 'type': 'SubResource'}, 'peer_express_route_circuit_peering': {'key': 'properties.peerExpressRouteCircuitPeering', 'type': 'SubResource'}, 'address_prefix': {'key': 'properties.addressPrefix', 'type': 'str'}, 'circuit_connection_status': {'key': 'properties.circuitConnectionStatus', 'type': 'str'}, 'connection_name': {'key': 'properties.connectionName', 'type': 'str'}, 'auth_resource_guid': {'key': 'properties.authResourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(PeerExpressRouteCircuitConnection, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.express_route_circuit_peering = kwargs.get('express_route_circuit_peering', None) self.peer_express_route_circuit_peering = kwargs.get('peer_express_route_circuit_peering', None) self.address_prefix = kwargs.get('address_prefix', None) self.circuit_connection_status = None self.connection_name = kwargs.get('connection_name', None) self.auth_resource_guid = kwargs.get('auth_resource_guid', None) self.provisioning_state = None class PeerExpressRouteCircuitConnectionListResult(msrest.serialization.Model): """Response for ListPeeredConnections API service call retrieves all global reach peer circuit connections that belongs to a Private Peering for an ExpressRouteCircuit. :param value: The global reach peer circuit connection associated with Private Peering in an ExpressRoute Circuit. :type value: list[~azure.mgmt.network.v2020_04_01.models.PeerExpressRouteCircuitConnection] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[PeerExpressRouteCircuitConnection]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(PeerExpressRouteCircuitConnectionListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class PolicySettings(msrest.serialization.Model): """Defines contents of a web application firewall global configuration. :param state: The state of the policy. Possible values include: "Disabled", "Enabled". :type state: str or ~azure.mgmt.network.v2020_04_01.models.WebApplicationFirewallEnabledState :param mode: The mode of the policy. Possible values include: "Prevention", "Detection". :type mode: str or ~azure.mgmt.network.v2020_04_01.models.WebApplicationFirewallMode :param request_body_check: Whether to allow WAF to check request Body. :type request_body_check: bool :param max_request_body_size_in_kb: Maximum request body size in Kb for WAF. :type max_request_body_size_in_kb: int :param file_upload_limit_in_mb: Maximum file upload size in Mb for WAF. :type file_upload_limit_in_mb: int """ _validation = { 'max_request_body_size_in_kb': {'maximum': 128, 'minimum': 8}, 'file_upload_limit_in_mb': {'minimum': 0}, } _attribute_map = { 'state': {'key': 'state', 'type': 'str'}, 'mode': {'key': 'mode', 'type': 'str'}, 'request_body_check': {'key': 'requestBodyCheck', 'type': 'bool'}, 'max_request_body_size_in_kb': {'key': 'maxRequestBodySizeInKb', 'type': 'int'}, 'file_upload_limit_in_mb': {'key': 'fileUploadLimitInMb', 'type': 'int'}, } def __init__( self, **kwargs ): super(PolicySettings, self).__init__(**kwargs) self.state = kwargs.get('state', None) self.mode = kwargs.get('mode', None) self.request_body_check = kwargs.get('request_body_check', None) self.max_request_body_size_in_kb = kwargs.get('max_request_body_size_in_kb', None) self.file_upload_limit_in_mb = kwargs.get('file_upload_limit_in_mb', None) class PrepareNetworkPoliciesRequest(msrest.serialization.Model): """Details of PrepareNetworkPolicies for Subnet. :param service_name: The name of the service for which subnet is being prepared for. :type service_name: str :param network_intent_policy_configurations: A list of NetworkIntentPolicyConfiguration. :type network_intent_policy_configurations: list[~azure.mgmt.network.v2020_04_01.models.NetworkIntentPolicyConfiguration] """ _attribute_map = { 'service_name': {'key': 'serviceName', 'type': 'str'}, 'network_intent_policy_configurations': {'key': 'networkIntentPolicyConfigurations', 'type': '[NetworkIntentPolicyConfiguration]'}, } def __init__( self, **kwargs ): super(PrepareNetworkPoliciesRequest, self).__init__(**kwargs) self.service_name = kwargs.get('service_name', None) self.network_intent_policy_configurations = kwargs.get('network_intent_policy_configurations', None) class PrivateDnsZoneConfig(msrest.serialization.Model): """PrivateDnsZoneConfig resource. Variables are only populated by the server, and will be ignored when sending a request. :param name: Name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :param private_dns_zone_id: The resource id of the private dns zone. :type private_dns_zone_id: str :ivar record_sets: A collection of information regarding a recordSet, holding information to identify private resources. :vartype record_sets: list[~azure.mgmt.network.v2020_04_01.models.RecordSet] """ _validation = { 'record_sets': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'private_dns_zone_id': {'key': 'properties.privateDnsZoneId', 'type': 'str'}, 'record_sets': {'key': 'properties.recordSets', 'type': '[RecordSet]'}, } def __init__( self, **kwargs ): super(PrivateDnsZoneConfig, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.private_dns_zone_id = kwargs.get('private_dns_zone_id', None) self.record_sets = None class PrivateDnsZoneGroup(SubResource): """Private dns zone group resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar provisioning_state: The provisioning state of the private dns zone group resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param private_dns_zone_configs: A collection of private dns zone configurations of the private dns zone group. :type private_dns_zone_configs: list[~azure.mgmt.network.v2020_04_01.models.PrivateDnsZoneConfig] """ _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'private_dns_zone_configs': {'key': 'properties.privateDnsZoneConfigs', 'type': '[PrivateDnsZoneConfig]'}, } def __init__( self, **kwargs ): super(PrivateDnsZoneGroup, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.provisioning_state = None self.private_dns_zone_configs = kwargs.get('private_dns_zone_configs', None) class PrivateDnsZoneGroupListResult(msrest.serialization.Model): """Response for the ListPrivateDnsZoneGroups API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of private dns zone group resources in a private endpoint. :type value: list[~azure.mgmt.network.v2020_04_01.models.PrivateDnsZoneGroup] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[PrivateDnsZoneGroup]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(PrivateDnsZoneGroupListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class PrivateEndpoint(Resource): """Private endpoint resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param subnet: The ID of the subnet from which the private IP will be allocated. :type subnet: ~azure.mgmt.network.v2020_04_01.models.Subnet :ivar network_interfaces: An array of references to the network interfaces created for this private endpoint. :vartype network_interfaces: list[~azure.mgmt.network.v2020_04_01.models.NetworkInterface] :ivar provisioning_state: The provisioning state of the private endpoint resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param private_link_service_connections: A grouping of information about the connection to the remote resource. :type private_link_service_connections: list[~azure.mgmt.network.v2020_04_01.models.PrivateLinkServiceConnection] :param manual_private_link_service_connections: A grouping of information about the connection to the remote resource. Used when the network admin does not have access to approve connections to the remote resource. :type manual_private_link_service_connections: list[~azure.mgmt.network.v2020_04_01.models.PrivateLinkServiceConnection] :param custom_dns_configs: An array of custom dns configurations. :type custom_dns_configs: list[~azure.mgmt.network.v2020_04_01.models.CustomDnsConfigPropertiesFormat] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'network_interfaces': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'Subnet'}, 'network_interfaces': {'key': 'properties.networkInterfaces', 'type': '[NetworkInterface]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'private_link_service_connections': {'key': 'properties.privateLinkServiceConnections', 'type': '[PrivateLinkServiceConnection]'}, 'manual_private_link_service_connections': {'key': 'properties.manualPrivateLinkServiceConnections', 'type': '[PrivateLinkServiceConnection]'}, 'custom_dns_configs': {'key': 'properties.customDnsConfigs', 'type': '[CustomDnsConfigPropertiesFormat]'}, } def __init__( self, **kwargs ): super(PrivateEndpoint, self).__init__(**kwargs) self.etag = None self.subnet = kwargs.get('subnet', None) self.network_interfaces = None self.provisioning_state = None self.private_link_service_connections = kwargs.get('private_link_service_connections', None) self.manual_private_link_service_connections = kwargs.get('manual_private_link_service_connections', None) self.custom_dns_configs = kwargs.get('custom_dns_configs', None) class PrivateEndpointConnection(SubResource): """PrivateEndpointConnection resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar type: The resource type. :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar private_endpoint: The resource of private end point. :vartype private_endpoint: ~azure.mgmt.network.v2020_04_01.models.PrivateEndpoint :param private_link_service_connection_state: A collection of information about the state of the connection between service consumer and provider. :type private_link_service_connection_state: ~azure.mgmt.network.v2020_04_01.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :ivar link_identifier: The consumer link id. :vartype link_identifier: str """ _validation = { 'type': {'readonly': True}, 'etag': {'readonly': True}, 'private_endpoint': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'link_identifier': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'link_identifier': {'key': 'properties.linkIdentifier', 'type': 'str'}, } def __init__( self, **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.type = None self.etag = None self.private_endpoint = None self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) self.provisioning_state = None self.link_identifier = None class PrivateEndpointConnectionListResult(msrest.serialization.Model): """Response for the ListPrivateEndpointConnection API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of PrivateEndpointConnection resources for a specific private link service. :type value: list[~azure.mgmt.network.v2020_04_01.models.PrivateEndpointConnection] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class PrivateEndpointListResult(msrest.serialization.Model): """Response for the ListPrivateEndpoints API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of private endpoint resources in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.PrivateEndpoint] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[PrivateEndpoint]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(PrivateEndpointListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class PrivateLinkService(Resource): """Private link service resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param load_balancer_frontend_ip_configurations: An array of references to the load balancer IP configurations. :type load_balancer_frontend_ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.FrontendIPConfiguration] :param ip_configurations: An array of private link service IP configurations. :type ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.PrivateLinkServiceIpConfiguration] :ivar network_interfaces: An array of references to the network interfaces created for this private link service. :vartype network_interfaces: list[~azure.mgmt.network.v2020_04_01.models.NetworkInterface] :ivar provisioning_state: The provisioning state of the private link service resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :ivar private_endpoint_connections: An array of list about connections to the private endpoint. :vartype private_endpoint_connections: list[~azure.mgmt.network.v2020_04_01.models.PrivateEndpointConnection] :param visibility: The visibility list of the private link service. :type visibility: ~azure.mgmt.network.v2020_04_01.models.PrivateLinkServicePropertiesVisibility :param auto_approval: The auto-approval list of the private link service. :type auto_approval: ~azure.mgmt.network.v2020_04_01.models.PrivateLinkServicePropertiesAutoApproval :param fqdns: The list of Fqdn. :type fqdns: list[str] :ivar alias: The alias of the private link service. :vartype alias: str :param enable_proxy_protocol: Whether the private link service is enabled for proxy protocol or not. :type enable_proxy_protocol: bool """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'network_interfaces': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'private_endpoint_connections': {'readonly': True}, 'alias': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'load_balancer_frontend_ip_configurations': {'key': 'properties.loadBalancerFrontendIpConfigurations', 'type': '[FrontendIPConfiguration]'}, 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[PrivateLinkServiceIpConfiguration]'}, 'network_interfaces': {'key': 'properties.networkInterfaces', 'type': '[NetworkInterface]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, 'visibility': {'key': 'properties.visibility', 'type': 'PrivateLinkServicePropertiesVisibility'}, 'auto_approval': {'key': 'properties.autoApproval', 'type': 'PrivateLinkServicePropertiesAutoApproval'}, 'fqdns': {'key': 'properties.fqdns', 'type': '[str]'}, 'alias': {'key': 'properties.alias', 'type': 'str'}, 'enable_proxy_protocol': {'key': 'properties.enableProxyProtocol', 'type': 'bool'}, } def __init__( self, **kwargs ): super(PrivateLinkService, self).__init__(**kwargs) self.etag = None self.load_balancer_frontend_ip_configurations = kwargs.get('load_balancer_frontend_ip_configurations', None) self.ip_configurations = kwargs.get('ip_configurations', None) self.network_interfaces = None self.provisioning_state = None self.private_endpoint_connections = None self.visibility = kwargs.get('visibility', None) self.auto_approval = kwargs.get('auto_approval', None) self.fqdns = kwargs.get('fqdns', None) self.alias = None self.enable_proxy_protocol = kwargs.get('enable_proxy_protocol', None) class PrivateLinkServiceConnection(SubResource): """PrivateLinkServiceConnection resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar type: The resource type. :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar provisioning_state: The provisioning state of the private link service connection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param private_link_service_id: The resource id of private link service. :type private_link_service_id: str :param group_ids: The ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to. :type group_ids: list[str] :param request_message: A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars. :type request_message: str :param private_link_service_connection_state: A collection of read-only information about the state of the connection to the remote resource. :type private_link_service_connection_state: ~azure.mgmt.network.v2020_04_01.models.PrivateLinkServiceConnectionState """ _validation = { 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'private_link_service_id': {'key': 'properties.privateLinkServiceId', 'type': 'str'}, 'group_ids': {'key': 'properties.groupIds', 'type': '[str]'}, 'request_message': {'key': 'properties.requestMessage', 'type': 'str'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, } def __init__( self, **kwargs ): super(PrivateLinkServiceConnection, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.type = None self.etag = None self.provisioning_state = None self.private_link_service_id = kwargs.get('private_link_service_id', None) self.group_ids = kwargs.get('group_ids', None) self.request_message = kwargs.get('request_message', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. :type status: str :param description: The reason for approval/rejection of the connection. :type description: str :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( self, **kwargs ): super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.description = kwargs.get('description', None) self.actions_required = kwargs.get('actions_required', None) class PrivateLinkServiceIpConfiguration(SubResource): """The private link service ip configuration. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of private link service ip configuration. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: The resource type. :vartype type: str :param private_ip_address: The private IP address of the IP configuration. :type private_ip_address: str :param private_ip_allocation_method: The private IP address allocation method. Possible values include: "Static", "Dynamic". :type private_ip_allocation_method: str or ~azure.mgmt.network.v2020_04_01.models.IPAllocationMethod :param subnet: The reference to the subnet resource. :type subnet: ~azure.mgmt.network.v2020_04_01.models.Subnet :param primary: Whether the ip configuration is primary or not. :type primary: bool :ivar provisioning_state: The provisioning state of the private link service IP configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param private_ip_address_version: Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4. Possible values include: "IPv4", "IPv6". :type private_ip_address_version: str or ~azure.mgmt.network.v2020_04_01.models.IPVersion """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'private_ip_address': {'key': 'properties.privateIPAddress', 'type': 'str'}, 'private_ip_allocation_method': {'key': 'properties.privateIPAllocationMethod', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'Subnet'}, 'primary': {'key': 'properties.primary', 'type': 'bool'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'private_ip_address_version': {'key': 'properties.privateIPAddressVersion', 'type': 'str'}, } def __init__( self, **kwargs ): super(PrivateLinkServiceIpConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.private_ip_address = kwargs.get('private_ip_address', None) self.private_ip_allocation_method = kwargs.get('private_ip_allocation_method', None) self.subnet = kwargs.get('subnet', None) self.primary = kwargs.get('primary', None) self.provisioning_state = None self.private_ip_address_version = kwargs.get('private_ip_address_version', None) class PrivateLinkServiceListResult(msrest.serialization.Model): """Response for the ListPrivateLinkService API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of PrivateLinkService resources in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.PrivateLinkService] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[PrivateLinkService]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(PrivateLinkServiceListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class ResourceSet(msrest.serialization.Model): """The base resource set for visibility and auto-approval. :param subscriptions: The list of subscriptions. :type subscriptions: list[str] """ _attribute_map = { 'subscriptions': {'key': 'subscriptions', 'type': '[str]'}, } def __init__( self, **kwargs ): super(ResourceSet, self).__init__(**kwargs) self.subscriptions = kwargs.get('subscriptions', None) class PrivateLinkServicePropertiesAutoApproval(ResourceSet): """The auto-approval list of the private link service. :param subscriptions: The list of subscriptions. :type subscriptions: list[str] """ _attribute_map = { 'subscriptions': {'key': 'subscriptions', 'type': '[str]'}, } def __init__( self, **kwargs ): super(PrivateLinkServicePropertiesAutoApproval, self).__init__(**kwargs) class PrivateLinkServicePropertiesVisibility(ResourceSet): """The visibility list of the private link service. :param subscriptions: The list of subscriptions. :type subscriptions: list[str] """ _attribute_map = { 'subscriptions': {'key': 'subscriptions', 'type': '[str]'}, } def __init__( self, **kwargs ): super(PrivateLinkServicePropertiesVisibility, self).__init__(**kwargs) class PrivateLinkServiceVisibility(msrest.serialization.Model): """Response for the CheckPrivateLinkServiceVisibility API service call. :param visible: Private Link Service Visibility (True/False). :type visible: bool """ _attribute_map = { 'visible': {'key': 'visible', 'type': 'bool'}, } def __init__( self, **kwargs ): super(PrivateLinkServiceVisibility, self).__init__(**kwargs) self.visible = kwargs.get('visible', None) class Probe(SubResource): """A load balancer probe. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within the set of probes used by the load balancer. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :ivar load_balancing_rules: The load balancer rules that use this probe. :vartype load_balancing_rules: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :param protocol: The protocol of the end point. If 'Tcp' is specified, a received ACK is required for the probe to be successful. If 'Http' or 'Https' is specified, a 200 OK response from the specifies URI is required for the probe to be successful. Possible values include: "Http", "Tcp", "Https". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.ProbeProtocol :param port: The port for communicating the probe. Possible values range from 1 to 65535, inclusive. :type port: int :param interval_in_seconds: The interval, in seconds, for how frequently to probe the endpoint for health status. Typically, the interval is slightly less than half the allocated timeout period (in seconds) which allows two full probes before taking the instance out of rotation. The default value is 15, the minimum value is 5. :type interval_in_seconds: int :param number_of_probes: The number of probes where if no response, will result in stopping further traffic from being delivered to the endpoint. This values allows endpoints to be taken out of rotation faster or slower than the typical times used in Azure. :type number_of_probes: int :param request_path: The URI used for requesting health status from the VM. Path is required if a protocol is set to http. Otherwise, it is not allowed. There is no default value. :type request_path: str :ivar provisioning_state: The provisioning state of the probe resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'load_balancing_rules': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'load_balancing_rules': {'key': 'properties.loadBalancingRules', 'type': '[SubResource]'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, 'port': {'key': 'properties.port', 'type': 'int'}, 'interval_in_seconds': {'key': 'properties.intervalInSeconds', 'type': 'int'}, 'number_of_probes': {'key': 'properties.numberOfProbes', 'type': 'int'}, 'request_path': {'key': 'properties.requestPath', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(Probe, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.load_balancing_rules = None self.protocol = kwargs.get('protocol', None) self.port = kwargs.get('port', None) self.interval_in_seconds = kwargs.get('interval_in_seconds', None) self.number_of_probes = kwargs.get('number_of_probes', None) self.request_path = kwargs.get('request_path', None) self.provisioning_state = None class PropagatedRouteTable(msrest.serialization.Model): """The list of RouteTables to advertise the routes to. :param labels: The list of labels. :type labels: list[str] :param ids: The list of resource ids of all the RouteTables. :type ids: list[~azure.mgmt.network.v2020_04_01.models.SubResource] """ _attribute_map = { 'labels': {'key': 'labels', 'type': '[str]'}, 'ids': {'key': 'ids', 'type': '[SubResource]'}, } def __init__( self, **kwargs ): super(PropagatedRouteTable, self).__init__(**kwargs) self.labels = kwargs.get('labels', None) self.ids = kwargs.get('ids', None) class ProtocolConfiguration(msrest.serialization.Model): """Configuration of the protocol. :param http_configuration: HTTP configuration of the connectivity check. :type http_configuration: ~azure.mgmt.network.v2020_04_01.models.HTTPConfiguration """ _attribute_map = { 'http_configuration': {'key': 'HTTPConfiguration', 'type': 'HTTPConfiguration'}, } def __init__( self, **kwargs ): super(ProtocolConfiguration, self).__init__(**kwargs) self.http_configuration = kwargs.get('http_configuration', None) class ProtocolCustomSettingsFormat(msrest.serialization.Model): """DDoS custom policy properties. :param protocol: The protocol for which the DDoS protection policy is being customized. Possible values include: "Tcp", "Udp", "Syn". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.DdosCustomPolicyProtocol :param trigger_rate_override: The customized DDoS protection trigger rate. :type trigger_rate_override: str :param source_rate_override: The customized DDoS protection source rate. :type source_rate_override: str :param trigger_sensitivity_override: The customized DDoS protection trigger rate sensitivity degrees. High: Trigger rate set with most sensitivity w.r.t. normal traffic. Default: Trigger rate set with moderate sensitivity w.r.t. normal traffic. Low: Trigger rate set with less sensitivity w.r.t. normal traffic. Relaxed: Trigger rate set with least sensitivity w.r.t. normal traffic. Possible values include: "Relaxed", "Low", "Default", "High". :type trigger_sensitivity_override: str or ~azure.mgmt.network.v2020_04_01.models.DdosCustomPolicyTriggerSensitivityOverride """ _attribute_map = { 'protocol': {'key': 'protocol', 'type': 'str'}, 'trigger_rate_override': {'key': 'triggerRateOverride', 'type': 'str'}, 'source_rate_override': {'key': 'sourceRateOverride', 'type': 'str'}, 'trigger_sensitivity_override': {'key': 'triggerSensitivityOverride', 'type': 'str'}, } def __init__( self, **kwargs ): super(ProtocolCustomSettingsFormat, self).__init__(**kwargs) self.protocol = kwargs.get('protocol', None) self.trigger_rate_override = kwargs.get('trigger_rate_override', None) self.source_rate_override = kwargs.get('source_rate_override', None) self.trigger_sensitivity_override = kwargs.get('trigger_sensitivity_override', None) class PublicIPAddress(Resource): """Public IP address resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: The public IP address SKU. :type sku: ~azure.mgmt.network.v2020_04_01.models.PublicIPAddressSku :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param zones: A list of availability zones denoting the IP allocated for the resource needs to come from. :type zones: list[str] :param public_ip_allocation_method: The public IP address allocation method. Possible values include: "Static", "Dynamic". :type public_ip_allocation_method: str or ~azure.mgmt.network.v2020_04_01.models.IPAllocationMethod :param public_ip_address_version: The public IP address version. Possible values include: "IPv4", "IPv6". :type public_ip_address_version: str or ~azure.mgmt.network.v2020_04_01.models.IPVersion :ivar ip_configuration: The IP configuration associated with the public IP address. :vartype ip_configuration: ~azure.mgmt.network.v2020_04_01.models.IPConfiguration :param dns_settings: The FQDN of the DNS record associated with the public IP address. :type dns_settings: ~azure.mgmt.network.v2020_04_01.models.PublicIPAddressDnsSettings :param ddos_settings: The DDoS protection custom policy associated with the public IP address. :type ddos_settings: ~azure.mgmt.network.v2020_04_01.models.DdosSettings :param ip_tags: The list of tags associated with the public IP address. :type ip_tags: list[~azure.mgmt.network.v2020_04_01.models.IpTag] :param ip_address: The IP address associated with the public IP address resource. :type ip_address: str :param public_ip_prefix: The Public IP Prefix this Public IP Address should be allocated from. :type public_ip_prefix: ~azure.mgmt.network.v2020_04_01.models.SubResource :param idle_timeout_in_minutes: The idle timeout of the public IP address. :type idle_timeout_in_minutes: int :ivar resource_guid: The resource GUID property of the public IP address resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the public IP address resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'ip_configuration': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'PublicIPAddressSku'}, 'etag': {'key': 'etag', 'type': 'str'}, 'zones': {'key': 'zones', 'type': '[str]'}, 'public_ip_allocation_method': {'key': 'properties.publicIPAllocationMethod', 'type': 'str'}, 'public_ip_address_version': {'key': 'properties.publicIPAddressVersion', 'type': 'str'}, 'ip_configuration': {'key': 'properties.ipConfiguration', 'type': 'IPConfiguration'}, 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'PublicIPAddressDnsSettings'}, 'ddos_settings': {'key': 'properties.ddosSettings', 'type': 'DdosSettings'}, 'ip_tags': {'key': 'properties.ipTags', 'type': '[IpTag]'}, 'ip_address': {'key': 'properties.ipAddress', 'type': 'str'}, 'public_ip_prefix': {'key': 'properties.publicIPPrefix', 'type': 'SubResource'}, 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(PublicIPAddress, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.etag = None self.zones = kwargs.get('zones', None) self.public_ip_allocation_method = kwargs.get('public_ip_allocation_method', None) self.public_ip_address_version = kwargs.get('public_ip_address_version', None) self.ip_configuration = None self.dns_settings = kwargs.get('dns_settings', None) self.ddos_settings = kwargs.get('ddos_settings', None) self.ip_tags = kwargs.get('ip_tags', None) self.ip_address = kwargs.get('ip_address', None) self.public_ip_prefix = kwargs.get('public_ip_prefix', None) self.idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes', None) self.resource_guid = None self.provisioning_state = None class PublicIPAddressDnsSettings(msrest.serialization.Model): """Contains FQDN of the DNS record associated with the public IP address. :param domain_name_label: The domain name label. The concatenation of the domain name label and the regionalized DNS zone make up the fully qualified domain name associated with the public IP address. If a domain name label is specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system. :type domain_name_label: str :param fqdn: The Fully Qualified Domain Name of the A DNS record associated with the public IP. This is the concatenation of the domainNameLabel and the regionalized DNS zone. :type fqdn: str :param reverse_fqdn: The reverse FQDN. A user-visible, fully qualified domain name that resolves to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is created pointing from the IP address in the in-addr.arpa domain to the reverse FQDN. :type reverse_fqdn: str """ _attribute_map = { 'domain_name_label': {'key': 'domainNameLabel', 'type': 'str'}, 'fqdn': {'key': 'fqdn', 'type': 'str'}, 'reverse_fqdn': {'key': 'reverseFqdn', 'type': 'str'}, } def __init__( self, **kwargs ): super(PublicIPAddressDnsSettings, self).__init__(**kwargs) self.domain_name_label = kwargs.get('domain_name_label', None) self.fqdn = kwargs.get('fqdn', None) self.reverse_fqdn = kwargs.get('reverse_fqdn', None) class PublicIPAddressListResult(msrest.serialization.Model): """Response for ListPublicIpAddresses API service call. :param value: A list of public IP addresses that exists in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.PublicIPAddress] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[PublicIPAddress]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(PublicIPAddressListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class PublicIPAddressSku(msrest.serialization.Model): """SKU of a public IP address. :param name: Name of a public IP address SKU. Possible values include: "Basic", "Standard". :type name: str or ~azure.mgmt.network.v2020_04_01.models.PublicIPAddressSkuName """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, } def __init__( self, **kwargs ): super(PublicIPAddressSku, self).__init__(**kwargs) self.name = kwargs.get('name', None) class PublicIPPrefix(Resource): """Public IP prefix resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: The public IP prefix SKU. :type sku: ~azure.mgmt.network.v2020_04_01.models.PublicIPPrefixSku :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param zones: A list of availability zones denoting the IP allocated for the resource needs to come from. :type zones: list[str] :param public_ip_address_version: The public IP address version. Possible values include: "IPv4", "IPv6". :type public_ip_address_version: str or ~azure.mgmt.network.v2020_04_01.models.IPVersion :param ip_tags: The list of tags associated with the public IP prefix. :type ip_tags: list[~azure.mgmt.network.v2020_04_01.models.IpTag] :param prefix_length: The Length of the Public IP Prefix. :type prefix_length: int :ivar ip_prefix: The allocated Prefix. :vartype ip_prefix: str :ivar public_ip_addresses: The list of all referenced PublicIPAddresses. :vartype public_ip_addresses: list[~azure.mgmt.network.v2020_04_01.models.ReferencedPublicIpAddress] :ivar load_balancer_frontend_ip_configuration: The reference to load balancer frontend IP configuration associated with the public IP prefix. :vartype load_balancer_frontend_ip_configuration: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar resource_guid: The resource GUID property of the public IP prefix resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the public IP prefix resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'ip_prefix': {'readonly': True}, 'public_ip_addresses': {'readonly': True}, 'load_balancer_frontend_ip_configuration': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'PublicIPPrefixSku'}, 'etag': {'key': 'etag', 'type': 'str'}, 'zones': {'key': 'zones', 'type': '[str]'}, 'public_ip_address_version': {'key': 'properties.publicIPAddressVersion', 'type': 'str'}, 'ip_tags': {'key': 'properties.ipTags', 'type': '[IpTag]'}, 'prefix_length': {'key': 'properties.prefixLength', 'type': 'int'}, 'ip_prefix': {'key': 'properties.ipPrefix', 'type': 'str'}, 'public_ip_addresses': {'key': 'properties.publicIPAddresses', 'type': '[ReferencedPublicIpAddress]'}, 'load_balancer_frontend_ip_configuration': {'key': 'properties.loadBalancerFrontendIpConfiguration', 'type': 'SubResource'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(PublicIPPrefix, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.etag = None self.zones = kwargs.get('zones', None) self.public_ip_address_version = kwargs.get('public_ip_address_version', None) self.ip_tags = kwargs.get('ip_tags', None) self.prefix_length = kwargs.get('prefix_length', None) self.ip_prefix = None self.public_ip_addresses = None self.load_balancer_frontend_ip_configuration = None self.resource_guid = None self.provisioning_state = None class PublicIPPrefixListResult(msrest.serialization.Model): """Response for ListPublicIpPrefixes API service call. :param value: A list of public IP prefixes that exists in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.PublicIPPrefix] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[PublicIPPrefix]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(PublicIPPrefixListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class PublicIPPrefixSku(msrest.serialization.Model): """SKU of a public IP prefix. :param name: Name of a public IP prefix SKU. Possible values include: "Standard". :type name: str or ~azure.mgmt.network.v2020_04_01.models.PublicIPPrefixSkuName """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, } def __init__( self, **kwargs ): super(PublicIPPrefixSku, self).__init__(**kwargs) self.name = kwargs.get('name', None) class QueryTroubleshootingParameters(msrest.serialization.Model): """Parameters that define the resource to query the troubleshooting result. All required parameters must be populated in order to send to Azure. :param target_resource_id: Required. The target resource ID to query the troubleshooting result. :type target_resource_id: str """ _validation = { 'target_resource_id': {'required': True}, } _attribute_map = { 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, } def __init__( self, **kwargs ): super(QueryTroubleshootingParameters, self).__init__(**kwargs) self.target_resource_id = kwargs['target_resource_id'] class RadiusServer(msrest.serialization.Model): """Radius Server Settings. All required parameters must be populated in order to send to Azure. :param radius_server_address: Required. The address of this radius server. :type radius_server_address: str :param radius_server_score: The initial score assigned to this radius server. :type radius_server_score: long :param radius_server_secret: The secret used for this radius server. :type radius_server_secret: str """ _validation = { 'radius_server_address': {'required': True}, } _attribute_map = { 'radius_server_address': {'key': 'radiusServerAddress', 'type': 'str'}, 'radius_server_score': {'key': 'radiusServerScore', 'type': 'long'}, 'radius_server_secret': {'key': 'radiusServerSecret', 'type': 'str'}, } def __init__( self, **kwargs ): super(RadiusServer, self).__init__(**kwargs) self.radius_server_address = kwargs['radius_server_address'] self.radius_server_score = kwargs.get('radius_server_score', None) self.radius_server_secret = kwargs.get('radius_server_secret', None) class RecordSet(msrest.serialization.Model): """A collective group of information about the record set information. Variables are only populated by the server, and will be ignored when sending a request. :param record_type: Resource record type. :type record_type: str :param record_set_name: Recordset name. :type record_set_name: str :param fqdn: Fqdn that resolves to private endpoint ip address. :type fqdn: str :ivar provisioning_state: The provisioning state of the recordset. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param ttl: Recordset time to live. :type ttl: int :param ip_addresses: The private ip address of the private endpoint. :type ip_addresses: list[str] """ _validation = { 'provisioning_state': {'readonly': True}, } _attribute_map = { 'record_type': {'key': 'recordType', 'type': 'str'}, 'record_set_name': {'key': 'recordSetName', 'type': 'str'}, 'fqdn': {'key': 'fqdn', 'type': 'str'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'ttl': {'key': 'ttl', 'type': 'int'}, 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, } def __init__( self, **kwargs ): super(RecordSet, self).__init__(**kwargs) self.record_type = kwargs.get('record_type', None) self.record_set_name = kwargs.get('record_set_name', None) self.fqdn = kwargs.get('fqdn', None) self.provisioning_state = None self.ttl = kwargs.get('ttl', None) self.ip_addresses = kwargs.get('ip_addresses', None) class ReferencedPublicIpAddress(msrest.serialization.Model): """Reference to a public IP address. :param id: The PublicIPAddress Reference. :type id: str """ _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, **kwargs ): super(ReferencedPublicIpAddress, self).__init__(**kwargs) self.id = kwargs.get('id', None) class ResourceNavigationLink(SubResource): """ResourceNavigationLink resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Resource type. :vartype type: str :param linked_resource_type: Resource type of the linked resource. :type linked_resource_type: str :param link: Link to the external resource. :type link: str :ivar provisioning_state: The provisioning state of the resource navigation link resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'linked_resource_type': {'key': 'properties.linkedResourceType', 'type': 'str'}, 'link': {'key': 'properties.link', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ResourceNavigationLink, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.linked_resource_type = kwargs.get('linked_resource_type', None) self.link = kwargs.get('link', None) self.provisioning_state = None class ResourceNavigationLinksListResult(msrest.serialization.Model): """Response for ResourceNavigationLinks_List operation. Variables are only populated by the server, and will be ignored when sending a request. :param value: The resource navigation links in a subnet. :type value: list[~azure.mgmt.network.v2020_04_01.models.ResourceNavigationLink] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[ResourceNavigationLink]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ResourceNavigationLinksListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class RetentionPolicyParameters(msrest.serialization.Model): """Parameters that define the retention policy for flow log. :param days: Number of days to retain flow log records. :type days: int :param enabled: Flag to enable/disable retention. :type enabled: bool """ _attribute_map = { 'days': {'key': 'days', 'type': 'int'}, 'enabled': {'key': 'enabled', 'type': 'bool'}, } def __init__( self, **kwargs ): super(RetentionPolicyParameters, self).__init__(**kwargs) self.days = kwargs.get('days', 0) self.enabled = kwargs.get('enabled', False) class Route(SubResource): """Route resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param address_prefix: The destination CIDR to which the route applies. :type address_prefix: str :param next_hop_type: The type of Azure hop the packet should be sent to. Possible values include: "VirtualNetworkGateway", "VnetLocal", "Internet", "VirtualAppliance", "None". :type next_hop_type: str or ~azure.mgmt.network.v2020_04_01.models.RouteNextHopType :param next_hop_ip_address: The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. :type next_hop_ip_address: str :ivar provisioning_state: The provisioning state of the route resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'address_prefix': {'key': 'properties.addressPrefix', 'type': 'str'}, 'next_hop_type': {'key': 'properties.nextHopType', 'type': 'str'}, 'next_hop_ip_address': {'key': 'properties.nextHopIpAddress', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(Route, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.address_prefix = kwargs.get('address_prefix', None) self.next_hop_type = kwargs.get('next_hop_type', None) self.next_hop_ip_address = kwargs.get('next_hop_ip_address', None) self.provisioning_state = None class RouteFilter(Resource): """Route Filter Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param rules: Collection of RouteFilterRules contained within a route filter. :type rules: list[~azure.mgmt.network.v2020_04_01.models.RouteFilterRule] :ivar peerings: A collection of references to express route circuit peerings. :vartype peerings: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitPeering] :ivar ipv6_peerings: A collection of references to express route circuit ipv6 peerings. :vartype ipv6_peerings: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitPeering] :ivar provisioning_state: The provisioning state of the route filter resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'peerings': {'readonly': True}, 'ipv6_peerings': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'rules': {'key': 'properties.rules', 'type': '[RouteFilterRule]'}, 'peerings': {'key': 'properties.peerings', 'type': '[ExpressRouteCircuitPeering]'}, 'ipv6_peerings': {'key': 'properties.ipv6Peerings', 'type': '[ExpressRouteCircuitPeering]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(RouteFilter, self).__init__(**kwargs) self.etag = None self.rules = kwargs.get('rules', None) self.peerings = None self.ipv6_peerings = None self.provisioning_state = None class RouteFilterListResult(msrest.serialization.Model): """Response for the ListRouteFilters API service call. :param value: A list of route filters in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.RouteFilter] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[RouteFilter]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(RouteFilterListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class RouteFilterRule(SubResource): """Route Filter Rule Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :param location: Resource location. :type location: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param access: The access type of the rule. Possible values include: "Allow", "Deny". :type access: str or ~azure.mgmt.network.v2020_04_01.models.Access :param route_filter_rule_type: The rule type of the rule. Possible values include: "Community". :type route_filter_rule_type: str or ~azure.mgmt.network.v2020_04_01.models.RouteFilterRuleType :param communities: The collection for bgp community values to filter on. e.g. ['12076:5010','12076:5020']. :type communities: list[str] :ivar provisioning_state: The provisioning state of the route filter rule resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'access': {'key': 'properties.access', 'type': 'str'}, 'route_filter_rule_type': {'key': 'properties.routeFilterRuleType', 'type': 'str'}, 'communities': {'key': 'properties.communities', 'type': '[str]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(RouteFilterRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.location = kwargs.get('location', None) self.etag = None self.access = kwargs.get('access', None) self.route_filter_rule_type = kwargs.get('route_filter_rule_type', None) self.communities = kwargs.get('communities', None) self.provisioning_state = None class RouteFilterRuleListResult(msrest.serialization.Model): """Response for the ListRouteFilterRules API service call. :param value: A list of RouteFilterRules in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.RouteFilterRule] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[RouteFilterRule]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(RouteFilterRuleListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class RouteListResult(msrest.serialization.Model): """Response for the ListRoute API service call. :param value: A list of routes in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.Route] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[Route]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(RouteListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class RouteTable(Resource): """Route table resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param routes: Collection of routes contained within a route table. :type routes: list[~azure.mgmt.network.v2020_04_01.models.Route] :ivar subnets: A collection of references to subnets. :vartype subnets: list[~azure.mgmt.network.v2020_04_01.models.Subnet] :param disable_bgp_route_propagation: Whether to disable the routes learned by BGP on that route table. True means disable. :type disable_bgp_route_propagation: bool :ivar provisioning_state: The provisioning state of the route table resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'subnets': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'routes': {'key': 'properties.routes', 'type': '[Route]'}, 'subnets': {'key': 'properties.subnets', 'type': '[Subnet]'}, 'disable_bgp_route_propagation': {'key': 'properties.disableBgpRoutePropagation', 'type': 'bool'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(RouteTable, self).__init__(**kwargs) self.etag = None self.routes = kwargs.get('routes', None) self.subnets = None self.disable_bgp_route_propagation = kwargs.get('disable_bgp_route_propagation', None) self.provisioning_state = None class RouteTableListResult(msrest.serialization.Model): """Response for the ListRouteTable API service call. :param value: A list of route tables in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.RouteTable] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[RouteTable]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(RouteTableListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class RoutingConfiguration(msrest.serialization.Model): """Routing Configuration indicating the associated and propagated route tables for this connection. :param associated_route_table: The resource id RouteTable associated with this RoutingConfiguration. :type associated_route_table: ~azure.mgmt.network.v2020_04_01.models.SubResource :param propagated_route_tables: The list of RouteTables to advertise the routes to. :type propagated_route_tables: ~azure.mgmt.network.v2020_04_01.models.PropagatedRouteTable :param vnet_routes: List of routes that control routing from VirtualHub into a virtual network connection. :type vnet_routes: ~azure.mgmt.network.v2020_04_01.models.VnetRoute """ _attribute_map = { 'associated_route_table': {'key': 'associatedRouteTable', 'type': 'SubResource'}, 'propagated_route_tables': {'key': 'propagatedRouteTables', 'type': 'PropagatedRouteTable'}, 'vnet_routes': {'key': 'vnetRoutes', 'type': 'VnetRoute'}, } def __init__( self, **kwargs ): super(RoutingConfiguration, self).__init__(**kwargs) self.associated_route_table = kwargs.get('associated_route_table', None) self.propagated_route_tables = kwargs.get('propagated_route_tables', None) self.vnet_routes = kwargs.get('vnet_routes', None) class SecurityGroupNetworkInterface(msrest.serialization.Model): """Network interface and all its associated security rules. :param id: ID of the network interface. :type id: str :param security_rule_associations: All security rules associated with the network interface. :type security_rule_associations: ~azure.mgmt.network.v2020_04_01.models.SecurityRuleAssociations """ _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'security_rule_associations': {'key': 'securityRuleAssociations', 'type': 'SecurityRuleAssociations'}, } def __init__( self, **kwargs ): super(SecurityGroupNetworkInterface, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.security_rule_associations = kwargs.get('security_rule_associations', None) class SecurityGroupViewParameters(msrest.serialization.Model): """Parameters that define the VM to check security groups for. All required parameters must be populated in order to send to Azure. :param target_resource_id: Required. ID of the target VM. :type target_resource_id: str """ _validation = { 'target_resource_id': {'required': True}, } _attribute_map = { 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, } def __init__( self, **kwargs ): super(SecurityGroupViewParameters, self).__init__(**kwargs) self.target_resource_id = kwargs['target_resource_id'] class SecurityGroupViewResult(msrest.serialization.Model): """The information about security rules applied to the specified VM. :param network_interfaces: List of network interfaces on the specified VM. :type network_interfaces: list[~azure.mgmt.network.v2020_04_01.models.SecurityGroupNetworkInterface] """ _attribute_map = { 'network_interfaces': {'key': 'networkInterfaces', 'type': '[SecurityGroupNetworkInterface]'}, } def __init__( self, **kwargs ): super(SecurityGroupViewResult, self).__init__(**kwargs) self.network_interfaces = kwargs.get('network_interfaces', None) class SecurityPartnerProvider(Resource): """Security Partner Provider resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar provisioning_state: The provisioning state of the Security Partner Provider resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param security_provider_name: The security provider name. Possible values include: "ZScaler", "IBoss", "Checkpoint". :type security_provider_name: str or ~azure.mgmt.network.v2020_04_01.models.SecurityProviderName :ivar connection_status: The connection status with the Security Partner Provider. Possible values include: "Unknown", "PartiallyConnected", "Connected", "NotConnected". :vartype connection_status: str or ~azure.mgmt.network.v2020_04_01.models.SecurityPartnerProviderConnectionStatus :param virtual_hub: The virtualHub to which the Security Partner Provider belongs. :type virtual_hub: ~azure.mgmt.network.v2020_04_01.models.SubResource """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'connection_status': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'security_provider_name': {'key': 'properties.securityProviderName', 'type': 'str'}, 'connection_status': {'key': 'properties.connectionStatus', 'type': 'str'}, 'virtual_hub': {'key': 'properties.virtualHub', 'type': 'SubResource'}, } def __init__( self, **kwargs ): super(SecurityPartnerProvider, self).__init__(**kwargs) self.etag = None self.provisioning_state = None self.security_provider_name = kwargs.get('security_provider_name', None) self.connection_status = None self.virtual_hub = kwargs.get('virtual_hub', None) class SecurityPartnerProviderListResult(msrest.serialization.Model): """Response for ListSecurityPartnerProviders API service call. :param value: List of Security Partner Providers in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.SecurityPartnerProvider] :param next_link: URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[SecurityPartnerProvider]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(SecurityPartnerProviderListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class SecurityRule(SubResource): """Network security rule. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param description: A description for this rule. Restricted to 140 chars. :type description: str :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "*", "Ah". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.SecurityRuleProtocol :param source_port_range: The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. :type source_port_range: str :param destination_port_range: The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. :type destination_port_range: str :param source_address_prefix: The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. :type source_address_prefix: str :param source_address_prefixes: The CIDR or source IP ranges. :type source_address_prefixes: list[str] :param source_application_security_groups: The application security group specified as source. :type source_application_security_groups: list[~azure.mgmt.network.v2020_04_01.models.ApplicationSecurityGroup] :param destination_address_prefix: The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. :type destination_address_prefix: str :param destination_address_prefixes: The destination address prefixes. CIDR or destination IP ranges. :type destination_address_prefixes: list[str] :param destination_application_security_groups: The application security group specified as destination. :type destination_application_security_groups: list[~azure.mgmt.network.v2020_04_01.models.ApplicationSecurityGroup] :param source_port_ranges: The source port ranges. :type source_port_ranges: list[str] :param destination_port_ranges: The destination port ranges. :type destination_port_ranges: list[str] :param access: The network traffic is allowed or denied. Possible values include: "Allow", "Deny". :type access: str or ~azure.mgmt.network.v2020_04_01.models.SecurityRuleAccess :param priority: The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. :type priority: int :param direction: The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values include: "Inbound", "Outbound". :type direction: str or ~azure.mgmt.network.v2020_04_01.models.SecurityRuleDirection :ivar provisioning_state: The provisioning state of the security rule resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, 'source_port_range': {'key': 'properties.sourcePortRange', 'type': 'str'}, 'destination_port_range': {'key': 'properties.destinationPortRange', 'type': 'str'}, 'source_address_prefix': {'key': 'properties.sourceAddressPrefix', 'type': 'str'}, 'source_address_prefixes': {'key': 'properties.sourceAddressPrefixes', 'type': '[str]'}, 'source_application_security_groups': {'key': 'properties.sourceApplicationSecurityGroups', 'type': '[ApplicationSecurityGroup]'}, 'destination_address_prefix': {'key': 'properties.destinationAddressPrefix', 'type': 'str'}, 'destination_address_prefixes': {'key': 'properties.destinationAddressPrefixes', 'type': '[str]'}, 'destination_application_security_groups': {'key': 'properties.destinationApplicationSecurityGroups', 'type': '[ApplicationSecurityGroup]'}, 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, 'access': {'key': 'properties.access', 'type': 'str'}, 'priority': {'key': 'properties.priority', 'type': 'int'}, 'direction': {'key': 'properties.direction', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(SecurityRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.description = kwargs.get('description', None) self.protocol = kwargs.get('protocol', None) self.source_port_range = kwargs.get('source_port_range', None) self.destination_port_range = kwargs.get('destination_port_range', None) self.source_address_prefix = kwargs.get('source_address_prefix', None) self.source_address_prefixes = kwargs.get('source_address_prefixes', None) self.source_application_security_groups = kwargs.get('source_application_security_groups', None) self.destination_address_prefix = kwargs.get('destination_address_prefix', None) self.destination_address_prefixes = kwargs.get('destination_address_prefixes', None) self.destination_application_security_groups = kwargs.get('destination_application_security_groups', None) self.source_port_ranges = kwargs.get('source_port_ranges', None) self.destination_port_ranges = kwargs.get('destination_port_ranges', None) self.access = kwargs.get('access', None) self.priority = kwargs.get('priority', None) self.direction = kwargs.get('direction', None) self.provisioning_state = None class SecurityRuleAssociations(msrest.serialization.Model): """All security rules associated with the network interface. :param network_interface_association: Network interface and it's custom security rules. :type network_interface_association: ~azure.mgmt.network.v2020_04_01.models.NetworkInterfaceAssociation :param subnet_association: Subnet and it's custom security rules. :type subnet_association: ~azure.mgmt.network.v2020_04_01.models.SubnetAssociation :param default_security_rules: Collection of default security rules of the network security group. :type default_security_rules: list[~azure.mgmt.network.v2020_04_01.models.SecurityRule] :param effective_security_rules: Collection of effective security rules. :type effective_security_rules: list[~azure.mgmt.network.v2020_04_01.models.EffectiveNetworkSecurityRule] """ _attribute_map = { 'network_interface_association': {'key': 'networkInterfaceAssociation', 'type': 'NetworkInterfaceAssociation'}, 'subnet_association': {'key': 'subnetAssociation', 'type': 'SubnetAssociation'}, 'default_security_rules': {'key': 'defaultSecurityRules', 'type': '[SecurityRule]'}, 'effective_security_rules': {'key': 'effectiveSecurityRules', 'type': '[EffectiveNetworkSecurityRule]'}, } def __init__( self, **kwargs ): super(SecurityRuleAssociations, self).__init__(**kwargs) self.network_interface_association = kwargs.get('network_interface_association', None) self.subnet_association = kwargs.get('subnet_association', None) self.default_security_rules = kwargs.get('default_security_rules', None) self.effective_security_rules = kwargs.get('effective_security_rules', None) class SecurityRuleListResult(msrest.serialization.Model): """Response for ListSecurityRule API service call. Retrieves all security rules that belongs to a network security group. :param value: The security rules in a network security group. :type value: list[~azure.mgmt.network.v2020_04_01.models.SecurityRule] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[SecurityRule]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(SecurityRuleListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ServiceAssociationLink(SubResource): """ServiceAssociationLink resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Resource type. :vartype type: str :param linked_resource_type: Resource type of the linked resource. :type linked_resource_type: str :param link: Link to the external resource. :type link: str :ivar provisioning_state: The provisioning state of the service association link resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param allow_delete: If true, the resource can be deleted. :type allow_delete: bool :param locations: A list of locations. :type locations: list[str] """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'linked_resource_type': {'key': 'properties.linkedResourceType', 'type': 'str'}, 'link': {'key': 'properties.link', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'allow_delete': {'key': 'properties.allowDelete', 'type': 'bool'}, 'locations': {'key': 'properties.locations', 'type': '[str]'}, } def __init__( self, **kwargs ): super(ServiceAssociationLink, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.linked_resource_type = kwargs.get('linked_resource_type', None) self.link = kwargs.get('link', None) self.provisioning_state = None self.allow_delete = kwargs.get('allow_delete', None) self.locations = kwargs.get('locations', None) class ServiceAssociationLinksListResult(msrest.serialization.Model): """Response for ServiceAssociationLinks_List operation. Variables are only populated by the server, and will be ignored when sending a request. :param value: The service association links in a subnet. :type value: list[~azure.mgmt.network.v2020_04_01.models.ServiceAssociationLink] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[ServiceAssociationLink]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ServiceAssociationLinksListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class ServiceEndpointPolicy(Resource): """Service End point policy resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param service_endpoint_policy_definitions: A collection of service endpoint policy definitions of the service endpoint policy. :type service_endpoint_policy_definitions: list[~azure.mgmt.network.v2020_04_01.models.ServiceEndpointPolicyDefinition] :ivar subnets: A collection of references to subnets. :vartype subnets: list[~azure.mgmt.network.v2020_04_01.models.Subnet] :ivar resource_guid: The resource GUID property of the service endpoint policy resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the service endpoint policy resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'subnets': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'service_endpoint_policy_definitions': {'key': 'properties.serviceEndpointPolicyDefinitions', 'type': '[ServiceEndpointPolicyDefinition]'}, 'subnets': {'key': 'properties.subnets', 'type': '[Subnet]'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ServiceEndpointPolicy, self).__init__(**kwargs) self.etag = None self.service_endpoint_policy_definitions = kwargs.get('service_endpoint_policy_definitions', None) self.subnets = None self.resource_guid = None self.provisioning_state = None class ServiceEndpointPolicyDefinition(SubResource): """Service Endpoint policy definitions. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param description: A description for this rule. Restricted to 140 chars. :type description: str :param service: Service endpoint name. :type service: str :param service_resources: A list of service resources. :type service_resources: list[str] :ivar provisioning_state: The provisioning state of the service endpoint policy definition resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'service': {'key': 'properties.service', 'type': 'str'}, 'service_resources': {'key': 'properties.serviceResources', 'type': '[str]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ServiceEndpointPolicyDefinition, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.description = kwargs.get('description', None) self.service = kwargs.get('service', None) self.service_resources = kwargs.get('service_resources', None) self.provisioning_state = None class ServiceEndpointPolicyDefinitionListResult(msrest.serialization.Model): """Response for ListServiceEndpointPolicyDefinition API service call. Retrieves all service endpoint policy definition that belongs to a service endpoint policy. :param value: The service endpoint policy definition in a service endpoint policy. :type value: list[~azure.mgmt.network.v2020_04_01.models.ServiceEndpointPolicyDefinition] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[ServiceEndpointPolicyDefinition]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ServiceEndpointPolicyDefinitionListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class ServiceEndpointPolicyListResult(msrest.serialization.Model): """Response for ListServiceEndpointPolicies API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of ServiceEndpointPolicy resources. :type value: list[~azure.mgmt.network.v2020_04_01.models.ServiceEndpointPolicy] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[ServiceEndpointPolicy]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(ServiceEndpointPolicyListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class ServiceEndpointPropertiesFormat(msrest.serialization.Model): """The service endpoint properties. Variables are only populated by the server, and will be ignored when sending a request. :param service: The type of the endpoint service. :type service: str :param locations: A list of locations. :type locations: list[str] :ivar provisioning_state: The provisioning state of the service endpoint resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'provisioning_state': {'readonly': True}, } _attribute_map = { 'service': {'key': 'service', 'type': 'str'}, 'locations': {'key': 'locations', 'type': '[str]'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(ServiceEndpointPropertiesFormat, self).__init__(**kwargs) self.service = kwargs.get('service', None) self.locations = kwargs.get('locations', None) self.provisioning_state = None class ServiceTagInformation(msrest.serialization.Model): """The service tag information. Variables are only populated by the server, and will be ignored when sending a request. :ivar properties: Properties of the service tag information. :vartype properties: ~azure.mgmt.network.v2020_04_01.models.ServiceTagInformationPropertiesFormat :ivar name: The name of service tag. :vartype name: str :ivar id: The ID of service tag. :vartype id: str """ _validation = { 'properties': {'readonly': True}, 'name': {'readonly': True}, 'id': {'readonly': True}, } _attribute_map = { 'properties': {'key': 'properties', 'type': 'ServiceTagInformationPropertiesFormat'}, 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, **kwargs ): super(ServiceTagInformation, self).__init__(**kwargs) self.properties = None self.name = None self.id = None class ServiceTagInformationPropertiesFormat(msrest.serialization.Model): """Properties of the service tag information. Variables are only populated by the server, and will be ignored when sending a request. :ivar change_number: The iteration number of service tag. :vartype change_number: str :ivar region: The region of service tag. :vartype region: str :ivar system_service: The name of system service. :vartype system_service: str :ivar address_prefixes: The list of IP address prefixes. :vartype address_prefixes: list[str] """ _validation = { 'change_number': {'readonly': True}, 'region': {'readonly': True}, 'system_service': {'readonly': True}, 'address_prefixes': {'readonly': True}, } _attribute_map = { 'change_number': {'key': 'changeNumber', 'type': 'str'}, 'region': {'key': 'region', 'type': 'str'}, 'system_service': {'key': 'systemService', 'type': 'str'}, 'address_prefixes': {'key': 'addressPrefixes', 'type': '[str]'}, } def __init__( self, **kwargs ): super(ServiceTagInformationPropertiesFormat, self).__init__(**kwargs) self.change_number = None self.region = None self.system_service = None self.address_prefixes = None class ServiceTagsListResult(msrest.serialization.Model): """Response for the ListServiceTags API service call. Variables are only populated by the server, and will be ignored when sending a request. :ivar name: The name of the cloud. :vartype name: str :ivar id: The ID of the cloud. :vartype id: str :ivar type: The azure resource type. :vartype type: str :ivar change_number: The iteration number. :vartype change_number: str :ivar cloud: The name of the cloud. :vartype cloud: str :ivar values: The list of service tag information resources. :vartype values: list[~azure.mgmt.network.v2020_04_01.models.ServiceTagInformation] """ _validation = { 'name': {'readonly': True}, 'id': {'readonly': True}, 'type': {'readonly': True}, 'change_number': {'readonly': True}, 'cloud': {'readonly': True}, 'values': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'change_number': {'key': 'changeNumber', 'type': 'str'}, 'cloud': {'key': 'cloud', 'type': 'str'}, 'values': {'key': 'values', 'type': '[ServiceTagInformation]'}, } def __init__( self, **kwargs ): super(ServiceTagsListResult, self).__init__(**kwargs) self.name = None self.id = None self.type = None self.change_number = None self.cloud = None self.values = None class SessionIds(msrest.serialization.Model): """List of session IDs. :param session_ids: List of session IDs. :type session_ids: list[str] """ _attribute_map = { 'session_ids': {'key': 'sessionIds', 'type': '[str]'}, } def __init__( self, **kwargs ): super(SessionIds, self).__init__(**kwargs) self.session_ids = kwargs.get('session_ids', None) class StaticRoute(msrest.serialization.Model): """List of all Static Routes. :param name: The name of the StaticRoute that is unique within a VnetRoute. :type name: str :param address_prefixes: List of all address prefixes. :type address_prefixes: list[str] :param next_hop_ip_address: The ip address of the next hop. :type next_hop_ip_address: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'address_prefixes': {'key': 'addressPrefixes', 'type': '[str]'}, 'next_hop_ip_address': {'key': 'nextHopIpAddress', 'type': 'str'}, } def __init__( self, **kwargs ): super(StaticRoute, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.address_prefixes = kwargs.get('address_prefixes', None) self.next_hop_ip_address = kwargs.get('next_hop_ip_address', None) class Subnet(SubResource): """Subnet in a virtual network resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param address_prefix: The address prefix for the subnet. :type address_prefix: str :param address_prefixes: List of address prefixes for the subnet. :type address_prefixes: list[str] :param network_security_group: The reference to the NetworkSecurityGroup resource. :type network_security_group: ~azure.mgmt.network.v2020_04_01.models.NetworkSecurityGroup :param route_table: The reference to the RouteTable resource. :type route_table: ~azure.mgmt.network.v2020_04_01.models.RouteTable :param nat_gateway: Nat gateway associated with this subnet. :type nat_gateway: ~azure.mgmt.network.v2020_04_01.models.SubResource :param service_endpoints: An array of service endpoints. :type service_endpoints: list[~azure.mgmt.network.v2020_04_01.models.ServiceEndpointPropertiesFormat] :param service_endpoint_policies: An array of service endpoint policies. :type service_endpoint_policies: list[~azure.mgmt.network.v2020_04_01.models.ServiceEndpointPolicy] :ivar private_endpoints: An array of references to private endpoints. :vartype private_endpoints: list[~azure.mgmt.network.v2020_04_01.models.PrivateEndpoint] :ivar ip_configurations: An array of references to the network interface IP configurations using subnet. :vartype ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.IPConfiguration] :ivar ip_configuration_profiles: Array of IP configuration profiles which reference this subnet. :vartype ip_configuration_profiles: list[~azure.mgmt.network.v2020_04_01.models.IPConfigurationProfile] :param ip_allocations: Array of IpAllocation which reference this subnet. :type ip_allocations: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar resource_navigation_links: An array of references to the external resources using subnet. :vartype resource_navigation_links: list[~azure.mgmt.network.v2020_04_01.models.ResourceNavigationLink] :ivar service_association_links: An array of references to services injecting into this subnet. :vartype service_association_links: list[~azure.mgmt.network.v2020_04_01.models.ServiceAssociationLink] :param delegations: An array of references to the delegations on the subnet. :type delegations: list[~azure.mgmt.network.v2020_04_01.models.Delegation] :ivar purpose: A read-only string identifying the intention of use for this subnet based on delegations and other user-defined properties. :vartype purpose: str :ivar provisioning_state: The provisioning state of the subnet resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param private_endpoint_network_policies: Enable or Disable apply network policies on private end point in the subnet. :type private_endpoint_network_policies: str :param private_link_service_network_policies: Enable or Disable apply network policies on private link service in the subnet. :type private_link_service_network_policies: str """ _validation = { 'etag': {'readonly': True}, 'private_endpoints': {'readonly': True}, 'ip_configurations': {'readonly': True}, 'ip_configuration_profiles': {'readonly': True}, 'resource_navigation_links': {'readonly': True}, 'service_association_links': {'readonly': True}, 'purpose': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'address_prefix': {'key': 'properties.addressPrefix', 'type': 'str'}, 'address_prefixes': {'key': 'properties.addressPrefixes', 'type': '[str]'}, 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'NetworkSecurityGroup'}, 'route_table': {'key': 'properties.routeTable', 'type': 'RouteTable'}, 'nat_gateway': {'key': 'properties.natGateway', 'type': 'SubResource'}, 'service_endpoints': {'key': 'properties.serviceEndpoints', 'type': '[ServiceEndpointPropertiesFormat]'}, 'service_endpoint_policies': {'key': 'properties.serviceEndpointPolicies', 'type': '[ServiceEndpointPolicy]'}, 'private_endpoints': {'key': 'properties.privateEndpoints', 'type': '[PrivateEndpoint]'}, 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[IPConfiguration]'}, 'ip_configuration_profiles': {'key': 'properties.ipConfigurationProfiles', 'type': '[IPConfigurationProfile]'}, 'ip_allocations': {'key': 'properties.ipAllocations', 'type': '[SubResource]'}, 'resource_navigation_links': {'key': 'properties.resourceNavigationLinks', 'type': '[ResourceNavigationLink]'}, 'service_association_links': {'key': 'properties.serviceAssociationLinks', 'type': '[ServiceAssociationLink]'}, 'delegations': {'key': 'properties.delegations', 'type': '[Delegation]'}, 'purpose': {'key': 'properties.purpose', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'private_endpoint_network_policies': {'key': 'properties.privateEndpointNetworkPolicies', 'type': 'str'}, 'private_link_service_network_policies': {'key': 'properties.privateLinkServiceNetworkPolicies', 'type': 'str'}, } def __init__( self, **kwargs ): super(Subnet, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.address_prefix = kwargs.get('address_prefix', None) self.address_prefixes = kwargs.get('address_prefixes', None) self.network_security_group = kwargs.get('network_security_group', None) self.route_table = kwargs.get('route_table', None) self.nat_gateway = kwargs.get('nat_gateway', None) self.service_endpoints = kwargs.get('service_endpoints', None) self.service_endpoint_policies = kwargs.get('service_endpoint_policies', None) self.private_endpoints = None self.ip_configurations = None self.ip_configuration_profiles = None self.ip_allocations = kwargs.get('ip_allocations', None) self.resource_navigation_links = None self.service_association_links = None self.delegations = kwargs.get('delegations', None) self.purpose = None self.provisioning_state = None self.private_endpoint_network_policies = kwargs.get('private_endpoint_network_policies', None) self.private_link_service_network_policies = kwargs.get('private_link_service_network_policies', None) class SubnetAssociation(msrest.serialization.Model): """Subnet and it's custom security rules. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Subnet ID. :vartype id: str :param security_rules: Collection of custom security rules. :type security_rules: list[~azure.mgmt.network.v2020_04_01.models.SecurityRule] """ _validation = { 'id': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'security_rules': {'key': 'securityRules', 'type': '[SecurityRule]'}, } def __init__( self, **kwargs ): super(SubnetAssociation, self).__init__(**kwargs) self.id = None self.security_rules = kwargs.get('security_rules', None) class SubnetListResult(msrest.serialization.Model): """Response for ListSubnets API service callRetrieves all subnet that belongs to a virtual network. :param value: The subnets in a virtual network. :type value: list[~azure.mgmt.network.v2020_04_01.models.Subnet] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[Subnet]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(SubnetListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class TagsObject(msrest.serialization.Model): """Tags object for patch operations. :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__( self, **kwargs ): super(TagsObject, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) class Topology(msrest.serialization.Model): """Topology of the specified resource group. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: GUID representing the operation id. :vartype id: str :ivar created_date_time: The datetime when the topology was initially created for the resource group. :vartype created_date_time: ~datetime.datetime :ivar last_modified: The datetime when the topology was last modified. :vartype last_modified: ~datetime.datetime :param resources: A list of topology resources. :type resources: list[~azure.mgmt.network.v2020_04_01.models.TopologyResource] """ _validation = { 'id': {'readonly': True}, 'created_date_time': {'readonly': True}, 'last_modified': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, 'resources': {'key': 'resources', 'type': '[TopologyResource]'}, } def __init__( self, **kwargs ): super(Topology, self).__init__(**kwargs) self.id = None self.created_date_time = None self.last_modified = None self.resources = kwargs.get('resources', None) class TopologyAssociation(msrest.serialization.Model): """Resources that have an association with the parent resource. :param name: The name of the resource that is associated with the parent resource. :type name: str :param resource_id: The ID of the resource that is associated with the parent resource. :type resource_id: str :param association_type: The association type of the child resource to the parent resource. Possible values include: "Associated", "Contains". :type association_type: str or ~azure.mgmt.network.v2020_04_01.models.AssociationType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'association_type': {'key': 'associationType', 'type': 'str'}, } def __init__( self, **kwargs ): super(TopologyAssociation, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.resource_id = kwargs.get('resource_id', None) self.association_type = kwargs.get('association_type', None) class TopologyParameters(msrest.serialization.Model): """Parameters that define the representation of topology. :param target_resource_group_name: The name of the target resource group to perform topology on. :type target_resource_group_name: str :param target_virtual_network: The reference to the Virtual Network resource. :type target_virtual_network: ~azure.mgmt.network.v2020_04_01.models.SubResource :param target_subnet: The reference to the Subnet resource. :type target_subnet: ~azure.mgmt.network.v2020_04_01.models.SubResource """ _attribute_map = { 'target_resource_group_name': {'key': 'targetResourceGroupName', 'type': 'str'}, 'target_virtual_network': {'key': 'targetVirtualNetwork', 'type': 'SubResource'}, 'target_subnet': {'key': 'targetSubnet', 'type': 'SubResource'}, } def __init__( self, **kwargs ): super(TopologyParameters, self).__init__(**kwargs) self.target_resource_group_name = kwargs.get('target_resource_group_name', None) self.target_virtual_network = kwargs.get('target_virtual_network', None) self.target_subnet = kwargs.get('target_subnet', None) class TopologyResource(msrest.serialization.Model): """The network resource topology information for the given resource group. :param name: Name of the resource. :type name: str :param id: ID of the resource. :type id: str :param location: Resource location. :type location: str :param associations: Holds the associations the resource has with other resources in the resource group. :type associations: list[~azure.mgmt.network.v2020_04_01.models.TopologyAssociation] """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'associations': {'key': 'associations', 'type': '[TopologyAssociation]'}, } def __init__( self, **kwargs ): super(TopologyResource, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.id = kwargs.get('id', None) self.location = kwargs.get('location', None) self.associations = kwargs.get('associations', None) class TrafficAnalyticsConfigurationProperties(msrest.serialization.Model): """Parameters that define the configuration of traffic analytics. :param enabled: Flag to enable/disable traffic analytics. :type enabled: bool :param workspace_id: The resource guid of the attached workspace. :type workspace_id: str :param workspace_region: The location of the attached workspace. :type workspace_region: str :param workspace_resource_id: Resource Id of the attached workspace. :type workspace_resource_id: str :param traffic_analytics_interval: The interval in minutes which would decide how frequently TA service should do flow analytics. :type traffic_analytics_interval: int """ _attribute_map = { 'enabled': {'key': 'enabled', 'type': 'bool'}, 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, 'workspace_region': {'key': 'workspaceRegion', 'type': 'str'}, 'workspace_resource_id': {'key': 'workspaceResourceId', 'type': 'str'}, 'traffic_analytics_interval': {'key': 'trafficAnalyticsInterval', 'type': 'int'}, } def __init__( self, **kwargs ): super(TrafficAnalyticsConfigurationProperties, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.workspace_id = kwargs.get('workspace_id', None) self.workspace_region = kwargs.get('workspace_region', None) self.workspace_resource_id = kwargs.get('workspace_resource_id', None) self.traffic_analytics_interval = kwargs.get('traffic_analytics_interval', None) class TrafficAnalyticsProperties(msrest.serialization.Model): """Parameters that define the configuration of traffic analytics. :param network_watcher_flow_analytics_configuration: Parameters that define the configuration of traffic analytics. :type network_watcher_flow_analytics_configuration: ~azure.mgmt.network.v2020_04_01.models.TrafficAnalyticsConfigurationProperties """ _attribute_map = { 'network_watcher_flow_analytics_configuration': {'key': 'networkWatcherFlowAnalyticsConfiguration', 'type': 'TrafficAnalyticsConfigurationProperties'}, } def __init__( self, **kwargs ): super(TrafficAnalyticsProperties, self).__init__(**kwargs) self.network_watcher_flow_analytics_configuration = kwargs.get('network_watcher_flow_analytics_configuration', None) class TrafficSelectorPolicy(msrest.serialization.Model): """An traffic selector policy for a virtual network gateway connection. All required parameters must be populated in order to send to Azure. :param local_address_ranges: Required. A collection of local address spaces in CIDR format. :type local_address_ranges: list[str] :param remote_address_ranges: Required. A collection of remote address spaces in CIDR format. :type remote_address_ranges: list[str] """ _validation = { 'local_address_ranges': {'required': True}, 'remote_address_ranges': {'required': True}, } _attribute_map = { 'local_address_ranges': {'key': 'localAddressRanges', 'type': '[str]'}, 'remote_address_ranges': {'key': 'remoteAddressRanges', 'type': '[str]'}, } def __init__( self, **kwargs ): super(TrafficSelectorPolicy, self).__init__(**kwargs) self.local_address_ranges = kwargs['local_address_ranges'] self.remote_address_ranges = kwargs['remote_address_ranges'] class TroubleshootingDetails(msrest.serialization.Model): """Information gained from troubleshooting of specified resource. :param id: The id of the get troubleshoot operation. :type id: str :param reason_type: Reason type of failure. :type reason_type: str :param summary: A summary of troubleshooting. :type summary: str :param detail: Details on troubleshooting results. :type detail: str :param recommended_actions: List of recommended actions. :type recommended_actions: list[~azure.mgmt.network.v2020_04_01.models.TroubleshootingRecommendedActions] """ _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'reason_type': {'key': 'reasonType', 'type': 'str'}, 'summary': {'key': 'summary', 'type': 'str'}, 'detail': {'key': 'detail', 'type': 'str'}, 'recommended_actions': {'key': 'recommendedActions', 'type': '[TroubleshootingRecommendedActions]'}, } def __init__( self, **kwargs ): super(TroubleshootingDetails, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.reason_type = kwargs.get('reason_type', None) self.summary = kwargs.get('summary', None) self.detail = kwargs.get('detail', None) self.recommended_actions = kwargs.get('recommended_actions', None) class TroubleshootingParameters(msrest.serialization.Model): """Parameters that define the resource to troubleshoot. All required parameters must be populated in order to send to Azure. :param target_resource_id: Required. The target resource to troubleshoot. :type target_resource_id: str :param storage_id: Required. The ID for the storage account to save the troubleshoot result. :type storage_id: str :param storage_path: Required. The path to the blob to save the troubleshoot result in. :type storage_path: str """ _validation = { 'target_resource_id': {'required': True}, 'storage_id': {'required': True}, 'storage_path': {'required': True}, } _attribute_map = { 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, 'storage_id': {'key': 'properties.storageId', 'type': 'str'}, 'storage_path': {'key': 'properties.storagePath', 'type': 'str'}, } def __init__( self, **kwargs ): super(TroubleshootingParameters, self).__init__(**kwargs) self.target_resource_id = kwargs['target_resource_id'] self.storage_id = kwargs['storage_id'] self.storage_path = kwargs['storage_path'] class TroubleshootingRecommendedActions(msrest.serialization.Model): """Recommended actions based on discovered issues. :param action_id: ID of the recommended action. :type action_id: str :param action_text: Description of recommended actions. :type action_text: str :param action_uri: The uri linking to a documentation for the recommended troubleshooting actions. :type action_uri: str :param action_uri_text: The information from the URI for the recommended troubleshooting actions. :type action_uri_text: str """ _attribute_map = { 'action_id': {'key': 'actionId', 'type': 'str'}, 'action_text': {'key': 'actionText', 'type': 'str'}, 'action_uri': {'key': 'actionUri', 'type': 'str'}, 'action_uri_text': {'key': 'actionUriText', 'type': 'str'}, } def __init__( self, **kwargs ): super(TroubleshootingRecommendedActions, self).__init__(**kwargs) self.action_id = kwargs.get('action_id', None) self.action_text = kwargs.get('action_text', None) self.action_uri = kwargs.get('action_uri', None) self.action_uri_text = kwargs.get('action_uri_text', None) class TroubleshootingResult(msrest.serialization.Model): """Troubleshooting information gained from specified resource. :param start_time: The start time of the troubleshooting. :type start_time: ~datetime.datetime :param end_time: The end time of the troubleshooting. :type end_time: ~datetime.datetime :param code: The result code of the troubleshooting. :type code: str :param results: Information from troubleshooting. :type results: list[~azure.mgmt.network.v2020_04_01.models.TroubleshootingDetails] """ _attribute_map = { 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, 'code': {'key': 'code', 'type': 'str'}, 'results': {'key': 'results', 'type': '[TroubleshootingDetails]'}, } def __init__( self, **kwargs ): super(TroubleshootingResult, self).__init__(**kwargs) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) self.code = kwargs.get('code', None) self.results = kwargs.get('results', None) class TunnelConnectionHealth(msrest.serialization.Model): """VirtualNetworkGatewayConnection properties. Variables are only populated by the server, and will be ignored when sending a request. :ivar tunnel: Tunnel name. :vartype tunnel: str :ivar connection_status: Virtual Network Gateway connection status. Possible values include: "Unknown", "Connecting", "Connected", "NotConnected". :vartype connection_status: str or ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewayConnectionStatus :ivar ingress_bytes_transferred: The Ingress Bytes Transferred in this connection. :vartype ingress_bytes_transferred: long :ivar egress_bytes_transferred: The Egress Bytes Transferred in this connection. :vartype egress_bytes_transferred: long :ivar last_connection_established_utc_time: The time at which connection was established in Utc format. :vartype last_connection_established_utc_time: str """ _validation = { 'tunnel': {'readonly': True}, 'connection_status': {'readonly': True}, 'ingress_bytes_transferred': {'readonly': True}, 'egress_bytes_transferred': {'readonly': True}, 'last_connection_established_utc_time': {'readonly': True}, } _attribute_map = { 'tunnel': {'key': 'tunnel', 'type': 'str'}, 'connection_status': {'key': 'connectionStatus', 'type': 'str'}, 'ingress_bytes_transferred': {'key': 'ingressBytesTransferred', 'type': 'long'}, 'egress_bytes_transferred': {'key': 'egressBytesTransferred', 'type': 'long'}, 'last_connection_established_utc_time': {'key': 'lastConnectionEstablishedUtcTime', 'type': 'str'}, } def __init__( self, **kwargs ): super(TunnelConnectionHealth, self).__init__(**kwargs) self.tunnel = None self.connection_status = None self.ingress_bytes_transferred = None self.egress_bytes_transferred = None self.last_connection_established_utc_time = None class UnprepareNetworkPoliciesRequest(msrest.serialization.Model): """Details of UnprepareNetworkPolicies for Subnet. :param service_name: The name of the service for which subnet is being unprepared for. :type service_name: str """ _attribute_map = { 'service_name': {'key': 'serviceName', 'type': 'str'}, } def __init__( self, **kwargs ): super(UnprepareNetworkPoliciesRequest, self).__init__(**kwargs) self.service_name = kwargs.get('service_name', None) class Usage(msrest.serialization.Model): """The network resource usage. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :ivar id: Resource identifier. :vartype id: str :param unit: Required. An enum describing the unit of measurement. Possible values include: "Count". :type unit: str or ~azure.mgmt.network.v2020_04_01.models.UsageUnit :param current_value: Required. The current value of the usage. :type current_value: long :param limit: Required. The limit of usage. :type limit: long :param name: Required. The name of the type of usage. :type name: ~azure.mgmt.network.v2020_04_01.models.UsageName """ _validation = { 'id': {'readonly': True}, 'unit': {'required': True}, 'current_value': {'required': True}, 'limit': {'required': True}, 'name': {'required': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'current_value': {'key': 'currentValue', 'type': 'long'}, 'limit': {'key': 'limit', 'type': 'long'}, 'name': {'key': 'name', 'type': 'UsageName'}, } def __init__( self, **kwargs ): super(Usage, self).__init__(**kwargs) self.id = None self.unit = kwargs['unit'] self.current_value = kwargs['current_value'] self.limit = kwargs['limit'] self.name = kwargs['name'] class UsageName(msrest.serialization.Model): """The usage names. :param value: A string describing the resource name. :type value: str :param localized_value: A localized string describing the resource name. :type localized_value: str """ _attribute_map = { 'value': {'key': 'value', 'type': 'str'}, 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } def __init__( self, **kwargs ): super(UsageName, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.localized_value = kwargs.get('localized_value', None) class UsagesListResult(msrest.serialization.Model): """The list usages operation response. :param value: The list network resource usages. :type value: list[~azure.mgmt.network.v2020_04_01.models.Usage] :param next_link: URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[Usage]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(UsagesListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class VerificationIPFlowParameters(msrest.serialization.Model): """Parameters that define the IP flow to be verified. All required parameters must be populated in order to send to Azure. :param target_resource_id: Required. The ID of the target resource to perform next-hop on. :type target_resource_id: str :param direction: Required. The direction of the packet represented as a 5-tuple. Possible values include: "Inbound", "Outbound". :type direction: str or ~azure.mgmt.network.v2020_04_01.models.Direction :param protocol: Required. Protocol to be verified on. Possible values include: "TCP", "UDP". :type protocol: str or ~azure.mgmt.network.v2020_04_01.models.IpFlowProtocol :param local_port: Required. The local port. Acceptable values are a single integer in the range (0-65535). Support for * for the source port, which depends on the direction. :type local_port: str :param remote_port: Required. The remote port. Acceptable values are a single integer in the range (0-65535). Support for * for the source port, which depends on the direction. :type remote_port: str :param local_ip_address: Required. The local IP address. Acceptable values are valid IPv4 addresses. :type local_ip_address: str :param remote_ip_address: Required. The remote IP address. Acceptable values are valid IPv4 addresses. :type remote_ip_address: str :param target_nic_resource_id: The NIC ID. (If VM has multiple NICs and IP forwarding is enabled on any of them, then this parameter must be specified. Otherwise optional). :type target_nic_resource_id: str """ _validation = { 'target_resource_id': {'required': True}, 'direction': {'required': True}, 'protocol': {'required': True}, 'local_port': {'required': True}, 'remote_port': {'required': True}, 'local_ip_address': {'required': True}, 'remote_ip_address': {'required': True}, } _attribute_map = { 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, 'direction': {'key': 'direction', 'type': 'str'}, 'protocol': {'key': 'protocol', 'type': 'str'}, 'local_port': {'key': 'localPort', 'type': 'str'}, 'remote_port': {'key': 'remotePort', 'type': 'str'}, 'local_ip_address': {'key': 'localIPAddress', 'type': 'str'}, 'remote_ip_address': {'key': 'remoteIPAddress', 'type': 'str'}, 'target_nic_resource_id': {'key': 'targetNicResourceId', 'type': 'str'}, } def __init__( self, **kwargs ): super(VerificationIPFlowParameters, self).__init__(**kwargs) self.target_resource_id = kwargs['target_resource_id'] self.direction = kwargs['direction'] self.protocol = kwargs['protocol'] self.local_port = kwargs['local_port'] self.remote_port = kwargs['remote_port'] self.local_ip_address = kwargs['local_ip_address'] self.remote_ip_address = kwargs['remote_ip_address'] self.target_nic_resource_id = kwargs.get('target_nic_resource_id', None) class VerificationIPFlowResult(msrest.serialization.Model): """Results of IP flow verification on the target resource. :param access: Indicates whether the traffic is allowed or denied. Possible values include: "Allow", "Deny". :type access: str or ~azure.mgmt.network.v2020_04_01.models.Access :param rule_name: Name of the rule. If input is not matched against any security rule, it is not displayed. :type rule_name: str """ _attribute_map = { 'access': {'key': 'access', 'type': 'str'}, 'rule_name': {'key': 'ruleName', 'type': 'str'}, } def __init__( self, **kwargs ): super(VerificationIPFlowResult, self).__init__(**kwargs) self.access = kwargs.get('access', None) self.rule_name = kwargs.get('rule_name', None) class VirtualApplianceNicProperties(msrest.serialization.Model): """Network Virtual Appliance NIC properties. Variables are only populated by the server, and will be ignored when sending a request. :ivar name: NIC name. :vartype name: str :ivar public_ip_address: Public IP address. :vartype public_ip_address: str :ivar private_ip_address: Private IP address. :vartype private_ip_address: str """ _validation = { 'name': {'readonly': True}, 'public_ip_address': {'readonly': True}, 'private_ip_address': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'public_ip_address': {'key': 'publicIpAddress', 'type': 'str'}, 'private_ip_address': {'key': 'privateIpAddress', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualApplianceNicProperties, self).__init__(**kwargs) self.name = None self.public_ip_address = None self.private_ip_address = None class VirtualApplianceSkuProperties(msrest.serialization.Model): """Network Virtual Appliance Sku Properties. :param vendor: Virtual Appliance Vendor. :type vendor: str :param bundled_scale_unit: Virtual Appliance Scale Unit. :type bundled_scale_unit: str :param market_place_version: Virtual Appliance Version. :type market_place_version: str """ _attribute_map = { 'vendor': {'key': 'vendor', 'type': 'str'}, 'bundled_scale_unit': {'key': 'bundledScaleUnit', 'type': 'str'}, 'market_place_version': {'key': 'marketPlaceVersion', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualApplianceSkuProperties, self).__init__(**kwargs) self.vendor = kwargs.get('vendor', None) self.bundled_scale_unit = kwargs.get('bundled_scale_unit', None) self.market_place_version = kwargs.get('market_place_version', None) class VirtualHub(Resource): """VirtualHub Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param virtual_wan: The VirtualWAN to which the VirtualHub belongs. :type virtual_wan: ~azure.mgmt.network.v2020_04_01.models.SubResource :param vpn_gateway: The VpnGateway associated with this VirtualHub. :type vpn_gateway: ~azure.mgmt.network.v2020_04_01.models.SubResource :param p2_s_vpn_gateway: The P2SVpnGateway associated with this VirtualHub. :type p2_s_vpn_gateway: ~azure.mgmt.network.v2020_04_01.models.SubResource :param express_route_gateway: The expressRouteGateway associated with this VirtualHub. :type express_route_gateway: ~azure.mgmt.network.v2020_04_01.models.SubResource :param azure_firewall: The azureFirewall associated with this VirtualHub. :type azure_firewall: ~azure.mgmt.network.v2020_04_01.models.SubResource :param security_partner_provider: The securityPartnerProvider associated with this VirtualHub. :type security_partner_provider: ~azure.mgmt.network.v2020_04_01.models.SubResource :param virtual_network_connections: List of all vnet connections with this VirtualHub. :type virtual_network_connections: list[~azure.mgmt.network.v2020_04_01.models.HubVirtualNetworkConnection] :param address_prefix: Address-prefix for this VirtualHub. :type address_prefix: str :param route_table: The routeTable associated with this virtual hub. :type route_table: ~azure.mgmt.network.v2020_04_01.models.VirtualHubRouteTable :ivar provisioning_state: The provisioning state of the virtual hub resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param security_provider_name: The Security Provider name. :type security_provider_name: str :param virtual_hub_route_table_v2_s: List of all virtual hub route table v2s associated with this VirtualHub. :type virtual_hub_route_table_v2_s: list[~azure.mgmt.network.v2020_04_01.models.VirtualHubRouteTableV2] :param sku: The sku of this VirtualHub. :type sku: str """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'virtual_wan': {'key': 'properties.virtualWan', 'type': 'SubResource'}, 'vpn_gateway': {'key': 'properties.vpnGateway', 'type': 'SubResource'}, 'p2_s_vpn_gateway': {'key': 'properties.p2SVpnGateway', 'type': 'SubResource'}, 'express_route_gateway': {'key': 'properties.expressRouteGateway', 'type': 'SubResource'}, 'azure_firewall': {'key': 'properties.azureFirewall', 'type': 'SubResource'}, 'security_partner_provider': {'key': 'properties.securityPartnerProvider', 'type': 'SubResource'}, 'virtual_network_connections': {'key': 'properties.virtualNetworkConnections', 'type': '[HubVirtualNetworkConnection]'}, 'address_prefix': {'key': 'properties.addressPrefix', 'type': 'str'}, 'route_table': {'key': 'properties.routeTable', 'type': 'VirtualHubRouteTable'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'security_provider_name': {'key': 'properties.securityProviderName', 'type': 'str'}, 'virtual_hub_route_table_v2_s': {'key': 'properties.virtualHubRouteTableV2s', 'type': '[VirtualHubRouteTableV2]'}, 'sku': {'key': 'properties.sku', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualHub, self).__init__(**kwargs) self.etag = None self.virtual_wan = kwargs.get('virtual_wan', None) self.vpn_gateway = kwargs.get('vpn_gateway', None) self.p2_s_vpn_gateway = kwargs.get('p2_s_vpn_gateway', None) self.express_route_gateway = kwargs.get('express_route_gateway', None) self.azure_firewall = kwargs.get('azure_firewall', None) self.security_partner_provider = kwargs.get('security_partner_provider', None) self.virtual_network_connections = kwargs.get('virtual_network_connections', None) self.address_prefix = kwargs.get('address_prefix', None) self.route_table = kwargs.get('route_table', None) self.provisioning_state = None self.security_provider_name = kwargs.get('security_provider_name', None) self.virtual_hub_route_table_v2_s = kwargs.get('virtual_hub_route_table_v2_s', None) self.sku = kwargs.get('sku', None) class VirtualHubId(msrest.serialization.Model): """Virtual Hub identifier. :param id: The resource URI for the Virtual Hub where the ExpressRoute gateway is or will be deployed. The Virtual Hub resource and the ExpressRoute gateway resource reside in the same subscription. :type id: str """ _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualHubId, self).__init__(**kwargs) self.id = kwargs.get('id', None) class VirtualHubRoute(msrest.serialization.Model): """VirtualHub route. :param address_prefixes: List of all addressPrefixes. :type address_prefixes: list[str] :param next_hop_ip_address: NextHop ip address. :type next_hop_ip_address: str """ _attribute_map = { 'address_prefixes': {'key': 'addressPrefixes', 'type': '[str]'}, 'next_hop_ip_address': {'key': 'nextHopIpAddress', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualHubRoute, self).__init__(**kwargs) self.address_prefixes = kwargs.get('address_prefixes', None) self.next_hop_ip_address = kwargs.get('next_hop_ip_address', None) class VirtualHubRouteTable(msrest.serialization.Model): """VirtualHub route table. :param routes: List of all routes. :type routes: list[~azure.mgmt.network.v2020_04_01.models.VirtualHubRoute] """ _attribute_map = { 'routes': {'key': 'routes', 'type': '[VirtualHubRoute]'}, } def __init__( self, **kwargs ): super(VirtualHubRouteTable, self).__init__(**kwargs) self.routes = kwargs.get('routes', None) class VirtualHubRouteTableV2(SubResource): """VirtualHubRouteTableV2 Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param routes: List of all routes. :type routes: list[~azure.mgmt.network.v2020_04_01.models.VirtualHubRouteV2] :param attached_connections: List of all connections attached to this route table v2. :type attached_connections: list[str] :ivar provisioning_state: The provisioning state of the virtual hub route table v2 resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'routes': {'key': 'properties.routes', 'type': '[VirtualHubRouteV2]'}, 'attached_connections': {'key': 'properties.attachedConnections', 'type': '[str]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualHubRouteTableV2, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.routes = kwargs.get('routes', None) self.attached_connections = kwargs.get('attached_connections', None) self.provisioning_state = None class VirtualHubRouteV2(msrest.serialization.Model): """VirtualHubRouteTableV2 route. :param destination_type: The type of destinations. :type destination_type: str :param destinations: List of all destinations. :type destinations: list[str] :param next_hop_type: The type of next hops. :type next_hop_type: str :param next_hops: NextHops ip address. :type next_hops: list[str] """ _attribute_map = { 'destination_type': {'key': 'destinationType', 'type': 'str'}, 'destinations': {'key': 'destinations', 'type': '[str]'}, 'next_hop_type': {'key': 'nextHopType', 'type': 'str'}, 'next_hops': {'key': 'nextHops', 'type': '[str]'}, } def __init__( self, **kwargs ): super(VirtualHubRouteV2, self).__init__(**kwargs) self.destination_type = kwargs.get('destination_type', None) self.destinations = kwargs.get('destinations', None) self.next_hop_type = kwargs.get('next_hop_type', None) self.next_hops = kwargs.get('next_hops', None) class VirtualNetwork(Resource): """Virtual Network resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param address_space: The AddressSpace that contains an array of IP address ranges that can be used by subnets. :type address_space: ~azure.mgmt.network.v2020_04_01.models.AddressSpace :param dhcp_options: The dhcpOptions that contains an array of DNS servers available to VMs deployed in the virtual network. :type dhcp_options: ~azure.mgmt.network.v2020_04_01.models.DhcpOptions :param subnets: A list of subnets in a Virtual Network. :type subnets: list[~azure.mgmt.network.v2020_04_01.models.Subnet] :param virtual_network_peerings: A list of peerings in a Virtual Network. :type virtual_network_peerings: list[~azure.mgmt.network.v2020_04_01.models.VirtualNetworkPeering] :ivar resource_guid: The resourceGuid property of the Virtual Network resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the virtual network resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param enable_ddos_protection: Indicates if DDoS protection is enabled for all the protected resources in the virtual network. It requires a DDoS protection plan associated with the resource. :type enable_ddos_protection: bool :param enable_vm_protection: Indicates if VM protection is enabled for all the subnets in the virtual network. :type enable_vm_protection: bool :param ddos_protection_plan: The DDoS protection plan associated with the virtual network. :type ddos_protection_plan: ~azure.mgmt.network.v2020_04_01.models.SubResource :param bgp_communities: Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. :type bgp_communities: ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkBgpCommunities :param ip_allocations: Array of IpAllocation which reference this VNET. :type ip_allocations: list[~azure.mgmt.network.v2020_04_01.models.SubResource] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'address_space': {'key': 'properties.addressSpace', 'type': 'AddressSpace'}, 'dhcp_options': {'key': 'properties.dhcpOptions', 'type': 'DhcpOptions'}, 'subnets': {'key': 'properties.subnets', 'type': '[Subnet]'}, 'virtual_network_peerings': {'key': 'properties.virtualNetworkPeerings', 'type': '[VirtualNetworkPeering]'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'enable_ddos_protection': {'key': 'properties.enableDdosProtection', 'type': 'bool'}, 'enable_vm_protection': {'key': 'properties.enableVmProtection', 'type': 'bool'}, 'ddos_protection_plan': {'key': 'properties.ddosProtectionPlan', 'type': 'SubResource'}, 'bgp_communities': {'key': 'properties.bgpCommunities', 'type': 'VirtualNetworkBgpCommunities'}, 'ip_allocations': {'key': 'properties.ipAllocations', 'type': '[SubResource]'}, } def __init__( self, **kwargs ): super(VirtualNetwork, self).__init__(**kwargs) self.etag = None self.address_space = kwargs.get('address_space', None) self.dhcp_options = kwargs.get('dhcp_options', None) self.subnets = kwargs.get('subnets', None) self.virtual_network_peerings = kwargs.get('virtual_network_peerings', None) self.resource_guid = None self.provisioning_state = None self.enable_ddos_protection = kwargs.get('enable_ddos_protection', False) self.enable_vm_protection = kwargs.get('enable_vm_protection', False) self.ddos_protection_plan = kwargs.get('ddos_protection_plan', None) self.bgp_communities = kwargs.get('bgp_communities', None) self.ip_allocations = kwargs.get('ip_allocations', None) class VirtualNetworkBgpCommunities(msrest.serialization.Model): """Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param virtual_network_community: Required. The BGP community associated with the virtual network. :type virtual_network_community: str :ivar regional_community: The BGP community associated with the region of the virtual network. :vartype regional_community: str """ _validation = { 'virtual_network_community': {'required': True}, 'regional_community': {'readonly': True}, } _attribute_map = { 'virtual_network_community': {'key': 'virtualNetworkCommunity', 'type': 'str'}, 'regional_community': {'key': 'regionalCommunity', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkBgpCommunities, self).__init__(**kwargs) self.virtual_network_community = kwargs['virtual_network_community'] self.regional_community = None class VirtualNetworkConnectionGatewayReference(msrest.serialization.Model): """A reference to VirtualNetworkGateway or LocalNetworkGateway resource. All required parameters must be populated in order to send to Azure. :param id: Required. The ID of VirtualNetworkGateway or LocalNetworkGateway resource. :type id: str """ _validation = { 'id': {'required': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkConnectionGatewayReference, self).__init__(**kwargs) self.id = kwargs['id'] class VirtualNetworkGateway(Resource): """A common class for general resource information. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param ip_configurations: IP configurations for virtual network gateway. :type ip_configurations: list[~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewayIPConfiguration] :param gateway_type: The type of this virtual network gateway. Possible values include: "Vpn", "ExpressRoute". :type gateway_type: str or ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewayType :param vpn_type: The type of this virtual network gateway. Possible values include: "PolicyBased", "RouteBased". :type vpn_type: str or ~azure.mgmt.network.v2020_04_01.models.VpnType :param vpn_gateway_generation: The generation for this VirtualNetworkGateway. Must be None if gatewayType is not VPN. Possible values include: "None", "Generation1", "Generation2". :type vpn_gateway_generation: str or ~azure.mgmt.network.v2020_04_01.models.VpnGatewayGeneration :param enable_bgp: Whether BGP is enabled for this virtual network gateway or not. :type enable_bgp: bool :param enable_private_ip_address: Whether private IP needs to be enabled on this gateway for connections or not. :type enable_private_ip_address: bool :param active: ActiveActive flag. :type active: bool :param gateway_default_site: The reference to the LocalNetworkGateway resource which represents local network site having default routes. Assign Null value in case of removing existing default site setting. :type gateway_default_site: ~azure.mgmt.network.v2020_04_01.models.SubResource :param sku: The reference to the VirtualNetworkGatewaySku resource which represents the SKU selected for Virtual network gateway. :type sku: ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewaySku :param vpn_client_configuration: The reference to the VpnClientConfiguration resource which represents the P2S VpnClient configurations. :type vpn_client_configuration: ~azure.mgmt.network.v2020_04_01.models.VpnClientConfiguration :param bgp_settings: Virtual network gateway's BGP speaker settings. :type bgp_settings: ~azure.mgmt.network.v2020_04_01.models.BgpSettings :param custom_routes: The reference to the address space resource which represents the custom routes address space specified by the customer for virtual network gateway and VpnClient. :type custom_routes: ~azure.mgmt.network.v2020_04_01.models.AddressSpace :ivar resource_guid: The resource GUID property of the virtual network gateway resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the virtual network gateway resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param enable_dns_forwarding: Whether dns forwarding is enabled or not. :type enable_dns_forwarding: bool :ivar inbound_dns_forwarding_endpoint: The IP address allocated by the gateway to which dns requests can be sent. :vartype inbound_dns_forwarding_endpoint: str """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'inbound_dns_forwarding_endpoint': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualNetworkGatewayIPConfiguration]'}, 'gateway_type': {'key': 'properties.gatewayType', 'type': 'str'}, 'vpn_type': {'key': 'properties.vpnType', 'type': 'str'}, 'vpn_gateway_generation': {'key': 'properties.vpnGatewayGeneration', 'type': 'str'}, 'enable_bgp': {'key': 'properties.enableBgp', 'type': 'bool'}, 'enable_private_ip_address': {'key': 'properties.enablePrivateIpAddress', 'type': 'bool'}, 'active': {'key': 'properties.activeActive', 'type': 'bool'}, 'gateway_default_site': {'key': 'properties.gatewayDefaultSite', 'type': 'SubResource'}, 'sku': {'key': 'properties.sku', 'type': 'VirtualNetworkGatewaySku'}, 'vpn_client_configuration': {'key': 'properties.vpnClientConfiguration', 'type': 'VpnClientConfiguration'}, 'bgp_settings': {'key': 'properties.bgpSettings', 'type': 'BgpSettings'}, 'custom_routes': {'key': 'properties.customRoutes', 'type': 'AddressSpace'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'enable_dns_forwarding': {'key': 'properties.enableDnsForwarding', 'type': 'bool'}, 'inbound_dns_forwarding_endpoint': {'key': 'properties.inboundDnsForwardingEndpoint', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkGateway, self).__init__(**kwargs) self.etag = None self.ip_configurations = kwargs.get('ip_configurations', None) self.gateway_type = kwargs.get('gateway_type', None) self.vpn_type = kwargs.get('vpn_type', None) self.vpn_gateway_generation = kwargs.get('vpn_gateway_generation', None) self.enable_bgp = kwargs.get('enable_bgp', None) self.enable_private_ip_address = kwargs.get('enable_private_ip_address', None) self.active = kwargs.get('active', None) self.gateway_default_site = kwargs.get('gateway_default_site', None) self.sku = kwargs.get('sku', None) self.vpn_client_configuration = kwargs.get('vpn_client_configuration', None) self.bgp_settings = kwargs.get('bgp_settings', None) self.custom_routes = kwargs.get('custom_routes', None) self.resource_guid = None self.provisioning_state = None self.enable_dns_forwarding = kwargs.get('enable_dns_forwarding', None) self.inbound_dns_forwarding_endpoint = None class VirtualNetworkGatewayConnection(Resource): """A common class for general resource information. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param authorization_key: The authorizationKey. :type authorization_key: str :param virtual_network_gateway1: Required. The reference to virtual network gateway resource. :type virtual_network_gateway1: ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGateway :param virtual_network_gateway2: The reference to virtual network gateway resource. :type virtual_network_gateway2: ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGateway :param local_network_gateway2: The reference to local network gateway resource. :type local_network_gateway2: ~azure.mgmt.network.v2020_04_01.models.LocalNetworkGateway :param connection_type: Required. Gateway connection type. Possible values include: "IPsec", "Vnet2Vnet", "ExpressRoute", "VPNClient". :type connection_type: str or ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewayConnectionType :param connection_protocol: Connection protocol used for this connection. Possible values include: "IKEv2", "IKEv1". :type connection_protocol: str or ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewayConnectionProtocol :param routing_weight: The routing weight. :type routing_weight: int :param dpd_timeout_seconds: The dead peer detection timeout of this connection in seconds. :type dpd_timeout_seconds: int :param shared_key: The IPSec shared key. :type shared_key: str :ivar connection_status: Virtual Network Gateway connection status. Possible values include: "Unknown", "Connecting", "Connected", "NotConnected". :vartype connection_status: str or ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewayConnectionStatus :ivar tunnel_connection_status: Collection of all tunnels' connection health status. :vartype tunnel_connection_status: list[~azure.mgmt.network.v2020_04_01.models.TunnelConnectionHealth] :ivar egress_bytes_transferred: The egress bytes transferred in this connection. :vartype egress_bytes_transferred: long :ivar ingress_bytes_transferred: The ingress bytes transferred in this connection. :vartype ingress_bytes_transferred: long :param peer: The reference to peerings resource. :type peer: ~azure.mgmt.network.v2020_04_01.models.SubResource :param enable_bgp: EnableBgp flag. :type enable_bgp: bool :param use_local_azure_ip_address: Use private local Azure IP for the connection. :type use_local_azure_ip_address: bool :param use_policy_based_traffic_selectors: Enable policy-based traffic selectors. :type use_policy_based_traffic_selectors: bool :param ipsec_policies: The IPSec Policies to be considered by this connection. :type ipsec_policies: list[~azure.mgmt.network.v2020_04_01.models.IpsecPolicy] :param traffic_selector_policies: The Traffic Selector Policies to be considered by this connection. :type traffic_selector_policies: list[~azure.mgmt.network.v2020_04_01.models.TrafficSelectorPolicy] :ivar resource_guid: The resource GUID property of the virtual network gateway connection resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the virtual network gateway connection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param express_route_gateway_bypass: Bypass ExpressRoute Gateway for data forwarding. :type express_route_gateway_bypass: bool """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'virtual_network_gateway1': {'required': True}, 'connection_type': {'required': True}, 'connection_status': {'readonly': True}, 'tunnel_connection_status': {'readonly': True}, 'egress_bytes_transferred': {'readonly': True}, 'ingress_bytes_transferred': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'authorization_key': {'key': 'properties.authorizationKey', 'type': 'str'}, 'virtual_network_gateway1': {'key': 'properties.virtualNetworkGateway1', 'type': 'VirtualNetworkGateway'}, 'virtual_network_gateway2': {'key': 'properties.virtualNetworkGateway2', 'type': 'VirtualNetworkGateway'}, 'local_network_gateway2': {'key': 'properties.localNetworkGateway2', 'type': 'LocalNetworkGateway'}, 'connection_type': {'key': 'properties.connectionType', 'type': 'str'}, 'connection_protocol': {'key': 'properties.connectionProtocol', 'type': 'str'}, 'routing_weight': {'key': 'properties.routingWeight', 'type': 'int'}, 'dpd_timeout_seconds': {'key': 'properties.dpdTimeoutSeconds', 'type': 'int'}, 'shared_key': {'key': 'properties.sharedKey', 'type': 'str'}, 'connection_status': {'key': 'properties.connectionStatus', 'type': 'str'}, 'tunnel_connection_status': {'key': 'properties.tunnelConnectionStatus', 'type': '[TunnelConnectionHealth]'}, 'egress_bytes_transferred': {'key': 'properties.egressBytesTransferred', 'type': 'long'}, 'ingress_bytes_transferred': {'key': 'properties.ingressBytesTransferred', 'type': 'long'}, 'peer': {'key': 'properties.peer', 'type': 'SubResource'}, 'enable_bgp': {'key': 'properties.enableBgp', 'type': 'bool'}, 'use_local_azure_ip_address': {'key': 'properties.useLocalAzureIpAddress', 'type': 'bool'}, 'use_policy_based_traffic_selectors': {'key': 'properties.usePolicyBasedTrafficSelectors', 'type': 'bool'}, 'ipsec_policies': {'key': 'properties.ipsecPolicies', 'type': '[IpsecPolicy]'}, 'traffic_selector_policies': {'key': 'properties.trafficSelectorPolicies', 'type': '[TrafficSelectorPolicy]'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'express_route_gateway_bypass': {'key': 'properties.expressRouteGatewayBypass', 'type': 'bool'}, } def __init__( self, **kwargs ): super(VirtualNetworkGatewayConnection, self).__init__(**kwargs) self.etag = None self.authorization_key = kwargs.get('authorization_key', None) self.virtual_network_gateway1 = kwargs['virtual_network_gateway1'] self.virtual_network_gateway2 = kwargs.get('virtual_network_gateway2', None) self.local_network_gateway2 = kwargs.get('local_network_gateway2', None) self.connection_type = kwargs['connection_type'] self.connection_protocol = kwargs.get('connection_protocol', None) self.routing_weight = kwargs.get('routing_weight', None) self.dpd_timeout_seconds = kwargs.get('dpd_timeout_seconds', None) self.shared_key = kwargs.get('shared_key', None) self.connection_status = None self.tunnel_connection_status = None self.egress_bytes_transferred = None self.ingress_bytes_transferred = None self.peer = kwargs.get('peer', None) self.enable_bgp = kwargs.get('enable_bgp', None) self.use_local_azure_ip_address = kwargs.get('use_local_azure_ip_address', None) self.use_policy_based_traffic_selectors = kwargs.get('use_policy_based_traffic_selectors', None) self.ipsec_policies = kwargs.get('ipsec_policies', None) self.traffic_selector_policies = kwargs.get('traffic_selector_policies', None) self.resource_guid = None self.provisioning_state = None self.express_route_gateway_bypass = kwargs.get('express_route_gateway_bypass', None) class VirtualNetworkGatewayConnectionListEntity(Resource): """A common class for general resource information. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param authorization_key: The authorizationKey. :type authorization_key: str :param virtual_network_gateway1: Required. The reference to virtual network gateway resource. :type virtual_network_gateway1: ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkConnectionGatewayReference :param virtual_network_gateway2: The reference to virtual network gateway resource. :type virtual_network_gateway2: ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkConnectionGatewayReference :param local_network_gateway2: The reference to local network gateway resource. :type local_network_gateway2: ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkConnectionGatewayReference :param connection_type: Required. Gateway connection type. Possible values include: "IPsec", "Vnet2Vnet", "ExpressRoute", "VPNClient". :type connection_type: str or ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewayConnectionType :param connection_protocol: Connection protocol used for this connection. Possible values include: "IKEv2", "IKEv1". :type connection_protocol: str or ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewayConnectionProtocol :param routing_weight: The routing weight. :type routing_weight: int :param shared_key: The IPSec shared key. :type shared_key: str :ivar connection_status: Virtual Network Gateway connection status. Possible values include: "Unknown", "Connecting", "Connected", "NotConnected". :vartype connection_status: str or ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewayConnectionStatus :ivar tunnel_connection_status: Collection of all tunnels' connection health status. :vartype tunnel_connection_status: list[~azure.mgmt.network.v2020_04_01.models.TunnelConnectionHealth] :ivar egress_bytes_transferred: The egress bytes transferred in this connection. :vartype egress_bytes_transferred: long :ivar ingress_bytes_transferred: The ingress bytes transferred in this connection. :vartype ingress_bytes_transferred: long :param peer: The reference to peerings resource. :type peer: ~azure.mgmt.network.v2020_04_01.models.SubResource :param enable_bgp: EnableBgp flag. :type enable_bgp: bool :param use_policy_based_traffic_selectors: Enable policy-based traffic selectors. :type use_policy_based_traffic_selectors: bool :param ipsec_policies: The IPSec Policies to be considered by this connection. :type ipsec_policies: list[~azure.mgmt.network.v2020_04_01.models.IpsecPolicy] :param traffic_selector_policies: The Traffic Selector Policies to be considered by this connection. :type traffic_selector_policies: list[~azure.mgmt.network.v2020_04_01.models.TrafficSelectorPolicy] :ivar resource_guid: The resource GUID property of the virtual network gateway connection resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the virtual network gateway connection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param express_route_gateway_bypass: Bypass ExpressRoute Gateway for data forwarding. :type express_route_gateway_bypass: bool """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'virtual_network_gateway1': {'required': True}, 'connection_type': {'required': True}, 'connection_status': {'readonly': True}, 'tunnel_connection_status': {'readonly': True}, 'egress_bytes_transferred': {'readonly': True}, 'ingress_bytes_transferred': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'authorization_key': {'key': 'properties.authorizationKey', 'type': 'str'}, 'virtual_network_gateway1': {'key': 'properties.virtualNetworkGateway1', 'type': 'VirtualNetworkConnectionGatewayReference'}, 'virtual_network_gateway2': {'key': 'properties.virtualNetworkGateway2', 'type': 'VirtualNetworkConnectionGatewayReference'}, 'local_network_gateway2': {'key': 'properties.localNetworkGateway2', 'type': 'VirtualNetworkConnectionGatewayReference'}, 'connection_type': {'key': 'properties.connectionType', 'type': 'str'}, 'connection_protocol': {'key': 'properties.connectionProtocol', 'type': 'str'}, 'routing_weight': {'key': 'properties.routingWeight', 'type': 'int'}, 'shared_key': {'key': 'properties.sharedKey', 'type': 'str'}, 'connection_status': {'key': 'properties.connectionStatus', 'type': 'str'}, 'tunnel_connection_status': {'key': 'properties.tunnelConnectionStatus', 'type': '[TunnelConnectionHealth]'}, 'egress_bytes_transferred': {'key': 'properties.egressBytesTransferred', 'type': 'long'}, 'ingress_bytes_transferred': {'key': 'properties.ingressBytesTransferred', 'type': 'long'}, 'peer': {'key': 'properties.peer', 'type': 'SubResource'}, 'enable_bgp': {'key': 'properties.enableBgp', 'type': 'bool'}, 'use_policy_based_traffic_selectors': {'key': 'properties.usePolicyBasedTrafficSelectors', 'type': 'bool'}, 'ipsec_policies': {'key': 'properties.ipsecPolicies', 'type': '[IpsecPolicy]'}, 'traffic_selector_policies': {'key': 'properties.trafficSelectorPolicies', 'type': '[TrafficSelectorPolicy]'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'express_route_gateway_bypass': {'key': 'properties.expressRouteGatewayBypass', 'type': 'bool'}, } def __init__( self, **kwargs ): super(VirtualNetworkGatewayConnectionListEntity, self).__init__(**kwargs) self.etag = None self.authorization_key = kwargs.get('authorization_key', None) self.virtual_network_gateway1 = kwargs['virtual_network_gateway1'] self.virtual_network_gateway2 = kwargs.get('virtual_network_gateway2', None) self.local_network_gateway2 = kwargs.get('local_network_gateway2', None) self.connection_type = kwargs['connection_type'] self.connection_protocol = kwargs.get('connection_protocol', None) self.routing_weight = kwargs.get('routing_weight', None) self.shared_key = kwargs.get('shared_key', None) self.connection_status = None self.tunnel_connection_status = None self.egress_bytes_transferred = None self.ingress_bytes_transferred = None self.peer = kwargs.get('peer', None) self.enable_bgp = kwargs.get('enable_bgp', None) self.use_policy_based_traffic_selectors = kwargs.get('use_policy_based_traffic_selectors', None) self.ipsec_policies = kwargs.get('ipsec_policies', None) self.traffic_selector_policies = kwargs.get('traffic_selector_policies', None) self.resource_guid = None self.provisioning_state = None self.express_route_gateway_bypass = kwargs.get('express_route_gateway_bypass', None) class VirtualNetworkGatewayConnectionListResult(msrest.serialization.Model): """Response for the ListVirtualNetworkGatewayConnections API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of VirtualNetworkGatewayConnection resources that exists in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewayConnection] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[VirtualNetworkGatewayConnection]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkGatewayConnectionListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class VirtualNetworkGatewayIPConfiguration(SubResource): """IP configuration for virtual network gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param private_ip_allocation_method: The private IP address allocation method. Possible values include: "Static", "Dynamic". :type private_ip_allocation_method: str or ~azure.mgmt.network.v2020_04_01.models.IPAllocationMethod :param subnet: The reference to the subnet resource. :type subnet: ~azure.mgmt.network.v2020_04_01.models.SubResource :param public_ip_address: The reference to the public IP resource. :type public_ip_address: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar private_ip_address: Private IP Address for this gateway. :vartype private_ip_address: str :ivar provisioning_state: The provisioning state of the virtual network gateway IP configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'private_ip_address': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'private_ip_allocation_method': {'key': 'properties.privateIPAllocationMethod', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'SubResource'}, 'public_ip_address': {'key': 'properties.publicIPAddress', 'type': 'SubResource'}, 'private_ip_address': {'key': 'properties.privateIPAddress', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkGatewayIPConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.private_ip_allocation_method = kwargs.get('private_ip_allocation_method', None) self.subnet = kwargs.get('subnet', None) self.public_ip_address = kwargs.get('public_ip_address', None) self.private_ip_address = None self.provisioning_state = None class VirtualNetworkGatewayListConnectionsResult(msrest.serialization.Model): """Response for the VirtualNetworkGatewayListConnections API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of VirtualNetworkGatewayConnection resources that exists in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewayConnectionListEntity] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[VirtualNetworkGatewayConnectionListEntity]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkGatewayListConnectionsResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class VirtualNetworkGatewayListResult(msrest.serialization.Model): """Response for the ListVirtualNetworkGateways API service call. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of VirtualNetworkGateway resources that exists in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGateway] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ _validation = { 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[VirtualNetworkGateway]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkGatewayListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = None class VirtualNetworkGatewaySku(msrest.serialization.Model): """VirtualNetworkGatewaySku details. Variables are only populated by the server, and will be ignored when sending a request. :param name: Gateway SKU name. Possible values include: "Basic", "HighPerformance", "Standard", "UltraPerformance", "VpnGw1", "VpnGw2", "VpnGw3", "VpnGw4", "VpnGw5", "VpnGw1AZ", "VpnGw2AZ", "VpnGw3AZ", "VpnGw4AZ", "VpnGw5AZ", "ErGw1AZ", "ErGw2AZ", "ErGw3AZ". :type name: str or ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewaySkuName :param tier: Gateway SKU tier. Possible values include: "Basic", "HighPerformance", "Standard", "UltraPerformance", "VpnGw1", "VpnGw2", "VpnGw3", "VpnGw4", "VpnGw5", "VpnGw1AZ", "VpnGw2AZ", "VpnGw3AZ", "VpnGw4AZ", "VpnGw5AZ", "ErGw1AZ", "ErGw2AZ", "ErGw3AZ". :type tier: str or ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewaySkuTier :ivar capacity: The capacity. :vartype capacity: int """ _validation = { 'capacity': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'tier': {'key': 'tier', 'type': 'str'}, 'capacity': {'key': 'capacity', 'type': 'int'}, } def __init__( self, **kwargs ): super(VirtualNetworkGatewaySku, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) self.capacity = None class VirtualNetworkListResult(msrest.serialization.Model): """Response for the ListVirtualNetworks API service call. :param value: A list of VirtualNetwork resources in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.VirtualNetwork] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VirtualNetwork]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class VirtualNetworkListUsageResult(msrest.serialization.Model): """Response for the virtual networks GetUsage API service call. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: VirtualNetwork usage stats. :vartype value: list[~azure.mgmt.network.v2020_04_01.models.VirtualNetworkUsage] :param next_link: The URL to get the next set of results. :type next_link: str """ _validation = { 'value': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[VirtualNetworkUsage]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkListUsageResult, self).__init__(**kwargs) self.value = None self.next_link = kwargs.get('next_link', None) class VirtualNetworkPeering(SubResource): """Peerings in a virtual network resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param allow_virtual_network_access: Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space. :type allow_virtual_network_access: bool :param allow_forwarded_traffic: Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network. :type allow_forwarded_traffic: bool :param allow_gateway_transit: If gateway links can be used in remote virtual networking to link to this virtual network. :type allow_gateway_transit: bool :param use_remote_gateways: If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. :type use_remote_gateways: bool :param remote_virtual_network: The reference to the remote virtual network. The remote virtual network can be in the same or different region (preview). See here to register for the preview and learn more (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). :type remote_virtual_network: ~azure.mgmt.network.v2020_04_01.models.SubResource :param remote_address_space: The reference to the remote virtual network address space. :type remote_address_space: ~azure.mgmt.network.v2020_04_01.models.AddressSpace :param peering_state: The status of the virtual network peering. Possible values include: "Initiated", "Connected", "Disconnected". :type peering_state: str or ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkPeeringState :ivar provisioning_state: The provisioning state of the virtual network peering resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'allow_virtual_network_access': {'key': 'properties.allowVirtualNetworkAccess', 'type': 'bool'}, 'allow_forwarded_traffic': {'key': 'properties.allowForwardedTraffic', 'type': 'bool'}, 'allow_gateway_transit': {'key': 'properties.allowGatewayTransit', 'type': 'bool'}, 'use_remote_gateways': {'key': 'properties.useRemoteGateways', 'type': 'bool'}, 'remote_virtual_network': {'key': 'properties.remoteVirtualNetwork', 'type': 'SubResource'}, 'remote_address_space': {'key': 'properties.remoteAddressSpace', 'type': 'AddressSpace'}, 'peering_state': {'key': 'properties.peeringState', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkPeering, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.allow_virtual_network_access = kwargs.get('allow_virtual_network_access', None) self.allow_forwarded_traffic = kwargs.get('allow_forwarded_traffic', None) self.allow_gateway_transit = kwargs.get('allow_gateway_transit', None) self.use_remote_gateways = kwargs.get('use_remote_gateways', None) self.remote_virtual_network = kwargs.get('remote_virtual_network', None) self.remote_address_space = kwargs.get('remote_address_space', None) self.peering_state = kwargs.get('peering_state', None) self.provisioning_state = None class VirtualNetworkPeeringListResult(msrest.serialization.Model): """Response for ListSubnets API service call. Retrieves all subnets that belong to a virtual network. :param value: The peerings in a virtual network. :type value: list[~azure.mgmt.network.v2020_04_01.models.VirtualNetworkPeering] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VirtualNetworkPeering]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkPeeringListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class VirtualNetworkTap(Resource): """Virtual Network Tap resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar network_interface_tap_configurations: Specifies the list of resource IDs for the network interface IP configuration that needs to be tapped. :vartype network_interface_tap_configurations: list[~azure.mgmt.network.v2020_04_01.models.NetworkInterfaceTapConfiguration] :ivar resource_guid: The resource GUID property of the virtual network tap resource. :vartype resource_guid: str :ivar provisioning_state: The provisioning state of the virtual network tap resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param destination_network_interface_ip_configuration: The reference to the private IP Address of the collector nic that will receive the tap. :type destination_network_interface_ip_configuration: ~azure.mgmt.network.v2020_04_01.models.NetworkInterfaceIPConfiguration :param destination_load_balancer_front_end_ip_configuration: The reference to the private IP address on the internal Load Balancer that will receive the tap. :type destination_load_balancer_front_end_ip_configuration: ~azure.mgmt.network.v2020_04_01.models.FrontendIPConfiguration :param destination_port: The VXLAN destination port that will receive the tapped traffic. :type destination_port: int """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'network_interface_tap_configurations': {'readonly': True}, 'resource_guid': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'network_interface_tap_configurations': {'key': 'properties.networkInterfaceTapConfigurations', 'type': '[NetworkInterfaceTapConfiguration]'}, 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'destination_network_interface_ip_configuration': {'key': 'properties.destinationNetworkInterfaceIPConfiguration', 'type': 'NetworkInterfaceIPConfiguration'}, 'destination_load_balancer_front_end_ip_configuration': {'key': 'properties.destinationLoadBalancerFrontEndIPConfiguration', 'type': 'FrontendIPConfiguration'}, 'destination_port': {'key': 'properties.destinationPort', 'type': 'int'}, } def __init__( self, **kwargs ): super(VirtualNetworkTap, self).__init__(**kwargs) self.etag = None self.network_interface_tap_configurations = None self.resource_guid = None self.provisioning_state = None self.destination_network_interface_ip_configuration = kwargs.get('destination_network_interface_ip_configuration', None) self.destination_load_balancer_front_end_ip_configuration = kwargs.get('destination_load_balancer_front_end_ip_configuration', None) self.destination_port = kwargs.get('destination_port', None) class VirtualNetworkTapListResult(msrest.serialization.Model): """Response for ListVirtualNetworkTap API service call. :param value: A list of VirtualNetworkTaps in a resource group. :type value: list[~azure.mgmt.network.v2020_04_01.models.VirtualNetworkTap] :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VirtualNetworkTap]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkTapListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class VirtualNetworkUsage(msrest.serialization.Model): """Usage details for subnet. Variables are only populated by the server, and will be ignored when sending a request. :ivar current_value: Indicates number of IPs used from the Subnet. :vartype current_value: float :ivar id: Subnet identifier. :vartype id: str :ivar limit: Indicates the size of the subnet. :vartype limit: float :ivar name: The name containing common and localized value for usage. :vartype name: ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkUsageName :ivar unit: Usage units. Returns 'Count'. :vartype unit: str """ _validation = { 'current_value': {'readonly': True}, 'id': {'readonly': True}, 'limit': {'readonly': True}, 'name': {'readonly': True}, 'unit': {'readonly': True}, } _attribute_map = { 'current_value': {'key': 'currentValue', 'type': 'float'}, 'id': {'key': 'id', 'type': 'str'}, 'limit': {'key': 'limit', 'type': 'float'}, 'name': {'key': 'name', 'type': 'VirtualNetworkUsageName'}, 'unit': {'key': 'unit', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkUsage, self).__init__(**kwargs) self.current_value = None self.id = None self.limit = None self.name = None self.unit = None class VirtualNetworkUsageName(msrest.serialization.Model): """Usage strings container. Variables are only populated by the server, and will be ignored when sending a request. :ivar localized_value: Localized subnet size and usage string. :vartype localized_value: str :ivar value: Subnet size and usage string. :vartype value: str """ _validation = { 'localized_value': {'readonly': True}, 'value': {'readonly': True}, } _attribute_map = { 'localized_value': {'key': 'localizedValue', 'type': 'str'}, 'value': {'key': 'value', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualNetworkUsageName, self).__init__(**kwargs) self.localized_value = None self.value = None class VirtualRouter(Resource): """VirtualRouter Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param virtual_router_asn: VirtualRouter ASN. :type virtual_router_asn: long :param virtual_router_ips: VirtualRouter IPs. :type virtual_router_ips: list[str] :param hosted_subnet: The Subnet on which VirtualRouter is hosted. :type hosted_subnet: ~azure.mgmt.network.v2020_04_01.models.SubResource :param hosted_gateway: The Gateway on which VirtualRouter is hosted. :type hosted_gateway: ~azure.mgmt.network.v2020_04_01.models.SubResource :ivar peerings: List of references to VirtualRouterPeerings. :vartype peerings: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar provisioning_state: The provisioning state of the resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'virtual_router_asn': {'maximum': 4294967295, 'minimum': 0}, 'peerings': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'virtual_router_asn': {'key': 'properties.virtualRouterAsn', 'type': 'long'}, 'virtual_router_ips': {'key': 'properties.virtualRouterIps', 'type': '[str]'}, 'hosted_subnet': {'key': 'properties.hostedSubnet', 'type': 'SubResource'}, 'hosted_gateway': {'key': 'properties.hostedGateway', 'type': 'SubResource'}, 'peerings': {'key': 'properties.peerings', 'type': '[SubResource]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualRouter, self).__init__(**kwargs) self.etag = None self.virtual_router_asn = kwargs.get('virtual_router_asn', None) self.virtual_router_ips = kwargs.get('virtual_router_ips', None) self.hosted_subnet = kwargs.get('hosted_subnet', None) self.hosted_gateway = kwargs.get('hosted_gateway', None) self.peerings = None self.provisioning_state = None class VirtualRouterListResult(msrest.serialization.Model): """Response for ListVirtualRouters API service call. :param value: List of Virtual Routers. :type value: list[~azure.mgmt.network.v2020_04_01.models.VirtualRouter] :param next_link: URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VirtualRouter]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualRouterListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class VirtualRouterPeering(SubResource): """Virtual Router Peering resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the virtual router peering that is unique within a virtual router. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Peering type. :vartype type: str :param peer_asn: Peer ASN. :type peer_asn: long :param peer_ip: Peer IP. :type peer_ip: str :ivar provisioning_state: The provisioning state of the resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'peer_asn': {'maximum': 4294967295, 'minimum': 0}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'peer_asn': {'key': 'properties.peerAsn', 'type': 'long'}, 'peer_ip': {'key': 'properties.peerIp', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualRouterPeering, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.peer_asn = kwargs.get('peer_asn', None) self.peer_ip = kwargs.get('peer_ip', None) self.provisioning_state = None class VirtualRouterPeeringListResult(msrest.serialization.Model): """Response for ListVirtualRouterPeerings API service call. :param value: List of VirtualRouterPeerings in a VirtualRouter. :type value: list[~azure.mgmt.network.v2020_04_01.models.VirtualRouterPeering] :param next_link: URL to get the next set of results. :type next_link: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[VirtualRouterPeering]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualRouterPeeringListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) class VirtualWAN(Resource): """VirtualWAN Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param disable_vpn_encryption: Vpn encryption to be disabled or not. :type disable_vpn_encryption: bool :ivar virtual_hubs: List of VirtualHubs in the VirtualWAN. :vartype virtual_hubs: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar vpn_sites: List of VpnSites in the VirtualWAN. :vartype vpn_sites: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :param allow_branch_to_branch_traffic: True if branch to branch traffic is allowed. :type allow_branch_to_branch_traffic: bool :param allow_vnet_to_vnet_traffic: True if Vnet to Vnet traffic is allowed. :type allow_vnet_to_vnet_traffic: bool :ivar office365_local_breakout_category: The office local breakout category. Possible values include: "Optimize", "OptimizeAndAllow", "All", "None". :vartype office365_local_breakout_category: str or ~azure.mgmt.network.v2020_04_01.models.OfficeTrafficCategory :ivar provisioning_state: The provisioning state of the virtual WAN resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param type_properties_type: The type of the VirtualWAN. :type type_properties_type: str """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'virtual_hubs': {'readonly': True}, 'vpn_sites': {'readonly': True}, 'office365_local_breakout_category': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'disable_vpn_encryption': {'key': 'properties.disableVpnEncryption', 'type': 'bool'}, 'virtual_hubs': {'key': 'properties.virtualHubs', 'type': '[SubResource]'}, 'vpn_sites': {'key': 'properties.vpnSites', 'type': '[SubResource]'}, 'allow_branch_to_branch_traffic': {'key': 'properties.allowBranchToBranchTraffic', 'type': 'bool'}, 'allow_vnet_to_vnet_traffic': {'key': 'properties.allowVnetToVnetTraffic', 'type': 'bool'}, 'office365_local_breakout_category': {'key': 'properties.office365LocalBreakoutCategory', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualWAN, self).__init__(**kwargs) self.etag = None self.disable_vpn_encryption = kwargs.get('disable_vpn_encryption', None) self.virtual_hubs = None self.vpn_sites = None self.allow_branch_to_branch_traffic = kwargs.get('allow_branch_to_branch_traffic', None) self.allow_vnet_to_vnet_traffic = kwargs.get('allow_vnet_to_vnet_traffic', None) self.office365_local_breakout_category = None self.provisioning_state = None self.type_properties_type = kwargs.get('type_properties_type', None) class VirtualWanSecurityProvider(msrest.serialization.Model): """Collection of SecurityProviders. Variables are only populated by the server, and will be ignored when sending a request. :param name: Name of the security provider. :type name: str :param url: Url of the security provider. :type url: str :ivar type: Name of the security provider. Possible values include: "External", "Native". :vartype type: str or ~azure.mgmt.network.v2020_04_01.models.VirtualWanSecurityProviderType """ _validation = { 'type': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'url': {'key': 'url', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualWanSecurityProvider, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.url = kwargs.get('url', None) self.type = None class VirtualWanSecurityProviders(msrest.serialization.Model): """Collection of SecurityProviders. :param supported_providers: List of VirtualWAN security providers. :type supported_providers: list[~azure.mgmt.network.v2020_04_01.models.VirtualWanSecurityProvider] """ _attribute_map = { 'supported_providers': {'key': 'supportedProviders', 'type': '[VirtualWanSecurityProvider]'}, } def __init__( self, **kwargs ): super(VirtualWanSecurityProviders, self).__init__(**kwargs) self.supported_providers = kwargs.get('supported_providers', None) class VirtualWanVpnProfileParameters(msrest.serialization.Model): """Virtual Wan Vpn profile parameters Vpn profile generation. :param vpn_server_configuration_resource_id: VpnServerConfiguration partial resource uri with which VirtualWan is associated to. :type vpn_server_configuration_resource_id: str :param authentication_method: VPN client authentication method. Possible values include: "EAPTLS", "EAPMSCHAPv2". :type authentication_method: str or ~azure.mgmt.network.v2020_04_01.models.AuthenticationMethod """ _attribute_map = { 'vpn_server_configuration_resource_id': {'key': 'vpnServerConfigurationResourceId', 'type': 'str'}, 'authentication_method': {'key': 'authenticationMethod', 'type': 'str'}, } def __init__( self, **kwargs ): super(VirtualWanVpnProfileParameters, self).__init__(**kwargs) self.vpn_server_configuration_resource_id = kwargs.get('vpn_server_configuration_resource_id', None) self.authentication_method = kwargs.get('authentication_method', None) class VM(Resource): """Describes a Virtual Machine. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__( self, **kwargs ): super(VM, self).__init__(**kwargs) class VnetRoute(msrest.serialization.Model): """List of routes that control routing from VirtualHub into a virtual network connection. :param static_routes: List of all Static Routes. :type static_routes: list[~azure.mgmt.network.v2020_04_01.models.StaticRoute] """ _attribute_map = { 'static_routes': {'key': 'staticRoutes', 'type': '[StaticRoute]'}, } def __init__( self, **kwargs ): super(VnetRoute, self).__init__(**kwargs) self.static_routes = kwargs.get('static_routes', None) class VpnClientConfiguration(msrest.serialization.Model): """VpnClientConfiguration for P2S client. :param vpn_client_address_pool: The reference to the address space resource which represents Address space for P2S VpnClient. :type vpn_client_address_pool: ~azure.mgmt.network.v2020_04_01.models.AddressSpace :param vpn_client_root_certificates: VpnClientRootCertificate for virtual network gateway. :type vpn_client_root_certificates: list[~azure.mgmt.network.v2020_04_01.models.VpnClientRootCertificate] :param vpn_client_revoked_certificates: VpnClientRevokedCertificate for Virtual network gateway. :type vpn_client_revoked_certificates: list[~azure.mgmt.network.v2020_04_01.models.VpnClientRevokedCertificate] :param vpn_client_protocols: VpnClientProtocols for Virtual network gateway. :type vpn_client_protocols: list[str or ~azure.mgmt.network.v2020_04_01.models.VpnClientProtocol] :param vpn_client_ipsec_policies: VpnClientIpsecPolicies for virtual network gateway P2S client. :type vpn_client_ipsec_policies: list[~azure.mgmt.network.v2020_04_01.models.IpsecPolicy] :param radius_server_address: The radius server address property of the VirtualNetworkGateway resource for vpn client connection. :type radius_server_address: str :param radius_server_secret: The radius secret property of the VirtualNetworkGateway resource for vpn client connection. :type radius_server_secret: str :param radius_servers: The radiusServers property for multiple radius server configuration. :type radius_servers: list[~azure.mgmt.network.v2020_04_01.models.RadiusServer] :param aad_tenant: The AADTenant property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. :type aad_tenant: str :param aad_audience: The AADAudience property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. :type aad_audience: str :param aad_issuer: The AADIssuer property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. :type aad_issuer: str """ _attribute_map = { 'vpn_client_address_pool': {'key': 'vpnClientAddressPool', 'type': 'AddressSpace'}, 'vpn_client_root_certificates': {'key': 'vpnClientRootCertificates', 'type': '[VpnClientRootCertificate]'}, 'vpn_client_revoked_certificates': {'key': 'vpnClientRevokedCertificates', 'type': '[VpnClientRevokedCertificate]'}, 'vpn_client_protocols': {'key': 'vpnClientProtocols', 'type': '[str]'}, 'vpn_client_ipsec_policies': {'key': 'vpnClientIpsecPolicies', 'type': '[IpsecPolicy]'}, 'radius_server_address': {'key': 'radiusServerAddress', 'type': 'str'}, 'radius_server_secret': {'key': 'radiusServerSecret', 'type': 'str'}, 'radius_servers': {'key': 'radiusServers', 'type': '[RadiusServer]'}, 'aad_tenant': {'key': 'aadTenant', 'type': 'str'}, 'aad_audience': {'key': 'aadAudience', 'type': 'str'}, 'aad_issuer': {'key': 'aadIssuer', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnClientConfiguration, self).__init__(**kwargs) self.vpn_client_address_pool = kwargs.get('vpn_client_address_pool', None) self.vpn_client_root_certificates = kwargs.get('vpn_client_root_certificates', None) self.vpn_client_revoked_certificates = kwargs.get('vpn_client_revoked_certificates', None) self.vpn_client_protocols = kwargs.get('vpn_client_protocols', None) self.vpn_client_ipsec_policies = kwargs.get('vpn_client_ipsec_policies', None) self.radius_server_address = kwargs.get('radius_server_address', None) self.radius_server_secret = kwargs.get('radius_server_secret', None) self.radius_servers = kwargs.get('radius_servers', None) self.aad_tenant = kwargs.get('aad_tenant', None) self.aad_audience = kwargs.get('aad_audience', None) self.aad_issuer = kwargs.get('aad_issuer', None) class VpnClientConnectionHealth(msrest.serialization.Model): """VpnClientConnectionHealth properties. Variables are only populated by the server, and will be ignored when sending a request. :ivar total_ingress_bytes_transferred: Total of the Ingress Bytes Transferred in this P2S Vpn connection. :vartype total_ingress_bytes_transferred: long :ivar total_egress_bytes_transferred: Total of the Egress Bytes Transferred in this connection. :vartype total_egress_bytes_transferred: long :param vpn_client_connections_count: The total of p2s vpn clients connected at this time to this P2SVpnGateway. :type vpn_client_connections_count: int :param allocated_ip_addresses: List of allocated ip addresses to the connected p2s vpn clients. :type allocated_ip_addresses: list[str] """ _validation = { 'total_ingress_bytes_transferred': {'readonly': True}, 'total_egress_bytes_transferred': {'readonly': True}, } _attribute_map = { 'total_ingress_bytes_transferred': {'key': 'totalIngressBytesTransferred', 'type': 'long'}, 'total_egress_bytes_transferred': {'key': 'totalEgressBytesTransferred', 'type': 'long'}, 'vpn_client_connections_count': {'key': 'vpnClientConnectionsCount', 'type': 'int'}, 'allocated_ip_addresses': {'key': 'allocatedIpAddresses', 'type': '[str]'}, } def __init__( self, **kwargs ): super(VpnClientConnectionHealth, self).__init__(**kwargs) self.total_ingress_bytes_transferred = None self.total_egress_bytes_transferred = None self.vpn_client_connections_count = kwargs.get('vpn_client_connections_count', None) self.allocated_ip_addresses = kwargs.get('allocated_ip_addresses', None) class VpnClientConnectionHealthDetail(msrest.serialization.Model): """VPN client connection health detail. Variables are only populated by the server, and will be ignored when sending a request. :ivar vpn_connection_id: The vpn client Id. :vartype vpn_connection_id: str :ivar vpn_connection_duration: The duration time of a connected vpn client. :vartype vpn_connection_duration: long :ivar vpn_connection_time: The start time of a connected vpn client. :vartype vpn_connection_time: str :ivar public_ip_address: The public Ip of a connected vpn client. :vartype public_ip_address: str :ivar private_ip_address: The assigned private Ip of a connected vpn client. :vartype private_ip_address: str :ivar vpn_user_name: The user name of a connected vpn client. :vartype vpn_user_name: str :ivar max_bandwidth: The max band width. :vartype max_bandwidth: long :ivar egress_packets_transferred: The egress packets per second. :vartype egress_packets_transferred: long :ivar egress_bytes_transferred: The egress bytes per second. :vartype egress_bytes_transferred: long :ivar ingress_packets_transferred: The ingress packets per second. :vartype ingress_packets_transferred: long :ivar ingress_bytes_transferred: The ingress bytes per second. :vartype ingress_bytes_transferred: long :ivar max_packets_per_second: The max packets transferred per second. :vartype max_packets_per_second: long """ _validation = { 'vpn_connection_id': {'readonly': True}, 'vpn_connection_duration': {'readonly': True}, 'vpn_connection_time': {'readonly': True}, 'public_ip_address': {'readonly': True}, 'private_ip_address': {'readonly': True}, 'vpn_user_name': {'readonly': True}, 'max_bandwidth': {'readonly': True}, 'egress_packets_transferred': {'readonly': True}, 'egress_bytes_transferred': {'readonly': True}, 'ingress_packets_transferred': {'readonly': True}, 'ingress_bytes_transferred': {'readonly': True}, 'max_packets_per_second': {'readonly': True}, } _attribute_map = { 'vpn_connection_id': {'key': 'vpnConnectionId', 'type': 'str'}, 'vpn_connection_duration': {'key': 'vpnConnectionDuration', 'type': 'long'}, 'vpn_connection_time': {'key': 'vpnConnectionTime', 'type': 'str'}, 'public_ip_address': {'key': 'publicIpAddress', 'type': 'str'}, 'private_ip_address': {'key': 'privateIpAddress', 'type': 'str'}, 'vpn_user_name': {'key': 'vpnUserName', 'type': 'str'}, 'max_bandwidth': {'key': 'maxBandwidth', 'type': 'long'}, 'egress_packets_transferred': {'key': 'egressPacketsTransferred', 'type': 'long'}, 'egress_bytes_transferred': {'key': 'egressBytesTransferred', 'type': 'long'}, 'ingress_packets_transferred': {'key': 'ingressPacketsTransferred', 'type': 'long'}, 'ingress_bytes_transferred': {'key': 'ingressBytesTransferred', 'type': 'long'}, 'max_packets_per_second': {'key': 'maxPacketsPerSecond', 'type': 'long'}, } def __init__( self, **kwargs ): super(VpnClientConnectionHealthDetail, self).__init__(**kwargs) self.vpn_connection_id = None self.vpn_connection_duration = None self.vpn_connection_time = None self.public_ip_address = None self.private_ip_address = None self.vpn_user_name = None self.max_bandwidth = None self.egress_packets_transferred = None self.egress_bytes_transferred = None self.ingress_packets_transferred = None self.ingress_bytes_transferred = None self.max_packets_per_second = None class VpnClientConnectionHealthDetailListResult(msrest.serialization.Model): """List of virtual network gateway vpn client connection health. :param value: List of vpn client connection health. :type value: list[~azure.mgmt.network.v2020_04_01.models.VpnClientConnectionHealthDetail] """ _attribute_map = { 'value': {'key': 'value', 'type': '[VpnClientConnectionHealthDetail]'}, } def __init__( self, **kwargs ): super(VpnClientConnectionHealthDetailListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) class VpnClientIPsecParameters(msrest.serialization.Model): """An IPSec parameters for a virtual network gateway P2S connection. All required parameters must be populated in order to send to Azure. :param sa_life_time_seconds: Required. The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for P2S client. :type sa_life_time_seconds: int :param sa_data_size_kilobytes: Required. The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for P2S client.. :type sa_data_size_kilobytes: int :param ipsec_encryption: Required. The IPSec encryption algorithm (IKE phase 1). Possible values include: "None", "DES", "DES3", "AES128", "AES192", "AES256", "GCMAES128", "GCMAES192", "GCMAES256". :type ipsec_encryption: str or ~azure.mgmt.network.v2020_04_01.models.IpsecEncryption :param ipsec_integrity: Required. The IPSec integrity algorithm (IKE phase 1). Possible values include: "MD5", "SHA1", "SHA256", "GCMAES128", "GCMAES192", "GCMAES256". :type ipsec_integrity: str or ~azure.mgmt.network.v2020_04_01.models.IpsecIntegrity :param ike_encryption: Required. The IKE encryption algorithm (IKE phase 2). Possible values include: "DES", "DES3", "AES128", "AES192", "AES256", "GCMAES256", "GCMAES128". :type ike_encryption: str or ~azure.mgmt.network.v2020_04_01.models.IkeEncryption :param ike_integrity: Required. The IKE integrity algorithm (IKE phase 2). Possible values include: "MD5", "SHA1", "SHA256", "SHA384", "GCMAES256", "GCMAES128". :type ike_integrity: str or ~azure.mgmt.network.v2020_04_01.models.IkeIntegrity :param dh_group: Required. The DH Group used in IKE Phase 1 for initial SA. Possible values include: "None", "DHGroup1", "DHGroup2", "DHGroup14", "DHGroup2048", "ECP256", "ECP384", "DHGroup24". :type dh_group: str or ~azure.mgmt.network.v2020_04_01.models.DhGroup :param pfs_group: Required. The Pfs Group used in IKE Phase 2 for new child SA. Possible values include: "None", "PFS1", "PFS2", "PFS2048", "ECP256", "ECP384", "PFS24", "PFS14", "PFSMM". :type pfs_group: str or ~azure.mgmt.network.v2020_04_01.models.PfsGroup """ _validation = { 'sa_life_time_seconds': {'required': True}, 'sa_data_size_kilobytes': {'required': True}, 'ipsec_encryption': {'required': True}, 'ipsec_integrity': {'required': True}, 'ike_encryption': {'required': True}, 'ike_integrity': {'required': True}, 'dh_group': {'required': True}, 'pfs_group': {'required': True}, } _attribute_map = { 'sa_life_time_seconds': {'key': 'saLifeTimeSeconds', 'type': 'int'}, 'sa_data_size_kilobytes': {'key': 'saDataSizeKilobytes', 'type': 'int'}, 'ipsec_encryption': {'key': 'ipsecEncryption', 'type': 'str'}, 'ipsec_integrity': {'key': 'ipsecIntegrity', 'type': 'str'}, 'ike_encryption': {'key': 'ikeEncryption', 'type': 'str'}, 'ike_integrity': {'key': 'ikeIntegrity', 'type': 'str'}, 'dh_group': {'key': 'dhGroup', 'type': 'str'}, 'pfs_group': {'key': 'pfsGroup', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnClientIPsecParameters, self).__init__(**kwargs) self.sa_life_time_seconds = kwargs['sa_life_time_seconds'] self.sa_data_size_kilobytes = kwargs['sa_data_size_kilobytes'] self.ipsec_encryption = kwargs['ipsec_encryption'] self.ipsec_integrity = kwargs['ipsec_integrity'] self.ike_encryption = kwargs['ike_encryption'] self.ike_integrity = kwargs['ike_integrity'] self.dh_group = kwargs['dh_group'] self.pfs_group = kwargs['pfs_group'] class VpnClientParameters(msrest.serialization.Model): """Vpn Client Parameters for package generation. :param processor_architecture: VPN client Processor Architecture. Possible values include: "Amd64", "X86". :type processor_architecture: str or ~azure.mgmt.network.v2020_04_01.models.ProcessorArchitecture :param authentication_method: VPN client authentication method. Possible values include: "EAPTLS", "EAPMSCHAPv2". :type authentication_method: str or ~azure.mgmt.network.v2020_04_01.models.AuthenticationMethod :param radius_server_auth_certificate: The public certificate data for the radius server authentication certificate as a Base-64 encoded string. Required only if external radius authentication has been configured with EAPTLS authentication. :type radius_server_auth_certificate: str :param client_root_certificates: A list of client root certificates public certificate data encoded as Base-64 strings. Optional parameter for external radius based authentication with EAPTLS. :type client_root_certificates: list[str] """ _attribute_map = { 'processor_architecture': {'key': 'processorArchitecture', 'type': 'str'}, 'authentication_method': {'key': 'authenticationMethod', 'type': 'str'}, 'radius_server_auth_certificate': {'key': 'radiusServerAuthCertificate', 'type': 'str'}, 'client_root_certificates': {'key': 'clientRootCertificates', 'type': '[str]'}, } def __init__( self, **kwargs ): super(VpnClientParameters, self).__init__(**kwargs) self.processor_architecture = kwargs.get('processor_architecture', None) self.authentication_method = kwargs.get('authentication_method', None) self.radius_server_auth_certificate = kwargs.get('radius_server_auth_certificate', None) self.client_root_certificates = kwargs.get('client_root_certificates', None) class VpnClientRevokedCertificate(SubResource): """VPN client revoked certificate of virtual network gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param thumbprint: The revoked VPN client certificate thumbprint. :type thumbprint: str :ivar provisioning_state: The provisioning state of the VPN client revoked certificate resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnClientRevokedCertificate, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.thumbprint = kwargs.get('thumbprint', None) self.provisioning_state = None class VpnClientRootCertificate(SubResource): """VPN client root certificate of virtual network gateway. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param public_cert_data: Required. The certificate public data. :type public_cert_data: str :ivar provisioning_state: The provisioning state of the VPN client root certificate resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'public_cert_data': {'required': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'public_cert_data': {'key': 'properties.publicCertData', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnClientRootCertificate, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.public_cert_data = kwargs['public_cert_data'] self.provisioning_state = None class VpnConnection(SubResource): """VpnConnection Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param remote_vpn_site: Id of the connected vpn site. :type remote_vpn_site: ~azure.mgmt.network.v2020_04_01.models.SubResource :param routing_weight: Routing weight for vpn connection. :type routing_weight: int :param dpd_timeout_seconds: The dead peer detection timeout for a vpn connection in seconds. :type dpd_timeout_seconds: int :ivar connection_status: The connection status. Possible values include: "Unknown", "Connecting", "Connected", "NotConnected". :vartype connection_status: str or ~azure.mgmt.network.v2020_04_01.models.VpnConnectionStatus :param vpn_connection_protocol_type: Connection protocol used for this connection. Possible values include: "IKEv2", "IKEv1". :type vpn_connection_protocol_type: str or ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewayConnectionProtocol :ivar ingress_bytes_transferred: Ingress bytes transferred. :vartype ingress_bytes_transferred: long :ivar egress_bytes_transferred: Egress bytes transferred. :vartype egress_bytes_transferred: long :param connection_bandwidth: Expected bandwidth in MBPS. :type connection_bandwidth: int :param shared_key: SharedKey for the vpn connection. :type shared_key: str :param enable_bgp: EnableBgp flag. :type enable_bgp: bool :param use_policy_based_traffic_selectors: Enable policy-based traffic selectors. :type use_policy_based_traffic_selectors: bool :param ipsec_policies: The IPSec Policies to be considered by this connection. :type ipsec_policies: list[~azure.mgmt.network.v2020_04_01.models.IpsecPolicy] :param enable_rate_limiting: EnableBgp flag. :type enable_rate_limiting: bool :param enable_internet_security: Enable internet security. :type enable_internet_security: bool :param use_local_azure_ip_address: Use local azure ip to initiate connection. :type use_local_azure_ip_address: bool :ivar provisioning_state: The provisioning state of the VPN connection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param vpn_link_connections: List of all vpn site link connections to the gateway. :type vpn_link_connections: list[~azure.mgmt.network.v2020_04_01.models.VpnSiteLinkConnection] :param routing_configuration: The Routing Configuration indicating the associated and propagated route tables on this connection. :type routing_configuration: ~azure.mgmt.network.v2020_04_01.models.RoutingConfiguration """ _validation = { 'etag': {'readonly': True}, 'connection_status': {'readonly': True}, 'ingress_bytes_transferred': {'readonly': True}, 'egress_bytes_transferred': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'remote_vpn_site': {'key': 'properties.remoteVpnSite', 'type': 'SubResource'}, 'routing_weight': {'key': 'properties.routingWeight', 'type': 'int'}, 'dpd_timeout_seconds': {'key': 'properties.dpdTimeoutSeconds', 'type': 'int'}, 'connection_status': {'key': 'properties.connectionStatus', 'type': 'str'}, 'vpn_connection_protocol_type': {'key': 'properties.vpnConnectionProtocolType', 'type': 'str'}, 'ingress_bytes_transferred': {'key': 'properties.ingressBytesTransferred', 'type': 'long'}, 'egress_bytes_transferred': {'key': 'properties.egressBytesTransferred', 'type': 'long'}, 'connection_bandwidth': {'key': 'properties.connectionBandwidth', 'type': 'int'}, 'shared_key': {'key': 'properties.sharedKey', 'type': 'str'}, 'enable_bgp': {'key': 'properties.enableBgp', 'type': 'bool'}, 'use_policy_based_traffic_selectors': {'key': 'properties.usePolicyBasedTrafficSelectors', 'type': 'bool'}, 'ipsec_policies': {'key': 'properties.ipsecPolicies', 'type': '[IpsecPolicy]'}, 'enable_rate_limiting': {'key': 'properties.enableRateLimiting', 'type': 'bool'}, 'enable_internet_security': {'key': 'properties.enableInternetSecurity', 'type': 'bool'}, 'use_local_azure_ip_address': {'key': 'properties.useLocalAzureIpAddress', 'type': 'bool'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'vpn_link_connections': {'key': 'properties.vpnLinkConnections', 'type': '[VpnSiteLinkConnection]'}, 'routing_configuration': {'key': 'properties.routingConfiguration', 'type': 'RoutingConfiguration'}, } def __init__( self, **kwargs ): super(VpnConnection, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.remote_vpn_site = kwargs.get('remote_vpn_site', None) self.routing_weight = kwargs.get('routing_weight', None) self.dpd_timeout_seconds = kwargs.get('dpd_timeout_seconds', None) self.connection_status = None self.vpn_connection_protocol_type = kwargs.get('vpn_connection_protocol_type', None) self.ingress_bytes_transferred = None self.egress_bytes_transferred = None self.connection_bandwidth = kwargs.get('connection_bandwidth', None) self.shared_key = kwargs.get('shared_key', None) self.enable_bgp = kwargs.get('enable_bgp', None) self.use_policy_based_traffic_selectors = kwargs.get('use_policy_based_traffic_selectors', None) self.ipsec_policies = kwargs.get('ipsec_policies', None) self.enable_rate_limiting = kwargs.get('enable_rate_limiting', None) self.enable_internet_security = kwargs.get('enable_internet_security', None) self.use_local_azure_ip_address = kwargs.get('use_local_azure_ip_address', None) self.provisioning_state = None self.vpn_link_connections = kwargs.get('vpn_link_connections', None) self.routing_configuration = kwargs.get('routing_configuration', None) class VpnDeviceScriptParameters(msrest.serialization.Model): """Vpn device configuration script generation parameters. :param vendor: The vendor for the vpn device. :type vendor: str :param device_family: The device family for the vpn device. :type device_family: str :param firmware_version: The firmware version for the vpn device. :type firmware_version: str """ _attribute_map = { 'vendor': {'key': 'vendor', 'type': 'str'}, 'device_family': {'key': 'deviceFamily', 'type': 'str'}, 'firmware_version': {'key': 'firmwareVersion', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnDeviceScriptParameters, self).__init__(**kwargs) self.vendor = kwargs.get('vendor', None) self.device_family = kwargs.get('device_family', None) self.firmware_version = kwargs.get('firmware_version', None) class VpnGateway(Resource): """VpnGateway Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param virtual_hub: The VirtualHub to which the gateway belongs. :type virtual_hub: ~azure.mgmt.network.v2020_04_01.models.SubResource :param connections: List of all vpn connections to the gateway. :type connections: list[~azure.mgmt.network.v2020_04_01.models.VpnConnection] :param bgp_settings: Local network gateway's BGP speaker settings. :type bgp_settings: ~azure.mgmt.network.v2020_04_01.models.BgpSettings :ivar provisioning_state: The provisioning state of the VPN gateway resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param vpn_gateway_scale_unit: The scale unit for this vpn gateway. :type vpn_gateway_scale_unit: int """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'virtual_hub': {'key': 'properties.virtualHub', 'type': 'SubResource'}, 'connections': {'key': 'properties.connections', 'type': '[VpnConnection]'}, 'bgp_settings': {'key': 'properties.bgpSettings', 'type': 'BgpSettings'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'vpn_gateway_scale_unit': {'key': 'properties.vpnGatewayScaleUnit', 'type': 'int'}, } def __init__( self, **kwargs ): super(VpnGateway, self).__init__(**kwargs) self.etag = None self.virtual_hub = kwargs.get('virtual_hub', None) self.connections = kwargs.get('connections', None) self.bgp_settings = kwargs.get('bgp_settings', None) self.provisioning_state = None self.vpn_gateway_scale_unit = kwargs.get('vpn_gateway_scale_unit', None) class VpnLinkBgpSettings(msrest.serialization.Model): """BGP settings details for a link. :param asn: The BGP speaker's ASN. :type asn: long :param bgp_peering_address: The BGP peering address and BGP identifier of this BGP speaker. :type bgp_peering_address: str """ _attribute_map = { 'asn': {'key': 'asn', 'type': 'long'}, 'bgp_peering_address': {'key': 'bgpPeeringAddress', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnLinkBgpSettings, self).__init__(**kwargs) self.asn = kwargs.get('asn', None) self.bgp_peering_address = kwargs.get('bgp_peering_address', None) class VpnLinkProviderProperties(msrest.serialization.Model): """List of properties of a link provider. :param link_provider_name: Name of the link provider. :type link_provider_name: str :param link_speed_in_mbps: Link speed. :type link_speed_in_mbps: int """ _attribute_map = { 'link_provider_name': {'key': 'linkProviderName', 'type': 'str'}, 'link_speed_in_mbps': {'key': 'linkSpeedInMbps', 'type': 'int'}, } def __init__( self, **kwargs ): super(VpnLinkProviderProperties, self).__init__(**kwargs) self.link_provider_name = kwargs.get('link_provider_name', None) self.link_speed_in_mbps = kwargs.get('link_speed_in_mbps', None) class VpnPacketCaptureStartParameters(msrest.serialization.Model): """Start packet capture parameters on virtual network gateway. :param filter_data: Start Packet capture parameters. :type filter_data: str """ _attribute_map = { 'filter_data': {'key': 'filterData', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnPacketCaptureStartParameters, self).__init__(**kwargs) self.filter_data = kwargs.get('filter_data', None) class VpnPacketCaptureStopParameters(msrest.serialization.Model): """Stop packet capture parameters. :param sas_url: SAS url for packet capture on virtual network gateway. :type sas_url: str """ _attribute_map = { 'sas_url': {'key': 'sasUrl', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnPacketCaptureStopParameters, self).__init__(**kwargs) self.sas_url = kwargs.get('sas_url', None) class VpnProfileResponse(msrest.serialization.Model): """Vpn Profile Response for package generation. :param profile_url: URL to the VPN profile. :type profile_url: str """ _attribute_map = { 'profile_url': {'key': 'profileUrl', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnProfileResponse, self).__init__(**kwargs) self.profile_url = kwargs.get('profile_url', None) class VpnServerConfigRadiusClientRootCertificate(msrest.serialization.Model): """Properties of the Radius client root certificate of VpnServerConfiguration. :param name: The certificate name. :type name: str :param thumbprint: The Radius client root certificate thumbprint. :type thumbprint: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnServerConfigRadiusClientRootCertificate, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.thumbprint = kwargs.get('thumbprint', None) class VpnServerConfigRadiusServerRootCertificate(msrest.serialization.Model): """Properties of Radius Server root certificate of VpnServerConfiguration. :param name: The certificate name. :type name: str :param public_cert_data: The certificate public data. :type public_cert_data: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'public_cert_data': {'key': 'publicCertData', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnServerConfigRadiusServerRootCertificate, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.public_cert_data = kwargs.get('public_cert_data', None) class VpnServerConfiguration(Resource): """VpnServerConfiguration Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param name_properties_name: The name of the VpnServerConfiguration that is unique within a resource group. :type name_properties_name: str :param vpn_protocols: VPN protocols for the VpnServerConfiguration. :type vpn_protocols: list[str or ~azure.mgmt.network.v2020_04_01.models.VpnGatewayTunnelingProtocol] :param vpn_authentication_types: VPN authentication types for the VpnServerConfiguration. :type vpn_authentication_types: list[str or ~azure.mgmt.network.v2020_04_01.models.VpnAuthenticationType] :param vpn_client_root_certificates: VPN client root certificate of VpnServerConfiguration. :type vpn_client_root_certificates: list[~azure.mgmt.network.v2020_04_01.models.VpnServerConfigVpnClientRootCertificate] :param vpn_client_revoked_certificates: VPN client revoked certificate of VpnServerConfiguration. :type vpn_client_revoked_certificates: list[~azure.mgmt.network.v2020_04_01.models.VpnServerConfigVpnClientRevokedCertificate] :param radius_server_root_certificates: Radius Server root certificate of VpnServerConfiguration. :type radius_server_root_certificates: list[~azure.mgmt.network.v2020_04_01.models.VpnServerConfigRadiusServerRootCertificate] :param radius_client_root_certificates: Radius client root certificate of VpnServerConfiguration. :type radius_client_root_certificates: list[~azure.mgmt.network.v2020_04_01.models.VpnServerConfigRadiusClientRootCertificate] :param vpn_client_ipsec_policies: VpnClientIpsecPolicies for VpnServerConfiguration. :type vpn_client_ipsec_policies: list[~azure.mgmt.network.v2020_04_01.models.IpsecPolicy] :param radius_server_address: The radius server address property of the VpnServerConfiguration resource for point to site client connection. :type radius_server_address: str :param radius_server_secret: The radius secret property of the VpnServerConfiguration resource for point to site client connection. :type radius_server_secret: str :param radius_servers: Multiple Radius Server configuration for VpnServerConfiguration. :type radius_servers: list[~azure.mgmt.network.v2020_04_01.models.RadiusServer] :param aad_authentication_parameters: The set of aad vpn authentication parameters. :type aad_authentication_parameters: ~azure.mgmt.network.v2020_04_01.models.AadAuthenticationParameters :ivar provisioning_state: The provisioning state of the VpnServerConfiguration resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. :vartype provisioning_state: str :ivar p2_s_vpn_gateways: List of references to P2SVpnGateways. :vartype p2_s_vpn_gateways: list[~azure.mgmt.network.v2020_04_01.models.P2SVpnGateway] :ivar etag_properties_etag: A unique read-only string that changes whenever the resource is updated. :vartype etag_properties_etag: str """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'p2_s_vpn_gateways': {'readonly': True}, 'etag_properties_etag': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'vpn_protocols': {'key': 'properties.vpnProtocols', 'type': '[str]'}, 'vpn_authentication_types': {'key': 'properties.vpnAuthenticationTypes', 'type': '[str]'}, 'vpn_client_root_certificates': {'key': 'properties.vpnClientRootCertificates', 'type': '[VpnServerConfigVpnClientRootCertificate]'}, 'vpn_client_revoked_certificates': {'key': 'properties.vpnClientRevokedCertificates', 'type': '[VpnServerConfigVpnClientRevokedCertificate]'}, 'radius_server_root_certificates': {'key': 'properties.radiusServerRootCertificates', 'type': '[VpnServerConfigRadiusServerRootCertificate]'}, 'radius_client_root_certificates': {'key': 'properties.radiusClientRootCertificates', 'type': '[VpnServerConfigRadiusClientRootCertificate]'}, 'vpn_client_ipsec_policies': {'key': 'properties.vpnClientIpsecPolicies', 'type': '[IpsecPolicy]'}, 'radius_server_address': {'key': 'properties.radiusServerAddress', 'type': 'str'}, 'radius_server_secret': {'key': 'properties.radiusServerSecret', 'type': 'str'}, 'radius_servers': {'key': 'properties.radiusServers', 'type': '[RadiusServer]'}, 'aad_authentication_parameters': {'key': 'properties.aadAuthenticationParameters', 'type': 'AadAuthenticationParameters'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'p2_s_vpn_gateways': {'key': 'properties.p2SVpnGateways', 'type': '[P2SVpnGateway]'}, 'etag_properties_etag': {'key': 'properties.etag', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnServerConfiguration, self).__init__(**kwargs) self.etag = None self.name_properties_name = kwargs.get('name_properties_name', None) self.vpn_protocols = kwargs.get('vpn_protocols', None) self.vpn_authentication_types = kwargs.get('vpn_authentication_types', None) self.vpn_client_root_certificates = kwargs.get('vpn_client_root_certificates', None) self.vpn_client_revoked_certificates = kwargs.get('vpn_client_revoked_certificates', None) self.radius_server_root_certificates = kwargs.get('radius_server_root_certificates', None) self.radius_client_root_certificates = kwargs.get('radius_client_root_certificates', None) self.vpn_client_ipsec_policies = kwargs.get('vpn_client_ipsec_policies', None) self.radius_server_address = kwargs.get('radius_server_address', None) self.radius_server_secret = kwargs.get('radius_server_secret', None) self.radius_servers = kwargs.get('radius_servers', None) self.aad_authentication_parameters = kwargs.get('aad_authentication_parameters', None) self.provisioning_state = None self.p2_s_vpn_gateways = None self.etag_properties_etag = None class VpnServerConfigurationsResponse(msrest.serialization.Model): """VpnServerConfigurations list associated with VirtualWan Response. :param vpn_server_configuration_resource_ids: List of VpnServerConfigurations associated with VirtualWan. :type vpn_server_configuration_resource_ids: list[str] """ _attribute_map = { 'vpn_server_configuration_resource_ids': {'key': 'vpnServerConfigurationResourceIds', 'type': '[str]'}, } def __init__( self, **kwargs ): super(VpnServerConfigurationsResponse, self).__init__(**kwargs) self.vpn_server_configuration_resource_ids = kwargs.get('vpn_server_configuration_resource_ids', None) class VpnServerConfigVpnClientRevokedCertificate(msrest.serialization.Model): """Properties of the revoked VPN client certificate of VpnServerConfiguration. :param name: The certificate name. :type name: str :param thumbprint: The revoked VPN client certificate thumbprint. :type thumbprint: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnServerConfigVpnClientRevokedCertificate, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.thumbprint = kwargs.get('thumbprint', None) class VpnServerConfigVpnClientRootCertificate(msrest.serialization.Model): """Properties of VPN client root certificate of VpnServerConfiguration. :param name: The certificate name. :type name: str :param public_cert_data: The certificate public data. :type public_cert_data: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'public_cert_data': {'key': 'publicCertData', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnServerConfigVpnClientRootCertificate, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.public_cert_data = kwargs.get('public_cert_data', None) class VpnSite(Resource): """VpnSite Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param virtual_wan: The VirtualWAN to which the vpnSite belongs. :type virtual_wan: ~azure.mgmt.network.v2020_04_01.models.SubResource :param device_properties: The device properties. :type device_properties: ~azure.mgmt.network.v2020_04_01.models.DeviceProperties :param ip_address: The ip-address for the vpn-site. :type ip_address: str :param site_key: The key for vpn-site that can be used for connections. :type site_key: str :param address_space: The AddressSpace that contains an array of IP address ranges. :type address_space: ~azure.mgmt.network.v2020_04_01.models.AddressSpace :param bgp_properties: The set of bgp properties. :type bgp_properties: ~azure.mgmt.network.v2020_04_01.models.BgpSettings :ivar provisioning_state: The provisioning state of the VPN site resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :param is_security_site: IsSecuritySite flag. :type is_security_site: bool :param vpn_site_links: List of all vpn site links. :type vpn_site_links: list[~azure.mgmt.network.v2020_04_01.models.VpnSiteLink] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'virtual_wan': {'key': 'properties.virtualWan', 'type': 'SubResource'}, 'device_properties': {'key': 'properties.deviceProperties', 'type': 'DeviceProperties'}, 'ip_address': {'key': 'properties.ipAddress', 'type': 'str'}, 'site_key': {'key': 'properties.siteKey', 'type': 'str'}, 'address_space': {'key': 'properties.addressSpace', 'type': 'AddressSpace'}, 'bgp_properties': {'key': 'properties.bgpProperties', 'type': 'BgpSettings'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'is_security_site': {'key': 'properties.isSecuritySite', 'type': 'bool'}, 'vpn_site_links': {'key': 'properties.vpnSiteLinks', 'type': '[VpnSiteLink]'}, } def __init__( self, **kwargs ): super(VpnSite, self).__init__(**kwargs) self.etag = None self.virtual_wan = kwargs.get('virtual_wan', None) self.device_properties = kwargs.get('device_properties', None) self.ip_address = kwargs.get('ip_address', None) self.site_key = kwargs.get('site_key', None) self.address_space = kwargs.get('address_space', None) self.bgp_properties = kwargs.get('bgp_properties', None) self.provisioning_state = None self.is_security_site = kwargs.get('is_security_site', None) self.vpn_site_links = kwargs.get('vpn_site_links', None) class VpnSiteId(msrest.serialization.Model): """VpnSite Resource. Variables are only populated by the server, and will be ignored when sending a request. :ivar vpn_site: The resource-uri of the vpn-site for which config is to be fetched. :vartype vpn_site: str """ _validation = { 'vpn_site': {'readonly': True}, } _attribute_map = { 'vpn_site': {'key': 'vpnSite', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnSiteId, self).__init__(**kwargs) self.vpn_site = None class VpnSiteLink(SubResource): """VpnSiteLink Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar type: Resource type. :vartype type: str :param link_properties: The link provider properties. :type link_properties: ~azure.mgmt.network.v2020_04_01.models.VpnLinkProviderProperties :param ip_address: The ip-address for the vpn-site-link. :type ip_address: str :param fqdn: FQDN of vpn-site-link. :type fqdn: str :param bgp_properties: The set of bgp properties. :type bgp_properties: ~azure.mgmt.network.v2020_04_01.models.VpnLinkBgpSettings :ivar provisioning_state: The provisioning state of the VPN site link resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'link_properties': {'key': 'properties.linkProperties', 'type': 'VpnLinkProviderProperties'}, 'ip_address': {'key': 'properties.ipAddress', 'type': 'str'}, 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, 'bgp_properties': {'key': 'properties.bgpProperties', 'type': 'VpnLinkBgpSettings'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnSiteLink, self).__init__(**kwargs) self.etag = None self.name = kwargs.get('name', None) self.type = None self.link_properties = kwargs.get('link_properties', None) self.ip_address = kwargs.get('ip_address', None) self.fqdn = kwargs.get('fqdn', None) self.bgp_properties = kwargs.get('bgp_properties', None) self.provisioning_state = None class VpnSiteLinkConnection(SubResource): """VpnSiteLinkConnection Resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Resource type. :vartype type: str :param vpn_site_link: Id of the connected vpn site link. :type vpn_site_link: ~azure.mgmt.network.v2020_04_01.models.SubResource :param routing_weight: Routing weight for vpn connection. :type routing_weight: int :ivar connection_status: The connection status. Possible values include: "Unknown", "Connecting", "Connected", "NotConnected". :vartype connection_status: str or ~azure.mgmt.network.v2020_04_01.models.VpnConnectionStatus :param vpn_connection_protocol_type: Connection protocol used for this connection. Possible values include: "IKEv2", "IKEv1". :type vpn_connection_protocol_type: str or ~azure.mgmt.network.v2020_04_01.models.VirtualNetworkGatewayConnectionProtocol :ivar ingress_bytes_transferred: Ingress bytes transferred. :vartype ingress_bytes_transferred: long :ivar egress_bytes_transferred: Egress bytes transferred. :vartype egress_bytes_transferred: long :param connection_bandwidth: Expected bandwidth in MBPS. :type connection_bandwidth: int :param shared_key: SharedKey for the vpn connection. :type shared_key: str :param enable_bgp: EnableBgp flag. :type enable_bgp: bool :param use_policy_based_traffic_selectors: Enable policy-based traffic selectors. :type use_policy_based_traffic_selectors: bool :param ipsec_policies: The IPSec Policies to be considered by this connection. :type ipsec_policies: list[~azure.mgmt.network.v2020_04_01.models.IpsecPolicy] :param enable_rate_limiting: EnableBgp flag. :type enable_rate_limiting: bool :param use_local_azure_ip_address: Use local azure ip to initiate connection. :type use_local_azure_ip_address: bool :ivar provisioning_state: The provisioning state of the VPN site link connection resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState """ _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'connection_status': {'readonly': True}, 'ingress_bytes_transferred': {'readonly': True}, 'egress_bytes_transferred': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'vpn_site_link': {'key': 'properties.vpnSiteLink', 'type': 'SubResource'}, 'routing_weight': {'key': 'properties.routingWeight', 'type': 'int'}, 'connection_status': {'key': 'properties.connectionStatus', 'type': 'str'}, 'vpn_connection_protocol_type': {'key': 'properties.vpnConnectionProtocolType', 'type': 'str'}, 'ingress_bytes_transferred': {'key': 'properties.ingressBytesTransferred', 'type': 'long'}, 'egress_bytes_transferred': {'key': 'properties.egressBytesTransferred', 'type': 'long'}, 'connection_bandwidth': {'key': 'properties.connectionBandwidth', 'type': 'int'}, 'shared_key': {'key': 'properties.sharedKey', 'type': 'str'}, 'enable_bgp': {'key': 'properties.enableBgp', 'type': 'bool'}, 'use_policy_based_traffic_selectors': {'key': 'properties.usePolicyBasedTrafficSelectors', 'type': 'bool'}, 'ipsec_policies': {'key': 'properties.ipsecPolicies', 'type': '[IpsecPolicy]'}, 'enable_rate_limiting': {'key': 'properties.enableRateLimiting', 'type': 'bool'}, 'use_local_azure_ip_address': {'key': 'properties.useLocalAzureIpAddress', 'type': 'bool'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): super(VpnSiteLinkConnection, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.type = None self.vpn_site_link = kwargs.get('vpn_site_link', None) self.routing_weight = kwargs.get('routing_weight', None) self.connection_status = None self.vpn_connection_protocol_type = kwargs.get('vpn_connection_protocol_type', None) self.ingress_bytes_transferred = None self.egress_bytes_transferred = None self.connection_bandwidth = kwargs.get('connection_bandwidth', None) self.shared_key = kwargs.get('shared_key', None) self.enable_bgp = kwargs.get('enable_bgp', None) self.use_policy_based_traffic_selectors = kwargs.get('use_policy_based_traffic_selectors', None) self.ipsec_policies = kwargs.get('ipsec_policies', None) self.enable_rate_limiting = kwargs.get('enable_rate_limiting', None) self.use_local_azure_ip_address = kwargs.get('use_local_azure_ip_address', None) self.provisioning_state = None class WebApplicationFirewallCustomRule(msrest.serialization.Model): """Defines contents of a web application rule. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param name: The name of the resource that is unique within a policy. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param priority: Required. Priority of the rule. Rules with a lower value will be evaluated before rules with a higher value. :type priority: int :param rule_type: Required. The rule type. Possible values include: "MatchRule", "Invalid". :type rule_type: str or ~azure.mgmt.network.v2020_04_01.models.WebApplicationFirewallRuleType :param match_conditions: Required. List of match conditions. :type match_conditions: list[~azure.mgmt.network.v2020_04_01.models.MatchCondition] :param action: Required. Type of Actions. Possible values include: "Allow", "Block", "Log". :type action: str or ~azure.mgmt.network.v2020_04_01.models.WebApplicationFirewallAction """ _validation = { 'name': {'max_length': 128, 'min_length': 0}, 'etag': {'readonly': True}, 'priority': {'required': True}, 'rule_type': {'required': True}, 'match_conditions': {'required': True}, 'action': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'int'}, 'rule_type': {'key': 'ruleType', 'type': 'str'}, 'match_conditions': {'key': 'matchConditions', 'type': '[MatchCondition]'}, 'action': {'key': 'action', 'type': 'str'}, } def __init__( self, **kwargs ): super(WebApplicationFirewallCustomRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.etag = None self.priority = kwargs['priority'] self.rule_type = kwargs['rule_type'] self.match_conditions = kwargs['match_conditions'] self.action = kwargs['action'] class WebApplicationFirewallPolicy(Resource): """Defines web application firewall policy. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param policy_settings: The PolicySettings for policy. :type policy_settings: ~azure.mgmt.network.v2020_04_01.models.PolicySettings :param custom_rules: The custom rules inside the policy. :type custom_rules: list[~azure.mgmt.network.v2020_04_01.models.WebApplicationFirewallCustomRule] :ivar application_gateways: A collection of references to application gateways. :vartype application_gateways: list[~azure.mgmt.network.v2020_04_01.models.ApplicationGateway] :ivar provisioning_state: The provisioning state of the web application firewall policy resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_04_01.models.ProvisioningState :ivar resource_state: Resource status of the policy. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". :vartype resource_state: str or ~azure.mgmt.network.v2020_04_01.models.WebApplicationFirewallPolicyResourceState :param managed_rules: Describes the managedRules structure. :type managed_rules: ~azure.mgmt.network.v2020_04_01.models.ManagedRulesDefinition :ivar http_listeners: A collection of references to application gateway http listeners. :vartype http_listeners: list[~azure.mgmt.network.v2020_04_01.models.SubResource] :ivar path_based_rules: A collection of references to application gateway path rules. :vartype path_based_rules: list[~azure.mgmt.network.v2020_04_01.models.SubResource] """ _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, 'application_gateways': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'resource_state': {'readonly': True}, 'http_listeners': {'readonly': True}, 'path_based_rules': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'policy_settings': {'key': 'properties.policySettings', 'type': 'PolicySettings'}, 'custom_rules': {'key': 'properties.customRules', 'type': '[WebApplicationFirewallCustomRule]'}, 'application_gateways': {'key': 'properties.applicationGateways', 'type': '[ApplicationGateway]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, 'managed_rules': {'key': 'properties.managedRules', 'type': 'ManagedRulesDefinition'}, 'http_listeners': {'key': 'properties.httpListeners', 'type': '[SubResource]'}, 'path_based_rules': {'key': 'properties.pathBasedRules', 'type': '[SubResource]'}, } def __init__( self, **kwargs ): super(WebApplicationFirewallPolicy, self).__init__(**kwargs) self.etag = None self.policy_settings = kwargs.get('policy_settings', None) self.custom_rules = kwargs.get('custom_rules', None) self.application_gateways = None self.provisioning_state = None self.resource_state = None self.managed_rules = kwargs.get('managed_rules', None) self.http_listeners = None self.path_based_rules = None class WebApplicationFirewallPolicyListResult(msrest.serialization.Model): """Result of the request to list WebApplicationFirewallPolicies. It contains a list of WebApplicationFirewallPolicy objects and a URL link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of WebApplicationFirewallPolicies within a resource group. :vartype value: list[~azure.mgmt.network.v2020_04_01.models.WebApplicationFirewallPolicy] :ivar next_link: URL to get the next set of WebApplicationFirewallPolicy objects if there are any. :vartype next_link: str """ _validation = { 'value': {'readonly': True}, 'next_link': {'readonly': True}, } _attribute_map = { 'value': {'key': 'value', 'type': '[WebApplicationFirewallPolicy]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): super(WebApplicationFirewallPolicyListResult, self).__init__(**kwargs) self.value = None self.next_link = None
Azure/azure-sdk-for-python
sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_04_01/models/_models.py
Python
mit
848,302
0.003644
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import datetime from django.conf import settings from haystack.backends import BaseEngine from haystack.backends.elasticsearch_backend import ElasticsearchSearchBackend, ElasticsearchSearchQuery from haystack.constants import DJANGO_CT from haystack.exceptions import MissingDependency from haystack.utils import get_identifier, get_model_ct from haystack.utils import log as logging try: import elasticsearch if not ((2, 0, 0) <= elasticsearch.__version__ < (3, 0, 0)): raise ImportError from elasticsearch.helpers import bulk, scan except ImportError: raise MissingDependency("The 'elasticsearch2' backend requires the \ installation of 'elasticsearch>=2.0.0,<3.0.0'. \ Please refer to the documentation.") class Elasticsearch2SearchBackend(ElasticsearchSearchBackend): def __init__(self, connection_alias, **connection_options): super(Elasticsearch2SearchBackend, self).__init__(connection_alias, **connection_options) self.content_field_name = None def clear(self, models=None, commit=True): """ Clears the backend of all documents/objects for a collection of models. :param models: List or tuple of models to clear. :param commit: Not used. """ if models is not None: assert isinstance(models, (list, tuple)) try: if models is None: self.conn.indices.delete(index=self.index_name, ignore=404) self.setup_complete = False self.existing_mapping = {} self.content_field_name = None else: models_to_delete = [] for model in models: models_to_delete.append("%s:%s" % (DJANGO_CT, get_model_ct(model))) # Delete using scroll API query = {'query': {'query_string': {'query': " OR ".join(models_to_delete)}}} generator = scan(self.conn, query=query, index=self.index_name, doc_type='modelresult') actions = ({ '_op_type': 'delete', '_id': doc['_id'], } for doc in generator) bulk(self.conn, actions=actions, index=self.index_name, doc_type='modelresult') self.conn.indices.refresh(index=self.index_name) except elasticsearch.TransportError as e: if not self.silently_fail: raise if models is not None: self.log.error("Failed to clear Elasticsearch index of models '%s': %s", ','.join(models_to_delete), e, exc_info=True) else: self.log.error("Failed to clear Elasticsearch index: %s", e, exc_info=True) def build_search_kwargs(self, query_string, sort_by=None, start_offset=0, end_offset=None, fields='', highlight=False, facets=None, date_facets=None, query_facets=None, narrow_queries=None, spelling_query=None, within=None, dwithin=None, distance_point=None, models=None, limit_to_registered_models=None, result_class=None): kwargs = super(Elasticsearch2SearchBackend, self).build_search_kwargs(query_string, sort_by, start_offset, end_offset, fields, highlight, spelling_query=spelling_query, within=within, dwithin=dwithin, distance_point=distance_point, models=models, limit_to_registered_models= limit_to_registered_models, result_class=result_class) filters = [] if start_offset is not None: kwargs['from'] = start_offset if end_offset is not None: kwargs['size'] = end_offset - start_offset if narrow_queries is None: narrow_queries = set() if facets is not None: kwargs.setdefault('aggs', {}) for facet_fieldname, extra_options in facets.items(): facet_options = { 'meta': { '_type': 'terms', }, 'terms': { 'field': facet_fieldname, } } if 'order' in extra_options: facet_options['meta']['order'] = extra_options.pop('order') # Special cases for options applied at the facet level (not the terms level). if extra_options.pop('global_scope', False): # Renamed "global_scope" since "global" is a python keyword. facet_options['global'] = True if 'facet_filter' in extra_options: facet_options['facet_filter'] = extra_options.pop('facet_filter') facet_options['terms'].update(extra_options) kwargs['aggs'][facet_fieldname] = facet_options if date_facets is not None: kwargs.setdefault('aggs', {}) for facet_fieldname, value in date_facets.items(): # Need to detect on gap_by & only add amount if it's more than one. interval = value.get('gap_by').lower() # Need to detect on amount (can't be applied on months or years). if value.get('gap_amount', 1) != 1 and interval not in ('month', 'year'): # Just the first character is valid for use. interval = "%s%s" % (value['gap_amount'], interval[:1]) kwargs['aggs'][facet_fieldname] = { 'meta': { '_type': 'date_histogram', }, 'date_histogram': { 'field': facet_fieldname, 'interval': interval, }, 'aggs': { facet_fieldname: { 'date_range': { 'field': facet_fieldname, 'ranges': [ { 'from': self._from_python(value.get('start_date')), 'to': self._from_python(value.get('end_date')), } ] } } } } if query_facets is not None: kwargs.setdefault('aggs', {}) for facet_fieldname, value in query_facets: kwargs['aggs'][facet_fieldname] = { 'meta': { '_type': 'query', }, 'filter': { 'query_string': { 'query': value, } }, } for q in narrow_queries: filters.append({ 'query_string': { 'query': q } }) # if we want to filter, change the query type to filteres if filters: kwargs["query"] = {"filtered": {"query": kwargs.pop("query")}} filtered = kwargs["query"]["filtered"] if 'filter' in filtered: if "bool" in filtered["filter"].keys(): another_filters = kwargs['query']['filtered']['filter']['bool']['must'] else: another_filters = [kwargs['query']['filtered']['filter']] else: another_filters = filters if len(another_filters) == 1: kwargs['query']['filtered']["filter"] = another_filters[0] else: kwargs['query']['filtered']["filter"] = {"bool": {"must": another_filters}} return kwargs def more_like_this(self, model_instance, additional_query_string=None, start_offset=0, end_offset=None, models=None, limit_to_registered_models=None, result_class=None, **kwargs): from haystack import connections if not self.setup_complete: self.setup() # Deferred models will have a different class ("RealClass_Deferred_fieldname") # which won't be in our registry: model_klass = model_instance._meta.concrete_model index = connections[self.connection_alias].get_unified_index().get_index(model_klass) field_name = index.get_content_field() params = {} if start_offset is not None: params['from_'] = start_offset if end_offset is not None: params['size'] = end_offset - start_offset doc_id = get_identifier(model_instance) try: # More like this Query # https://www.elastic.co/guide/en/elasticsearch/reference/2.2/query-dsl-mlt-query.html mlt_query = { 'query': { 'more_like_this': { 'fields': [field_name], 'like': [{ "_id": doc_id }] } } } narrow_queries = [] if additional_query_string and additional_query_string != '*:*': additional_filter = { "query": { "query_string": { "query": additional_query_string } } } narrow_queries.append(additional_filter) if limit_to_registered_models is None: limit_to_registered_models = getattr(settings, 'HAYSTACK_LIMIT_TO_REGISTERED_MODELS', True) if models and len(models): model_choices = sorted(get_model_ct(model) for model in models) elif limit_to_registered_models: # Using narrow queries, limit the results to only models handled # with the current routers. model_choices = self.build_models_list() else: model_choices = [] if len(model_choices) > 0: model_filter = {"terms": {DJANGO_CT: model_choices}} narrow_queries.append(model_filter) if len(narrow_queries) > 0: mlt_query = { "query": { "filtered": { 'query': mlt_query['query'], 'filter': { 'bool': { 'must': list(narrow_queries) } } } } } raw_results = self.conn.search( body=mlt_query, index=self.index_name, doc_type='modelresult', _source=True, **params) except elasticsearch.TransportError as e: if not self.silently_fail: raise self.log.error("Failed to fetch More Like This from Elasticsearch for document '%s': %s", doc_id, e, exc_info=True) raw_results = {} return self._process_results(raw_results, result_class=result_class) def _process_results(self, raw_results, highlight=False, result_class=None, distance_point=None, geo_sort=False): results = super(Elasticsearch2SearchBackend, self)._process_results(raw_results, highlight, result_class, distance_point, geo_sort) facets = {} if 'aggregations' in raw_results: facets = { 'fields': {}, 'dates': {}, 'queries': {}, } for facet_fieldname, facet_info in raw_results['aggregations'].items(): facet_type = facet_info['meta']['_type'] if facet_type == 'terms': facets['fields'][facet_fieldname] = [(individual['key'], individual['doc_count']) for individual in facet_info['buckets']] if 'order' in facet_info['meta']: if facet_info['meta']['order'] == 'reverse_count': srt = sorted(facets['fields'][facet_fieldname], key=lambda x: x[1]) facets['fields'][facet_fieldname] = srt elif facet_type == 'date_histogram': # Elasticsearch provides UTC timestamps with an extra three # decimals of precision, which datetime barfs on. facets['dates'][facet_fieldname] = [(datetime.datetime.utcfromtimestamp(individual['key'] / 1000), individual['doc_count']) for individual in facet_info['buckets']] elif facet_type == 'query': facets['queries'][facet_fieldname] = facet_info['doc_count'] results['facets'] = facets return results class Elasticsearch2SearchQuery(ElasticsearchSearchQuery): pass class Elasticsearch2SearchEngine(BaseEngine): backend = Elasticsearch2SearchBackend query = Elasticsearch2SearchQuery
steventimberman/masterDebater
venv/lib/python2.7/site-packages/haystack/backends/elasticsearch2_backend.py
Python
mit
14,291
0.003149
from time import sleep import os import shutil import merfi from merfi import logger from merfi import util from merfi.collector import RepoCollector from merfi.backends import base class RpmSign(base.BaseBackend): help_menu = 'rpm-sign handler for signing files' _help = """ Signs files with rpm-sign. Crawls a given path looking for Debian repos. Note: this sub-command tells merfi to use Red Hat's internal signing tool inconveniently named "rpm-sign", not the rpmsign(8) command that is a part of the http://rpm.org open-source project. %s Options --key Name of the key to use (see rpm-sign --list-keys) --keyfile File path location of the public keyfile, for example /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release or /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta --nat A NAT is between this system and the signing server. Positional Arguments: [path] The path to crawl for signing repos. Defaults to current working directory """ executable = 'rpm-sign' name = 'rpm-sign' options = ['--key', '--keyfile', '--nat'] def clear_sign(self, path, command): """ When doing a "clearsign" with rpm-sign, the output goes to stdout, so that needs to be captured and written to the default output file for clear signed signatures (InRelease). """ logger.info('signing: %s' % path) out, err, code = util.run_output(command) # Sometimes rpm-sign will fail with this error. I've opened # rhbz#1557014 to resolve this server-side. For now, sleep and retry # as a workaround. These sleep/retry values are suggestions from the # team that runs the signing service. known_failure = "ERROR: unhandled exception occurred: ('')." tries = 1 while known_failure in err and tries < 30: logger.warning('hit known rpm-sign failure.') tries += 1 logger.warning('sleeping, running try #%d in 30 seconds.' % tries) sleep(2) out, err, code = util.run_output(command) if code != 0: for line in err.split('\n'): logger.error('stderr: %s' % line) for line in out.split('\n'): logger.error('stdout: %s' % line) raise RuntimeError('rpm-sign non-zero exit code %d', code) if out.strip() == '': for line in err.split('\n'): logger.error('stderr: %s' % line) logger.error('rpm-sign clearsign provided nothing on stdout') raise RuntimeError('no clearsign signature available') absolute_directory = os.path.dirname(os.path.abspath(path)) with open(os.path.join(absolute_directory, 'InRelease'), 'w') as f: f.write(out) def detached(self, command): return util.run(command) def sign(self): self.keyfile = self.parser.get('--keyfile') if self.keyfile: self.keyfile = os.path.abspath(self.keyfile) if not os.path.isfile(self.keyfile): raise RuntimeError('%s is not a file' % self.keyfile) logger.info('using keyfile "%s" as release.asc' % self.keyfile) self.key = self.parser.get('--key') if not self.key: raise RuntimeError('specify a --key for signing') logger.info('Starting path collection, looking for files to sign') repos = RepoCollector(self.path) if repos: logger.info('%s repos found' % len(repos)) # FIXME: this should spit the actual verified command logger.info('will sign with the following commands:') logger.info('rpm-sign --key "%s" --detachsign Release --output Release.gpg' % self.key) logger.info('rpm-sign --key "%s" --clearsign Release --output InRelease' % self.key) else: logger.warning('No paths found that matched') for repo in repos: # Debian "Release" files: for path in repo.releases: self.sign_release(path) # Public key: if self.keyfile: logger.info('placing release.asc in %s' % repo.path) if merfi.config.get('check'): logger.info('[CHECKMODE] writing release.asc') else: shutil.copyfile( self.keyfile, os.path.join(repo.path, 'release.asc')) def sign_release(self, path): """ Sign a "Release" file from a Debian repo. """ if merfi.config.get('check'): new_gpg_path = path.split('Release')[0]+'Release.gpg' new_in_path = path.split('Release')[0]+'InRelease' logger.info('[CHECKMODE] signing: %s' % path) logger.info('[CHECKMODE] signed: %s' % new_gpg_path) logger.info('[CHECKMODE] signed: %s' % new_in_path) else: os.chdir(os.path.dirname(path)) detached = ['rpm-sign', '--key', self.key, '--detachsign', 'Release', '--output', 'Release.gpg'] clearsign = ['rpm-sign', '--key', self.key, '--clearsign', 'Release'] if self.parser.has('--nat'): detached.insert(1, '--nat') clearsign.insert(1, '--nat') logger.info('signing: %s' % path) self.detached(detached) self.clear_sign(path, clearsign)
alfredodeza/merfi
merfi/backends/rpm_sign.py
Python
mit
5,502
0.000364
import os from fabric.api import run, sudo, cd, env, task, settings from ..literals import FABFILE_MARKER def delete_mayan(): """ Delete Mayan EDMS files from an Linux system """ sudo('rm %(virtualenv_path)s -Rf' % env) def install_mayan(): """ Install Mayan EDMS on an Linux system """ with cd(env.install_path): sudo('virtualenv --no-site-packages %(virtualenv_name)s' % env) with cd(env.virtualenv_path): sudo('git clone git://github.com/rosarior/mayan.git %(repository_name)s' % env) sudo('source bin/activate; pip install --upgrade distribute') sudo('source bin/activate; pip install -r %(repository_name)s/requirements/production.txt' % env) def post_install(): """ Post install process on a Linux systems """ fabfile_marker = os.path.join(env.repository_path, FABFILE_MARKER) sudo('touch %s' % fabfile_marker)
appsembler/mayan_appsembler
fabfile/platforms/linux.py
Python
gpl-3.0
922
0.004338
# Copyright 2016 Rackspace # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """ Manages Tempest workspaces This command is used for managing tempest workspaces Commands ======== list ---- Outputs the name and path of all known tempest workspaces register -------- Registers a new tempest workspace via a given ``--name`` and ``--path`` rename ------ Renames a tempest workspace from ``--old-name`` to ``--new-name`` move ---- Changes the path of a given tempest workspace ``--name`` to ``--path`` remove ------ Deletes the entry for a given tempest workspace ``--name`` ``--rmdir`` Deletes the given tempest workspace directory General Options =============== * ``--workspace_path``: Allows the user to specify a different location for the workspace.yaml file containing the workspace definitions instead of ``~/.tempest/workspace.yaml`` """ import os import shutil import sys from cliff import command from cliff import lister from oslo_concurrency import lockutils import yaml from tempest import config CONF = config.CONF class WorkspaceManager(object): def __init__(self, path=None): lockutils.get_lock_path(CONF) self.path = path or os.path.join( os.path.expanduser("~"), ".tempest", "workspace.yaml") if not os.path.isdir(os.path.dirname(self.path)): os.makedirs(self.path.rsplit(os.path.sep, 1)[0]) self.workspaces = {} @lockutils.synchronized('workspaces', external=True) def get_workspace(self, name): """Returns the workspace that has the given name If the workspace isn't registered then `None` is returned. """ self._populate() return self.workspaces.get(name) @lockutils.synchronized('workspaces', external=True) def rename_workspace(self, old_name, new_name): self._populate() self._name_exists(old_name) self._invalid_name_check(new_name) self._workspace_name_exists(new_name) self.workspaces[new_name] = self.workspaces.pop(old_name) self._write_file() @lockutils.synchronized('workspaces', external=True) def move_workspace(self, name, path): self._populate() path = os.path.abspath(os.path.expanduser(path)) if path else path self._name_exists(name) self._validate_path(path) self.workspaces[name] = path self._write_file() def _name_exists(self, name): if name not in self.workspaces: print("A workspace was not found with name: {0}".format(name)) sys.exit(1) @lockutils.synchronized('workspaces', external=True) def remove_workspace_entry(self, name): self._populate() self._name_exists(name) workspace_path = self.workspaces.pop(name) self._write_file() return workspace_path @lockutils.synchronized('workspaces', external=True) def remove_workspace_directory(self, workspace_path): self._validate_path(workspace_path) shutil.rmtree(workspace_path) @lockutils.synchronized('workspaces', external=True) def list_workspaces(self): self._populate() self._validate_workspaces() return self.workspaces def _workspace_name_exists(self, name): if name in self.workspaces: print("A workspace already exists with name: {0}.".format( name)) sys.exit(1) def _invalid_name_check(self, name): if not name: print("None or empty name is specified." " Please specify correct name for workspace.") sys.exit(1) def _validate_path(self, path): if not path: print("None or empty path is specified for workspace." " Please specify correct workspace path.") sys.exit(1) if not os.path.exists(path): print("Path does not exist.") sys.exit(1) @lockutils.synchronized('workspaces', external=True) def register_new_workspace(self, name, path, init=False): """Adds the new workspace and writes out the new workspace config""" self._populate() path = os.path.abspath(os.path.expanduser(path)) if path else path # This only happens when register is called from outside of init if not init: self._validate_path(path) self._invalid_name_check(name) self._workspace_name_exists(name) self.workspaces[name] = path self._write_file() def _validate_workspaces(self): if self.workspaces is not None: self.workspaces = {n: p for n, p in self.workspaces.items() if os.path.exists(p)} self._write_file() def _write_file(self): with open(self.path, 'w') as f: f.write(yaml.dump(self.workspaces)) def _populate(self): if not os.path.isfile(self.path): return with open(self.path, 'r') as f: self.workspaces = yaml.safe_load(f) or {} def add_global_arguments(parser): parser.add_argument( '--workspace-path', required=False, default=None, help="The path to the workspace file, the default is " "~/.tempest/workspace.yaml") return parser class TempestWorkspaceRegister(command.Command): def get_description(self): return ('Registers a new tempest workspace via a given ' '--name and --path') def get_parser(self, prog_name): parser = super(TempestWorkspaceRegister, self).get_parser(prog_name) add_global_arguments(parser) parser.add_argument('--name', required=True) parser.add_argument('--path', required=True) return parser def take_action(self, parsed_args): self.manager = WorkspaceManager(parsed_args.workspace_path) self.manager.register_new_workspace(parsed_args.name, parsed_args.path) sys.exit(0) class TempestWorkspaceRename(command.Command): def get_description(self): return 'Renames a tempest workspace from --old-name to --new-name' def get_parser(self, prog_name): parser = super(TempestWorkspaceRename, self).get_parser(prog_name) add_global_arguments(parser) parser.add_argument('--old-name', required=True) parser.add_argument('--new-name', required=True) return parser def take_action(self, parsed_args): self.manager = WorkspaceManager(parsed_args.workspace_path) self.manager.rename_workspace( parsed_args.old_name, parsed_args.new_name) sys.exit(0) class TempestWorkspaceMove(command.Command): def get_description(self): return 'Changes the path of a given tempest workspace --name to --path' def get_parser(self, prog_name): parser = super(TempestWorkspaceMove, self).get_parser(prog_name) add_global_arguments(parser) parser.add_argument('--name', required=True) parser.add_argument('--path', required=True) return parser def take_action(self, parsed_args): self.manager = WorkspaceManager(parsed_args.workspace_path) self.manager.move_workspace(parsed_args.name, parsed_args.path) sys.exit(0) class TempestWorkspaceRemove(command.Command): def get_description(self): return 'Deletes the entry for a given tempest workspace --name' def get_parser(self, prog_name): parser = super(TempestWorkspaceRemove, self).get_parser(prog_name) add_global_arguments(parser) parser.add_argument('--name', required=True) parser.add_argument('--rmdir', action='store_true', help='Deletes the given workspace directory') return parser def take_action(self, parsed_args): self.manager = WorkspaceManager(parsed_args.workspace_path) workspace_path = self.manager.remove_workspace_entry(parsed_args.name) if parsed_args.rmdir: self.manager.remove_workspace_directory(workspace_path) sys.exit(0) class TempestWorkspaceList(lister.Lister): def get_description(self): return 'Outputs the name and path of all known tempest workspaces' def get_parser(self, prog_name): parser = super(TempestWorkspaceList, self).get_parser(prog_name) add_global_arguments(parser) return parser def take_action(self, parsed_args): self.manager = WorkspaceManager(parsed_args.workspace_path) return (("Name", "Path"), ((n, p) for n, p in self.manager.list_workspaces().items()))
cisco-openstack/tempest
tempest/cmd/workspace.py
Python
apache-2.0
9,103
0
from django.core.mail import send_mail from django.template.loader import render_to_string from wanawana.utils import get_base_url def send_admin_link_on_event_creation(request, event): if not event.admin_email: return email_body = render_to_string("emails/new_event.txt", { "url_scheme": request.META["wsgi.url_scheme"], "base_url": get_base_url(request), "event_slug": event.slug, "event_admin_id": event.admin_id }) send_mail("[WanaWana] the admin url for you event '%s'" % (event.title), email_body, 'noreply@%s' % get_base_url(request), [event.admin_email] ) def send_admin_notification_of_answer_on_event(request, event, event_attending): if not event.admin_email or not event.send_notification_emails: return email_body = render_to_string("emails/event_attending_answer.txt", { "url_scheme": request.META["wsgi.url_scheme"], "base_url": get_base_url(request), "event_attending": event_attending, "event": event, }) send_mail("[Wanawana] %s has answer '%s' to your event '%s'" % (event_attending.name, event_attending.choice, event.title), email_body, "noreply@%s" % get_base_url(request), [event.admin_email]) def send_admin_notification_of_answer_modification(request, event, event_attending, modifications): if not event.admin_email or not event.send_notification_emails or not modifications: return email_body = render_to_string("emails/event_attending_answer_modification.txt", { "url_scheme": request.META["wsgi.url_scheme"], "base_url": get_base_url(request), "event_attending": event_attending, "event": event, "modifications": modifications, }) send_mail("[Wanawana] %s has modify his answer to your event '%s'" % (event_attending.name, event.title), email_body, "noreply@%s" % get_base_url(request), [event.admin_email]) def send_admin_notification_for_new_comment(request, event, comment): if not event.admin_email or not event.send_notification_emails: return email_body = render_to_string("emails/event_for_admin_new_comment.txt", { "url_scheme": request.META["wsgi.url_scheme"], "base_url": get_base_url(request), "event": event, "comment": comment, }) send_mail("[Wanawana] new comment by %s to your event '%s'" % (comment.name, event.title), email_body, "noreply@%s" % get_base_url(request), [event.admin_email])
Psycojoker/wanawana
events/emails.py
Python
gpl-3.0
2,656
0.006401
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals # Character ranges of letters letters = 'a-zA-Z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u0103\u0106\u0107\ \u010c-\u010f\u0112-\u0115\u011a-\u012d\u0131\u0141\u0142\u0147\u0148\ \u0150-\u0153\u0158-\u0161\u0164\u0165\u016e-\u0171\u017d\u017e\ \u0391-\u03a1\u03a3-\u03a9\u03b1-\u03c9\u03d1\u03d2\u03d5\u03d6\ \u03da-\u03e1\u03f0\u03f1\u03f5\u210a-\u210c\u2110-\u2113\u211b\u211c\ \u2128\u212c\u212d\u212f-\u2131\u2133-\u2138\uf6b2-\uf6b5\uf6b7\uf6b9\ \uf6ba-\uf6bc\uf6be\uf6bf\uf6c1-\uf700\uf730\uf731\uf770\uf772\uf773\ \uf776\uf779\uf77a\uf77d-\uf780\uf782-\uf78b\uf78d-\uf78f\uf790\ \uf793-\uf79a\uf79c-\uf7a2\uf7a4-\uf7bd\uf800-\uf833\ufb01\ufb02' # Character ranges of letterlikes letterlikes = '\u0024\u00A1\u00A2\u00A3\u00A5\u00A7\u00A9\u00AB\u00AE\ \u00B0\u00B5\u00B6\u00B8\u00BB\u00BF\u02C7\u02D8\u2013\u2014\u2020\u2021\ \u2022\u2026\u2032\u2033\u2035\u2036\u2060\u20AC\u210F\u2122\u2127\u212B\ \u21B5\u2205\u221E\u221F\u2220\u2221\u2222\u22EE\u22EF\u22F0\u22F1\u2300\ \u2318\u231A\u23B4\u23B5\u2500\u2502\u25A0\u25A1\u25AA\u25AE\u25AF\u25B2\ \u25B3\u25BC\u25BD\u25C0\u25C6\u25C7\u25CB\u25CF\u25E6\u25FB\u25FC\u2605\ \u2639\u263A\u2660\u2661\u2662\u2663\u266D\u266E\u266F\u2736\uF3A0\uF3B8\ \uF3B9\uF527\uF528\uF720\uF721\uF722\uF723\uF725\uF749\uF74A\uF74D\uF74E\ \uF74F\uF750\uF751\uF752\uF753\uF754\uF755\uF756\uF757\uF760\uF763\uF766\ \uF768\uF769\uF76A\uF76B\uF76C\uF7D4\uF800\uF801\uF802\uF803\uF804\uF805\ \uF806\uF807\uF808\uF809\uF80A\uF80B\uF80C\uF80D\uF80E\uF80F\uF810\uF811\ \uF812\uF813\uF814\uF815\uF816\uF817\uF818\uF819\uF81A\uF81B\uF81C\uF81D\ \uF81E\uF81F\uF820\uF821\uF822\uF823\uF824\uF825\uF826\uF827\uF828\uF829\ \uF82A\uF82B\uF82C\uF82D\uF82E\uF82F\uF830\uF831\uF832\uF833\uFE35\uFE36\ \uFE37\uFE38' # All supported longname characters named_characters = { 'AAcute': '\u00E1', 'ABar': '\u0101', 'ACup': '\u0103', 'ADoubleDot': '\u00E4', 'AE': '\u00E6', 'AGrave': '\u00E0', 'AHat': '\u00E2', 'Aleph': '\u2135', 'AliasDelimiter': '\uF764', 'AliasIndicator': '\uF768', 'AlignmentMarker': '\uF760', 'Alpha': '\u03B1', 'AltKey': '\uF7D1', 'And': '\u2227', 'Angle': '\u2220', 'Angstrom': '\u212B', 'ARing': '\u00E5', 'AscendingEllipsis': '\u22F0', 'ATilde': '\u00E3', 'AutoLeftMatch': '\uF3A8', 'AutoOperand': '\uF3AE', 'AutoPlaceholder': '\uF3A4', 'AutoRightMatch': '\uF3A9', 'AutoSpace': '\uF3AD', 'Backslash': '\u2216', 'BeamedEighthNote': '\u266B', 'BeamedSixteenthNote': '\u266C', 'Because': '\u2235', 'Bet': '\u2136', 'Beta': '\u03B2', 'BlackBishop': '\u265D', 'BlackKing': '\u265A', 'BlackKnight': '\u265E', 'BlackPawn': '\u265F', 'BlackQueen': '\u265B', 'BlackRook': '\u265C', 'Breve': '\u02D8', 'Bullet': '\u2022', 'CAcute': '\u0107', 'CapitalAAcute': '\u00C1', 'CapitalABar': '\u0100', 'CapitalACup': '\u0102', 'CapitalADoubleDot': '\u00C4', 'CapitalAE': '\u00C6', 'CapitalAGrave': '\u00C0', 'CapitalAHat': '\u00C2', 'CapitalAlpha': '\u0391', 'CapitalARing': '\u00C5', 'CapitalATilde': '\u00C3', 'CapitalBeta': '\u0392', 'CapitalCAcute': '\u0106', 'CapitalCCedilla': '\u00C7', 'CapitalCHacek': '\u010C', 'CapitalChi': '\u03A7', 'CapitalDelta': '\u0394', 'CapitalDHacek': '\u010E', 'CapitalDifferentialD': '\uF74B', 'CapitalDigamma': '\u03DC', 'CapitalEAcute': '\u00C9', 'CapitalEBar': '\u0112', 'CapitalECup': '\u0114', 'CapitalEDoubleDot': '\u00CB', 'CapitalEGrave': '\u00C8', 'CapitalEHacek': '\u011A', 'CapitalEHat': '\u00CA', 'CapitalEpsilon': '\u0395', 'CapitalEta': '\u0397', 'CapitalEth': '\u00D0', 'CapitalGamma': '\u0393', 'CapitalIAcute': '\u00CD', 'CapitalICup': '\u012C', 'CapitalIDoubleDot': '\u00CF', 'CapitalIGrave': '\u00CC', 'CapitalIHat': '\u00CE', 'CapitalIota': '\u0399', 'CapitalKappa': '\u039A', 'CapitalKoppa': '\u03DE', 'CapitalLambda': '\u039B', 'CapitalLSlash': '\u0141', 'CapitalMu': '\u039C', 'CapitalNHacek': '\u0147', 'CapitalNTilde': '\u00D1', 'CapitalNu': '\u039D', 'CapitalOAcute': '\u00D3', 'CapitalODoubleAcute': '\u0150', 'CapitalODoubleDot': '\u00D6', 'CapitalOE': '\u0152', 'CapitalOGrave': '\u00D2', 'CapitalOHat': '\u00D4', 'CapitalOmega': '\u03A9', 'CapitalOmicron': '\u039F', 'CapitalOSlash': '\u00D8', 'CapitalOTilde': '\u00D5', 'CapitalPhi': '\u03A6', 'CapitalPi': '\u03A0', 'CapitalPsi': '\u03A8', 'CapitalRHacek': '\u0158', 'CapitalRho': '\u03A1', 'CapitalSampi': '\u03E0', 'CapitalSHacek': '\u0160', 'CapitalSigma': '\u03A3', 'CapitalStigma': '\u03DA', 'CapitalTau': '\u03A4', 'CapitalTHacek': '\u0164', 'CapitalTheta': '\u0398', 'CapitalThorn': '\u00DE', 'CapitalUAcute': '\u00DA', 'CapitalUDoubleAcute': '\u0170', 'CapitalUDoubleDot': '\u00DC', 'CapitalUGrave': '\u00D9', 'CapitalUHat': '\u00DB', 'CapitalUpsilon': '\u03A5', 'CapitalURing': '\u016E', 'CapitalXi': '\u039E', 'CapitalYAcute': '\u00DD', 'CapitalZeta': '\u0396', 'CapitalZHacek': '\u017D', 'Cap': '\u2322', 'CCedilla': '\u00E7', 'Cedilla': '\u00B8', 'CenterDot': '\u00B7', 'CenterEllipsis': '\u22EF', 'Cent': '\u00A2', 'CHacek': '\u010D', 'Checkmark': '\u2713', 'Chi': '\u03C7', 'CircleDot': '\u2299', 'CircleMinus': '\u2296', 'CirclePlus': '\u2295', 'CircleTimes': '\u2297', 'ClockwiseContourIntegral': '\u2232', 'CloseCurlyDoubleQuote': '\u201D', 'CloseCurlyQuote': '\u2019', 'CloverLeaf': '\u2318', 'ClubSuit': '\u2663', 'Colon': '\u2236', 'CommandKey': '\uF76A', 'Congruent': '\u2261', 'Conjugate': '\uF3C8', 'ConjugateTranspose': '\uF3C9', 'ConstantC': '\uF7DA', 'Continuation': '\uF3B1', 'ContourIntegral': '\u222E', 'ControlKey': '\uF763', 'Coproduct': '\u2210', 'Copyright': '\u00A9', 'CounterClockwiseContourIntegral': '\u2233', 'Cross': '\uF4A0', 'CupCap': '\u224D', 'Cup': '\u2323', 'CurlyCapitalUpsilon': '\u03D2', 'CurlyEpsilon': '\u03B5', 'CurlyKappa': '\u03F0', 'CurlyPhi': '\u03C6', 'CurlyPi': '\u03D6', 'CurlyRho': '\u03F1', 'CurlyTheta': '\u03D1', 'Currency': '\u00A4', 'Dagger': '\u2020', 'Dalet': '\u2138', 'Dash': '\u2013', 'Degree': '\u00B0', 'DeleteKey': '\uF7D0', 'Del': '\u2207', 'Delta': '\u03B4', 'DescendingEllipsis': '\u22F1', 'DHacek': '\u010F', 'Diameter': '\u2300', 'Diamond': '\u22C4', 'DiamondSuit': '\u2662', 'DifferenceDelta': '\u2206', 'DifferentialD': '\uF74C', 'Digamma': '\u03DD', 'DiscreteRatio': '\uF4A4', 'DiscreteShift': '\uF4A3', 'DiscretionaryHyphen': '\u00AD', 'DiscretionaryLineSeparator': '\uF76E', 'DiscretionaryParagraphSeparator': '\uF76F', 'Divide': '\u00F7', 'DotEqual': '\u2250', 'DotlessI': '\u0131', 'DotlessJ': '\uF700', 'DottedSquare': '\uF751', 'DoubleContourIntegral': '\u222F', 'DoubleDagger': '\u2021', 'DoubledGamma': '\uF74A', 'DoubleDownArrow': '\u21D3', 'DoubledPi': '\uF749', 'DoubleLeftArrow': '\u21D0', 'DoubleLeftRightArrow': '\u21D4', 'DoubleLeftTee': '\u2AE4', 'DoubleLongLeftArrow': '\u27F8', 'DoubleLongLeftRightArrow': '\u27FA', 'DoubleLongRightArrow': '\u27F9', 'DoublePrime': '\u2033', 'DoubleRightArrow': '\u21D2', 'DoubleRightTee': '\u22A8', 'DoubleStruckA': '\uF6E6', 'DoubleStruckB': '\uF6E7', 'DoubleStruckC': '\uF6E8', 'DoubleStruckCapitalA': '\uF7A4', 'DoubleStruckCapitalB': '\uF7A5', 'DoubleStruckCapitalC': '\uF7A6', 'DoubleStruckCapitalD': '\uF7A7', 'DoubleStruckCapitalE': '\uF7A8', 'DoubleStruckCapitalF': '\uF7A9', 'DoubleStruckCapitalG': '\uF7AA', 'DoubleStruckCapitalH': '\uF7AB', 'DoubleStruckCapitalI': '\uF7AC', 'DoubleStruckCapitalJ': '\uF7AD', 'DoubleStruckCapitalK': '\uF7AE', 'DoubleStruckCapitalL': '\uF7AF', 'DoubleStruckCapitalM': '\uF7B0', 'DoubleStruckCapitalN': '\uF7B1', 'DoubleStruckCapitalO': '\uF7B2', 'DoubleStruckCapitalP': '\uF7B3', 'DoubleStruckCapitalQ': '\uF7B4', 'DoubleStruckCapitalR': '\uF7B5', 'DoubleStruckCapitalS': '\uF7B6', 'DoubleStruckCapitalT': '\uF7B7', 'DoubleStruckCapitalU': '\uF7B8', 'DoubleStruckCapitalV': '\uF7B9', 'DoubleStruckCapitalW': '\uF7BA', 'DoubleStruckCapitalX': '\uF7BB', 'DoubleStruckCapitalY': '\uF7BC', 'DoubleStruckCapitalZ': '\uF7BD', 'DoubleStruckD': '\uF6E9', 'DoubleStruckE': '\uF6EA', 'DoubleStruckEight': '\uF7E3', 'DoubleStruckF': '\uF6EB', 'DoubleStruckFive': '\uF7E0', 'DoubleStruckFour': '\uF7DF', 'DoubleStruckG': '\uF6EC', 'DoubleStruckH': '\uF6ED', 'DoubleStruckI': '\uF6EE', 'DoubleStruckJ': '\uF6EF', 'DoubleStruckK': '\uF6F0', 'DoubleStruckL': '\uF6F1', 'DoubleStruckM': '\uF6F2', 'DoubleStruckN': '\uF6F3', 'DoubleStruckNine': '\uF7E4', 'DoubleStruckO': '\uF6F4', 'DoubleStruckOne': '\uF7DC', 'DoubleStruckP': '\uF6F5', 'DoubleStruckQ': '\uF6F6', 'DoubleStruckR': '\uF6F7', 'DoubleStruckS': '\uF6F8', 'DoubleStruckSeven': '\uF7E2', 'DoubleStruckSix': '\uF7E1', 'DoubleStruckT': '\uF6F9', 'DoubleStruckThree': '\uF7DE', 'DoubleStruckTwo': '\uF7DD', 'DoubleStruckU': '\uF6FA', 'DoubleStruckV': '\uF6FB', 'DoubleStruckW': '\uF6FC', 'DoubleStruckX': '\uF6FD', 'DoubleStruckY': '\uF6FE', 'DoubleStruckZ': '\uF6FF', 'DoubleStruckZero': '\uF7DB', 'DoubleUpArrow': '\u21D1', 'DoubleUpDownArrow': '\u21D5', 'DoubleVerticalBar': '\u2225', 'DownArrowBar': '\u2913', 'DownArrow': '\u2193', 'DownArrowUpArrow': '\u21F5', 'DownBreve': '\uF755', 'DownExclamation': '\u00A1', 'DownLeftRightVector': '\u2950', 'DownLeftTeeVector': '\u295E', 'DownLeftVector': '\u21BD', 'DownLeftVectorBar': '\u2956', 'DownPointer': '\u25BE', 'DownQuestion': '\u00BF', 'DownRightTeeVector': '\u295F', 'DownRightVector': '\u21C1', 'DownRightVectorBar': '\u2957', 'DownTeeArrow': '\u21A7', 'DownTee': '\u22A4', 'EAcute': '\u00E9', 'Earth': '\u2641', 'EBar': '\u0113', 'ECup': '\u0115', 'EDoubleDot': '\u00EB', 'EGrave': '\u00E8', 'EHacek': '\u011B', 'EHat': '\u00EA', 'EighthNote': '\u266A', 'Element': '\u2208', 'Ellipsis': '\u2026', 'EmptyCircle': '\u25CB', 'EmptyDiamond': '\u25C7', 'EmptyDownTriangle': '\u25BD', 'EmptyRectangle': '\u25AF', 'EmptySet': '\u2205', 'EmptySmallCircle': '\u25E6', 'EmptySmallSquare': '\u25FB', 'EmptySquare': '\u25A1', 'EmptyUpTriangle': '\u25B3', 'EmptyVerySmallSquare': '\u25AB', 'EnterKey': '\uF7D4', 'EntityEnd': '\uF3B9', 'EntityStart': '\uF3B8', 'Epsilon': '\u03F5', 'Equal': '\uF431', 'EqualTilde': '\u2242', 'Equilibrium': '\u21CC', 'Equivalent': '\u29E6', 'ErrorIndicator': '\uF767', 'EscapeKey': '\uF769', 'Eta': '\u03B7', 'Eth': '\u00F0', 'Euro': '\u20AC', 'Exists': '\u2203', 'ExponentialE': '\uF74D', 'FiLigature': '\uFB01', 'FilledCircle': '\u25CF', 'FilledDiamond': '\u25C6', 'FilledDownTriangle': '\u25BC', 'FilledLeftTriangle': '\u25C0', 'FilledRectangle': '\u25AE', 'FilledRightTriangle': '\u25B6', 'FilledSmallCircle': '\uF750', 'FilledSmallSquare': '\u25FC', 'FilledSquare': '\u25A0', 'FilledUpTriangle': '\u25B2', 'FilledVerySmallSquare': '\u25AA', 'FinalSigma': '\u03C2', 'FirstPage': '\uF7FA', 'FivePointedStar': '\u2605', 'Flat': '\u266D', 'FlLigature': '\uFB02', 'Florin': '\u0192', 'ForAll': '\u2200', 'FormalA': '\uF800', 'FormalB': '\uF801', 'FormalC': '\uF802', 'FormalCapitalA': '\uF81A', 'FormalCapitalB': '\uF81B', 'FormalCapitalC': '\uF81C', 'FormalCapitalD': '\uF81D', 'FormalCapitalE': '\uF81E', 'FormalCapitalF': '\uF81F', 'FormalCapitalG': '\uF820', 'FormalCapitalH': '\uF821', 'FormalCapitalI': '\uF822', 'FormalCapitalJ': '\uF823', 'FormalCapitalK': '\uF824', 'FormalCapitalL': '\uF825', 'FormalCapitalM': '\uF826', 'FormalCapitalN': '\uF827', 'FormalCapitalO': '\uF828', 'FormalCapitalP': '\uF829', 'FormalCapitalQ': '\uF82A', 'FormalCapitalR': '\uF82B', 'FormalCapitalS': '\uF82C', 'FormalCapitalT': '\uF82D', 'FormalCapitalU': '\uF82E', 'FormalCapitalV': '\uF82F', 'FormalCapitalW': '\uF830', 'FormalCapitalX': '\uF831', 'FormalCapitalY': '\uF832', 'FormalCapitalZ': '\uF833', 'FormalD': '\uF803', 'FormalE': '\uF804', 'FormalF': '\uF805', 'FormalG': '\uF806', 'FormalH': '\uF807', 'FormalI': '\uF808', 'FormalJ': '\uF809', 'FormalK': '\uF80A', 'FormalL': '\uF80B', 'FormalM': '\uF80C', 'FormalN': '\uF80D', 'FormalO': '\uF80E', 'FormalP': '\uF80F', 'FormalQ': '\uF810', 'FormalR': '\uF811', 'FormalS': '\uF812', 'FormalT': '\uF813', 'FormalU': '\uF814', 'FormalV': '\uF815', 'FormalW': '\uF816', 'FormalX': '\uF817', 'FormalY': '\uF818', 'FormalZ': '\uF819', 'FreakedSmiley': '\uF721', 'Function': '\uF4A1', 'Gamma': '\u03B3', 'Gimel': '\u2137', 'GothicA': '\uF6CC', 'GothicB': '\uF6CD', 'GothicC': '\uF6CE', 'GothicCapitalA': '\uF78A', 'GothicCapitalB': '\uF78B', 'GothicCapitalC': '\u212D', 'GothicCapitalD': '\uF78D', 'GothicCapitalE': '\uF78E', 'GothicCapitalF': '\uF78F', 'GothicCapitalG': '\uF790', 'GothicCapitalH': '\u210C', 'GothicCapitalI': '\u2111', 'GothicCapitalJ': '\uF793', 'GothicCapitalK': '\uF794', 'GothicCapitalL': '\uF795', 'GothicCapitalM': '\uF796', 'GothicCapitalN': '\uF797', 'GothicCapitalO': '\uF798', 'GothicCapitalP': '\uF799', 'GothicCapitalQ': '\uF79A', 'GothicCapitalR': '\u211C', 'GothicCapitalS': '\uF79C', 'GothicCapitalT': '\uF79D', 'GothicCapitalU': '\uF79E', 'GothicCapitalV': '\uF79F', 'GothicCapitalW': '\uF7A0', 'GothicCapitalX': '\uF7A1', 'GothicCapitalY': '\uF7A2', 'GothicCapitalZ': '\u2128', 'GothicD': '\uF6CF', 'GothicE': '\uF6D0', 'GothicEight': '\uF7ED', 'GothicF': '\uF6D1', 'GothicFive': '\uF7EA', 'GothicFour': '\uF7E9', 'GothicG': '\uF6D2', 'GothicH': '\uF6D3', 'GothicI': '\uF6D4', 'GothicJ': '\uF6D5', 'GothicK': '\uF6D6', 'GothicL': '\uF6D7', 'GothicM': '\uF6D8', 'GothicN': '\uF6D9', 'GothicNine': '\uF7EF', 'GothicO': '\uF6DA', 'GothicOne': '\uF7E6', 'GothicP': '\uF6DB', 'GothicQ': '\uF6DC', 'GothicR': '\uF6DD', 'GothicS': '\uF6DE', 'GothicSeven': '\uF7EC', 'GothicSix': '\uF7EB', 'GothicT': '\uF6DF', 'GothicThree': '\uF7E8', 'GothicTwo': '\uF7E7', 'GothicU': '\uF6E0', 'GothicV': '\uF6E1', 'GothicW': '\uF6E2', 'GothicX': '\uF6E3', 'GothicY': '\uF6E4', 'GothicZ': '\uF6E5', 'GothicZero': '\uF7E5', 'GrayCircle': '\uF753', 'GraySquare': '\uF752', 'GreaterEqualLess': '\u22DB', 'GreaterEqual': '\u2265', 'GreaterFullEqual': '\u2267', 'GreaterGreater': '\u226B', 'GreaterLess': '\u2277', 'GreaterSlantEqual': '\u2A7E', 'GreaterTilde': '\u2273', 'Hacek': '\u02C7', 'HappySmiley': '\u263A', 'HBar': '\u210F', 'HeartSuit': '\u2661', 'HermitianConjugate': '\uF3CE', 'HorizontalLine': '\u2500', 'HumpDownHump': '\u224E', 'HumpEqual': '\u224F', 'Hyphen': '\u2010', 'IAcute': '\u00ED', 'ICup': '\u012D', 'IDoubleDot': '\u00EF', 'IGrave': '\u00EC', 'IHat': '\u00EE', 'ImaginaryI': '\uF74E', 'ImaginaryJ': '\uF74F', 'ImplicitPlus': '\uF39E', 'Implies': '\uF523', 'Infinity': '\u221E', 'Integral': '\u222B', 'Intersection': '\u22C2', 'InvisibleApplication': '\uF76D', 'InvisibleComma': '\uF765', 'InvisiblePostfixScriptBase': '\uF3B4', 'InvisiblePrefixScriptBase': '\uF3B3', 'InvisibleSpace': '\uF360', 'InvisibleTimes': '\u2062', 'Iota': '\u03B9', 'Jupiter': '\u2643', 'Kappa': '\u03BA', 'KernelIcon': '\uF756', 'Koppa': '\u03DF', 'Lambda': '\u03BB', 'LastPage': '\uF7FB', 'LeftAngleBracket': '\u2329', 'LeftArrowBar': '\u21E4', 'LeftArrow': '\u2190', 'LeftArrowRightArrow': '\u21C6', 'LeftBracketingBar': '\uF603', 'LeftCeiling': '\u2308', 'LeftDoubleBracket': '\u301A', 'LeftDoubleBracketingBar': '\uF605', 'LeftDownTeeVector': '\u2961', 'LeftDownVectorBar': '\u2959', 'LeftDownVector': '\u21C3', 'LeftFloor': '\u230A', 'LeftGuillemet': '\u00AB', 'LeftModified': '\uF76B', 'LeftPointer': '\u25C2', 'LeftRightArrow': '\u2194', 'LeftRightVector': '\u294E', 'LeftSkeleton': '\uF761', 'LeftTee': '\u22A3', 'LeftTeeArrow': '\u21A4', 'LeftTeeVector': '\u295A', 'LeftTriangle': '\u22B2', 'LeftTriangleBar': '\u29CF', 'LeftTriangleEqual': '\u22B4', 'LeftUpDownVector': '\u2951', 'LeftUpTeeVector': '\u2960', 'LeftUpVector': '\u21BF', 'LeftUpVectorBar': '\u2958', 'LeftVector': '\u21BC', 'LeftVectorBar': '\u2952', 'LessEqual': '\u2264', 'LessEqualGreater': '\u22DA', 'LessFullEqual': '\u2266', 'LessGreater': '\u2276', 'LessLess': '\u226A', 'LessSlantEqual': '\u2A7D', 'LessTilde': '\u2272', 'LetterSpace': '\uF754', 'LightBulb': '\uF723', 'LongDash': '\u2014', 'LongEqual': '\uF7D9', 'LongLeftArrow': '\u27F5', 'LongLeftRightArrow': '\u27F7', 'LongRightArrow': '\u27F6', 'LowerLeftArrow': '\u2199', 'LowerRightArrow': '\u2198', 'LSlash': '\u0142', 'Mars': '\u2642', 'MathematicaIcon': '\uF757', 'MeasuredAngle': '\u2221', 'MediumSpace': '\u205F', 'Mercury': '\u263F', 'Mho': '\u2127', 'Micro': '\u00B5', 'Minus': '\u2212', 'MinusPlus': '\u2213', 'Mu': '\u03BC', 'Nand': '\u22BC', 'Natural': '\u266E', 'NegativeMediumSpace': '\uF383', 'NegativeThickSpace': '\uF384', 'NegativeThinSpace': '\uF382', 'NegativeVeryThinSpace': '\uF380', 'Neptune': '\u2646', 'NestedGreaterGreater': '\u2AA2', 'NestedLessLess': '\u2AA1', 'NeutralSmiley': '\uF722', 'NHacek': '\u0148', 'NoBreak': '\u2060', 'NonBreakingSpace': '\u00A0', 'Nor': '\u22BD', 'NotCongruent': '\u2262', 'NotCupCap': '\u226D', 'NotDoubleVerticalBar': '\u2226', 'NotElement': '\u2209', 'NotEqual': '\u2260', 'NotEqualTilde': '\uF400', 'NotExists': '\u2204', 'NotGreater': '\u226F', 'NotGreaterEqual': '\u2271', 'NotGreaterFullEqual': '\u2269', 'NotGreaterGreater': '\uF427', 'NotGreaterLess': '\u2279', 'NotGreaterSlantEqual': '\uF429', 'NotGreaterTilde': '\u2275', 'NotHumpDownHump': '\uF402', 'NotHumpEqual': '\uF401', 'NotLeftTriangle': '\u22EA', 'NotLeftTriangleBar': '\uF412', 'NotLeftTriangleEqual': '\u22EC', 'NotLessEqual': '\u2270', 'NotLessFullEqual': '\u2268', 'NotLessGreater': '\u2278', 'NotLess': '\u226E', 'NotLessLess': '\uF422', 'NotLessSlantEqual': '\uF424', 'NotLessTilde': '\u2274', 'Not': '\u00AC', 'NotNestedGreaterGreater': '\uF428', 'NotNestedLessLess': '\uF423', 'NotPrecedes': '\u2280', 'NotPrecedesEqual': '\uF42B', 'NotPrecedesSlantEqual': '\u22E0', 'NotPrecedesTilde': '\u22E8', 'NotReverseElement': '\u220C', 'NotRightTriangle': '\u22EB', 'NotRightTriangleBar': '\uF413', 'NotRightTriangleEqual': '\u22ED', 'NotSquareSubset': '\uF42E', 'NotSquareSubsetEqual': '\u22E2', 'NotSquareSuperset': '\uF42F', 'NotSquareSupersetEqual': '\u22E3', 'NotSubset': '\u2284', 'NotSubsetEqual': '\u2288', 'NotSucceeds': '\u2281', 'NotSucceedsEqual': '\uF42D', 'NotSucceedsSlantEqual': '\u22E1', 'NotSucceedsTilde': '\u22E9', 'NotSuperset': '\u2285', 'NotSupersetEqual': '\u2289', 'NotTilde': '\u2241', 'NotTildeEqual': '\u2244', 'NotTildeFullEqual': '\u2247', 'NotTildeTilde': '\u2249', 'NotVerticalBar': '\u2224', 'NTilde': '\u00F1', 'Nu': '\u03BD', 'Null': '\uF3A0', 'NumberSign': '\uF724', 'OAcute': '\u00F3', 'ODoubleAcute': '\u0151', 'ODoubleDot': '\u00F6', 'OE': '\u0153', 'OGrave': '\u00F2', 'OHat': '\u00F4', 'Omega': '\u03C9', 'Omicron': '\u03BF', 'OpenCurlyDoubleQuote': '\u201C', 'OpenCurlyQuote': '\u2018', 'OptionKey': '\uF7D2', 'Or': '\u2228', 'OSlash': '\u00F8', 'OTilde': '\u00F5', 'OverBrace': '\uFE37', 'OverBracket': '\u23B4', 'OverParenthesis': '\uFE35', 'Paragraph': '\u00B6', 'PartialD': '\u2202', 'Phi': '\u03D5', 'Pi': '\u03C0', 'Piecewise': '\uF361', 'Placeholder': '\uF528', 'PlusMinus': '\u00B1', 'Pluto': '\u2647', 'Precedes': '\u227A', 'PrecedesEqual': '\u2AAF', 'PrecedesSlantEqual': '\u227C', 'PrecedesTilde': '\u227E', 'Prime': '\u2032', 'Product': '\u220F', 'Proportion': '\u2237', 'Proportional': '\u221D', 'Psi': '\u03C8', 'QuarterNote': '\u2669', 'RawAmpersand': '\u0026', 'RawAt': '\u0040', 'RawBackquote': '\u0060', 'RawBackslash': '\u005C', 'RawColon': '\u003A', 'RawComma': '\u002C', 'RawDash': '\u002D', 'RawDollar': '\u0024', 'RawDot': '\u002E', 'RawDoubleQuote': '\u0022', 'RawEqual': '\u003D', 'RawEscape': '\u001B', 'RawExclamation': '\u0021', 'RawGreater': '\u003E', 'RawLeftBrace': '\u007B', 'RawLeftBracket': '\u005B', 'RawLeftParenthesis': '\u0028', 'RawLess': '\u003C', 'RawNumberSign': '\u0023', 'RawPercent': '\u0025', 'RawPlus': '\u002B', 'RawQuestion': '\u003F', 'RawQuote': '\u0027', 'RawRightBrace': '\u007D', 'RawRightBracket': '\u005D', 'RawRightParenthesis': '\u0029', 'RawSemicolon': '\u003B', 'RawSlash': '\u002F', 'RawSpace': '\u0020', 'RawStar': '\u002A', 'RawTab': '\u0009', 'RawTilde': '\u007E', 'RawUnderscore': '\u005F', 'RawVerticalBar': '\u007C', 'RawWedge': '\u005E', 'RegisteredTrademark': '\u00AE', 'ReturnIndicator': '\u21B5', 'ReturnKey': '\uF766', 'ReverseDoublePrime': '\u2036', 'ReverseElement': '\u220B', 'ReverseEquilibrium': '\u21CB', 'ReversePrime': '\u2035', 'ReverseUpEquilibrium': '\u296F', 'RHacek': '\u0159', 'Rho': '\u03C1', 'RightAngle': '\u221F', 'RightAngleBracket': '\u232A', 'RightArrow': '\u2192', 'RightArrowBar': '\u21E5', 'RightArrowLeftArrow': '\u21C4', 'RightBracketingBar': '\uF604', 'RightCeiling': '\u2309', 'RightDoubleBracket': '\u301B', 'RightDoubleBracketingBar': '\uF606', 'RightDownTeeVector': '\u295D', 'RightDownVector': '\u21C2', 'RightDownVectorBar': '\u2955', 'RightFloor': '\u230B', 'RightGuillemet': '\u00BB', 'RightModified': '\uF76C', 'RightPointer': '\u25B8', 'RightSkeleton': '\uF762', 'RightTee': '\u22A2', 'RightTeeArrow': '\u21A6', 'RightTeeVector': '\u295B', 'RightTriangle': '\u22B3', 'RightTriangleBar': '\u29D0', 'RightTriangleEqual': '\u22B5', 'RightUpDownVector': '\u294F', 'RightUpTeeVector': '\u295C', 'RightUpVector': '\u21BE', 'RightUpVectorBar': '\u2954', 'RightVector': '\u21C0', 'RightVectorBar': '\u2953', 'RoundImplies': '\u2970', 'RoundSpaceIndicator': '\uF3B2', 'Rule': '\uF522', 'RuleDelayed': '\uF51F', 'SadSmiley': '\u2639', 'Sampi': '\u03E0', 'Saturn': '\u2644', 'ScriptA': '\uF6B2', 'ScriptB': '\uF6B3', 'ScriptC': '\uF6B4', 'ScriptCapitalA': '\uF770', 'ScriptCapitalB': '\u212C', 'ScriptCapitalC': '\uF772', 'ScriptCapitalD': '\uF773', 'ScriptCapitalE': '\u2130', 'ScriptCapitalF': '\u2131', 'ScriptCapitalG': '\uF776', 'ScriptCapitalH': '\u210B', 'ScriptCapitalI': '\u2110', 'ScriptCapitalJ': '\uF779', 'ScriptCapitalK': '\uF77A', 'ScriptCapitalL': '\u2112', 'ScriptCapitalM': '\u2133', 'ScriptCapitalN': '\uF77D', 'ScriptCapitalO': '\uF77E', 'ScriptCapitalP': '\u2118', 'ScriptCapitalQ': '\uF780', 'ScriptCapitalR': '\u211B', 'ScriptCapitalS': '\uF782', 'ScriptCapitalT': '\uF783', 'ScriptCapitalU': '\uF784', 'ScriptCapitalV': '\uF785', 'ScriptCapitalW': '\uF786', 'ScriptCapitalX': '\uF787', 'ScriptCapitalY': '\uF788', 'ScriptCapitalZ': '\uF789', 'ScriptD': '\uF6B5', 'ScriptDotlessI': '\uF730', 'ScriptDotlessJ': '\uF731', 'ScriptE': '\u212F', 'ScriptEight': '\uF7F8', 'ScriptF': '\uF6B7', 'ScriptFive': '\uF7F5', 'ScriptFour': '\uF7F4', 'ScriptG': '\u210A', 'ScriptH': '\uF6B9', 'ScriptI': '\uF6BA', 'ScriptJ': '\uF6BB', 'ScriptK': '\uF6BC', 'ScriptL': '\u2113', 'ScriptM': '\uF6BE', 'ScriptN': '\uF6BF', 'ScriptNine': '\uF7F9', 'ScriptO': '\u2134', 'ScriptOne': '\uF7F1', 'ScriptP': '\uF6C1', 'ScriptQ': '\uF6C2', 'ScriptR': '\uF6C3', 'ScriptS': '\uF6C4', 'ScriptSeven': '\uF7F7', 'ScriptSix': '\uF7F6', 'ScriptT': '\uF6C5', 'ScriptThree': '\uF7F3', 'ScriptTwo': '\uF7F2', 'ScriptU': '\uF6C6', 'ScriptV': '\uF6C7', 'ScriptW': '\uF6C8', 'ScriptX': '\uF6C9', 'ScriptY': '\uF6CA', 'ScriptZ': '\uF6CB', 'ScriptZero': '\uF7F0', 'Section': '\u00A7', 'SelectionPlaceholder': '\uF527', 'SHacek': '\u0161', 'Sharp': '\u266F', 'ShortLeftArrow': '\uF526', 'ShortRightArrow': '\uF525', 'Sigma': '\u03C3', 'SixPointedStar': '\u2736', 'SkeletonIndicator': '\u2043', 'SmallCircle': '\u2218', 'SpaceIndicator': '\u2423', 'SpaceKey': '\uF7BF', 'SpadeSuit': '\u2660', 'SpanFromAbove': '\uF3BB', 'SpanFromBoth': '\uF3BC', 'SpanFromLeft': '\uF3BA', 'SphericalAngle': '\u2222', 'Sqrt': '\u221A', 'Square': '\uF520', 'SquareIntersection': '\u2293', 'SquareSubset': '\u228F', 'SquareSubsetEqual': '\u2291', 'SquareSuperset': '\u2290', 'SquareSupersetEqual': '\u2292', 'SquareUnion': '\u2294', 'Star': '\u22C6', 'Sterling': '\u00A3', 'Stigma': '\u03DB', 'Subset': '\u2282', 'SubsetEqual': '\u2286', 'Succeeds': '\u227B', 'SucceedsEqual': '\u2AB0', 'SucceedsSlantEqual': '\u227D', 'SucceedsTilde': '\u227F', 'SuchThat': '\u220D', 'Sum': '\u2211', 'Superset': '\u2283', 'SupersetEqual': '\u2287', 'SystemEnterKey': '\uF75F', 'SZ': '\u00DF', 'TabKey': '\uF7BE', 'Tau': '\u03C4', 'THacek': '\u0165', 'Therefore': '\u2234', 'Theta': '\u03B8', 'ThickSpace': '\u2005', 'ThinSpace': '\u2009', 'Thorn': '\u00FE', 'Tilde': '\u223C', 'TildeEqual': '\u2243', 'TildeFullEqual': '\u2245', 'TildeTilde': '\u2248', 'Times': '\u00D7', 'Trademark': '\u2122', 'Transpose': '\uF3C7', 'UAcute': '\u00FA', 'UDoubleAcute': '\u0171', 'UDoubleDot': '\u00FC', 'UGrave': '\u00F9', 'UHat': '\u00FB', 'UnderBrace': '\uFE38', 'UnderBracket': '\u23B5', 'UnderParenthesis': '\uFE36', 'Union': '\u22C3', 'UnionPlus': '\u228E', 'UpArrow': '\u2191', 'UpArrowBar': '\u2912', 'UpArrowDownArrow': '\u21C5', 'UpDownArrow': '\u2195', 'UpEquilibrium': '\u296E', 'UpperLeftArrow': '\u2196', 'UpperRightArrow': '\u2197', 'UpPointer': '\u25B4', 'Upsilon': '\u03C5', 'UpTee': '\u22A5', 'UpTeeArrow': '\u21A5', 'Uranus': '\u2645', 'URing': '\u016F', 'Vee': '\u22C1', 'Venus': '\u2640', 'VerticalBar': '\u2223', 'VerticalEllipsis': '\u22EE', 'VerticalLine': '\u2502', 'VerticalSeparator': '\uF432', 'VerticalTilde': '\u2240', 'VeryThinSpace': '\u200A', 'WarningSign': '\uF725', 'WatchIcon': '\u231A', 'Wedge': '\u22C0', 'WeierstrassP': '\u2118', 'WhiteBishop': '\u2657', 'WhiteKing': '\u2654', 'WhiteKnight': '\u2658', 'WhitePawn': '\u2659', 'WhiteQueen': '\u2655', 'WhiteRook': '\u2656', 'Wolf': '\uF720', 'Xi': '\u03BE', 'Xnor': '\uF4A2', 'Xor': '\u22BB', 'YAcute': '\u00FD', 'YDoubleDot': '\u00FF', 'Yen': '\u00A5', 'Zeta': '\u03B6', 'ZHacek': '\u017E', } aliased_characters = { "a'": '\u00E1', 'a-': '\u0101', 'au': '\u0103', 'a"': '\u00E4', 'ae': '\u00E6', 'a`': '\u00E0', 'a^': '\u00E2', 'al': '\u2135', 'esc': '\uF768', 'am': '\uF760', 'a': '\u03B1', 'alpha': '\u03B1', 'alt': '\uF7D1', '&&': '\u2227', 'and': '\u2227', 'Ang': '\u212B', 'ao': '\u00E5', 'a~': '\u00E3', '\\': '\u2216', 'be': '\u2136', 'b': '\u03B2', 'beta': '\u03B2', 'bv': '\u02D8', 'bu': '\u2022', "c'": '\u0107', "A'": '\u00C1', 'A-': '\u0100', 'Au': '\u0102', 'A"': '\u00C4', 'AE': '\u00C6', 'A`': '\u00C0', 'A^': '\u00C2', 'A': '\u0391', 'Alpha': '\u0391', 'Ao': '\u00C5', 'A~': '\u00C3', 'B': '\u0392', 'Beta': '\u0392', "C'": '\u0106', 'C,': '\u00C7', 'Cv': '\u010C', 'Ch': '\u03A7', 'Chi': '\u03A7', 'C': '\u03A7', 'D': '\u0394', 'Delta': '\u0394', 'Dv': '\u010E', 'DD': '\uF74B', 'Di': '\u03DC', 'Digamma': '\u03DC', "E'": '\u00C9', 'E-': '\u0112', 'Eu': '\u0114', 'E"': '\u00CB', 'E`': '\u00C8', 'Ev': '\u011A', 'E^': '\u00CA', 'E': '\u0395', 'Epsilon': '\u0395', 'Et': '\u0397', 'Eta': '\u0397', 'H': '\u0397', 'D-': '\u00D0', 'G': '\u0393', 'Gamma': '\u0393', "I'": '\u00CD', 'Iu': '\u012C', 'I"': '\u00CF', 'I`': '\u00CC', 'I^': '\u00CE', 'I': '\u0399', 'Iota': '\u0399', 'K': '\u039A', 'Kappa': '\u039A', 'Ko': '\u03DE', 'Koppa': '\u03DE', 'L': '\u039B', 'Lambda': '\u039B', 'L/': '\u0141', 'M': '\u039C', 'Mu': '\u039C', 'Nv': '\u0147', 'N~': '\u00D1', 'N': '\u039D', 'Nu': '\u039D', "O'": '\u00D3', "O''": '\u0150', 'O"': '\u00D6', 'OE': '\u0152', 'O`': '\u00D2', 'O^': '\u00D4', 'O': '\u03A9', 'Omega': '\u03A9', 'W': '\u03A9', 'Om': '\u039F', 'Omicron': '\u039F', 'O/': '\u00D8', 'O~': '\u00D5', 'Ph': '\u03A6', 'Phi': '\u03A6', 'F': '\u03A6', 'P': '\u03A0', 'Pi': '\u03A0', 'Ps': '\u03A8', 'Psi': '\u03A8', 'Y': '\u03A8', 'Rv': '\u0158', 'R': '\u03A1', 'Rho': '\u03A1', 'Sa': '\u03E0', 'Sampi': '\u03E0', 'Sv': '\u0160', 'S': '\u03A3', 'Sigma': '\u03A3', 'T': '\u03A4', 'Tau': '\u03A4', 'Tv': '\u0164', 'Th': '\u0398', 'Theta': '\u0398', 'Q': '\u0398', 'Thn': '\u00DE', "U'": '\u00DA', "U''": '\u0170', 'U"': '\u00DC', 'U`': '\u00D9', 'U^': '\u00DB', 'U': '\u03A5', 'Upsilon': '\u03A5', 'Uo': '\u016E', 'X': '\u039E', 'Xi': '\u039E', "Y'": '\u00DD', 'Z': '\u0396', 'Zeta': '\u0396', 'Zv': '\u017D', 'c,': '\u00E7', 'cd': '\u00B8', '.': '\u00B7', 'cent': '\u00A2', 'cv': '\u010D', 'ch': '\u03C7', 'chi': '\u03C7', 'c': '\u03C7', 'c.': '\u2299', 'c-': '\u2296', 'c+': '\u2295', 'c*': '\u2297', 'ccint': '\u2232', 'cl': '\u2318', ':': '\u2236', 'cmd': '\uF76A', '===': '\u2261', 'co': '\uF3C8', 'conj': '\uF3C8', 'ct': '\uF3C9', 'cont': '\uF3B1', 'cint': '\u222E', 'ctrl': '\uF763', 'coprod': '\u2210', 'cccint': '\u2233', 'cross': '\uF4A0', 'cU': '\u03D2', 'cUpsilon': '\u03D2', 'ce': '\u03B5', 'cepsilon': '\u03B5', 'ck': '\u03F0', 'ckappa': '\u03F0', 'j': '\u03C6', 'cph': '\u03C6', 'cphi': '\u03C6', 'cp': '\u03D6', 'cpi': '\u03D6', 'cr': '\u03F1', 'crho': '\u03F1', 'cq': '\u03D1', 'cth': '\u03D1', 'ctheta': '\u03D1', 'dg': '\u2020', 'da': '\u2138', '-': '\u2013', 'deg': '\u00B0', ' del': '\uF7D0', 'del': '\u2207', 'd': '\u03B4', 'delta': '\u03B4', 'dv': '\u010F', 'dia': '\u22C4', 'diffd': '\u2206', 'dd': '\uF74C', 'di': '\u03DD', 'digamma': '\u03DD', 'dratio': '\uF4A4', 'shift': '\uF4A3', 'dhy': '\u00AD', 'dlsep': '\uF76E', 'dpsep': '\uF76F', 'div': '\u00F7', '.=': '\u2250', 'ddg': '\u2021', 'gg': '\uF74A', 'pp': '\uF749', ' <=': '\u21D0', '<=>': '\u21D4', '<==': '\u27F8', '<==>': '\u27FA', '==>': '\u27F9', "''": '\u2033', ' =>': '\u21D2', 'dsa': '\uF6E6', 'dsb': '\uF6E7', 'dsc': '\uF6E8', 'dsA': '\uF7A4', 'dsB': '\uF7A5', 'dsC': '\uF7A6', 'dsD': '\uF7A7', 'dsE': '\uF7A8', 'dsF': '\uF7A9', 'dsG': '\uF7AA', 'dsH': '\uF7AB', 'dsI': '\uF7AC', 'dsJ': '\uF7AD', 'dsK': '\uF7AE', 'dsL': '\uF7AF', 'dsM': '\uF7B0', 'dsN': '\uF7B1', 'dsO': '\uF7B2', 'dsP': '\uF7B3', 'dsQ': '\uF7B4', 'dsR': '\uF7B5', 'dsS': '\uF7B6', 'dsT': '\uF7B7', 'dsU': '\uF7B8', 'dsV': '\uF7B9', 'dsW': '\uF7BA', 'dsX': '\uF7BB', 'dsY': '\uF7BC', 'dsZ': '\uF7BD', 'dsd': '\uF6E9', 'dse': '\uF6EA', 'ds8': '\uF7E3', 'dsf': '\uF6EB', 'ds5': '\uF7E0', 'ds4': '\uF7DF', 'dsg': '\uF6EC', 'dsh': '\uF6ED', 'dsi': '\uF6EE', 'dsj': '\uF6EF', 'dsk': '\uF6F0', 'dsl': '\uF6F1', 'dsm': '\uF6F2', 'dsn': '\uF6F3', 'ds9': '\uF7E4', 'dso': '\uF6F4', 'ds1': '\uF7DC', 'dsp': '\uF6F5', 'dsq': '\uF6F6', 'dsr': '\uF6F7', 'dss': '\uF6F8', 'ds7': '\uF7E2', 'ds6': '\uF7E1', 'dst': '\uF6F9', 'ds3': '\uF7DE', 'ds2': '\uF7DD', 'dsu': '\uF6FA', 'dsv': '\uF6FB', 'dsw': '\uF6FC', 'dsx': '\uF6FD', 'dsy': '\uF6FE', 'dsz': '\uF6FF', 'ds0': '\uF7DB', ' ||': '\u2225', 'dbv': '\uF755', 'd!': '\u00A1', 'd?': '\u00BF', 'dT': '\u22A4', "e'": '\u00E9', 'e-': '\u0113', 'eu': '\u0115', 'e"': '\u00EB', 'e`': '\u00E8', 'ev': '\u011B', 'e^': '\u00EA', 'el': '\u2208', 'elem': '\u2208', '...': '\u2026', 'eci': '\u25CB', 'es': '\u2205', 'esci': '\u25E6', 'essq': '\u25FB', 'esq': '\u25A1', 'ent': '\uF7D4', 'e': '\u03F5', 'epsilon': '\u03F5', '==': '\uF431', '=~': '\u2242', 'equi': '\u21CC', 'equiv': '\u29E6', ' esc': '\uF769', 'et': '\u03B7', 'eta': '\u03B7', 'h': '\u03B7', 'd-': '\u00F0', 'ex': '\u2203', 'ee': '\uF74D', 'fci': '\u25CF', 'fsci': '\uF750', 'fssq': '\u25FC', 'fsq': '\u25A0', 'fvssq': '\u25AA', 'fs': '\u03C2', '*5': '\u2605', 'fa': '\u2200', '$a': '\uF800', '$b': '\uF801', '$c': '\uF802', '$A': '\uF81A', '$B': '\uF81B', '$C': '\uF81C', '$D': '\uF81D', '$E': '\uF81E', '$F': '\uF81F', '$G': '\uF820', '$H': '\uF821', '$I': '\uF822', '$J': '\uF823', '$K': '\uF824', '$L': '\uF825', '$M': '\uF826', '$N': '\uF827', '$O': '\uF828', '$P': '\uF829', '$Q': '\uF82A', '$R': '\uF82B', '$S': '\uF82C', '$T': '\uF82D', '$U': '\uF82E', '$V': '\uF82F', '$W': '\uF830', '$X': '\uF831', '$Y': '\uF832', '$Z': '\uF833', '$d': '\uF803', '$e': '\uF804', '$f': '\uF805', '$g': '\uF806', '$h': '\uF807', '$i': '\uF808', '$j': '\uF809', '$k': '\uF80A', '$l': '\uF80B', '$m': '\uF80C', '$n': '\uF80D', '$o': '\uF80E', '$p': '\uF80F', '$q': '\uF810', '$r': '\uF811', '$s': '\uF812', '$t': '\uF813', '$u': '\uF814', '$v': '\uF815', '$w': '\uF816', '$x': '\uF817', '$y': '\uF818', '$z': '\uF819', ':-@': '\uF721', 'fn': '\uF4A1', 'g': '\u03B3', 'gamma': '\u03B3', 'gi': '\u2137', 'goa': '\uF6CC', 'gob': '\uF6CD', 'goc': '\uF6CE', 'goA': '\uF78A', 'goB': '\uF78B', 'goC': '\u212D', 'goD': '\uF78D', 'goE': '\uF78E', 'goF': '\uF78F', 'goG': '\uF790', 'goH': '\u210C', 'goI': '\u2111', 'goJ': '\uF793', 'goK': '\uF794', 'goL': '\uF795', 'goM': '\uF796', 'goN': '\uF797', 'goO': '\uF798', 'goP': '\uF799', 'goQ': '\uF79A', 'goR': '\u211C', 'goS': '\uF79C', 'goT': '\uF79D', 'goU': '\uF79E', 'goV': '\uF79F', 'goW': '\uF7A0', 'goX': '\uF7A1', 'goY': '\uF7A2', 'goZ': '\u2128', 'god': '\uF6CF', 'goe': '\uF6D0', 'go8': '\uF7ED', 'gof': '\uF6D1', 'go5': '\uF7EA', 'go4': '\uF7E9', 'gog': '\uF6D2', 'goh': '\uF6D3', 'goi': '\uF6D4', 'goj': '\uF6D5', 'gok': '\uF6D6', 'gol': '\uF6D7', 'gom': '\uF6D8', 'gon': '\uF6D9', 'go9': '\uF7EF', 'goo': '\uF6DA', 'go1': '\uF7E6', 'gop': '\uF6DB', 'goq': '\uF6DC', 'gor': '\uF6DD', 'gos': '\uF6DE', 'go7': '\uF7EC', 'go6': '\uF7EB', 'got': '\uF6DF', 'go3': '\uF7E8', 'go2': '\uF7E7', 'gou': '\uF6E0', 'gov': '\uF6E1', 'gow': '\uF6E2', 'gox': '\uF6E3', 'goy': '\uF6E4', 'goz': '\uF6E5', 'go0': '\uF7E5', 'gci': '\uF753', 'gsq': '\uF752', '>=': '\u2265', '>/': '\u2A7E', '>~': '\u2273', 'hck': '\u02C7', ':)': '\u263A', ':-)': '\u263A', 'hb': '\u210F', 'hc': '\uF3CE', 'hline': '\u2500', 'h=': '\u224F', "i'": '\u00ED', 'iu': '\u012D', 'i"': '\u00EF', 'i`': '\u00EC', 'i^': '\u00EE', 'ii': '\uF74E', 'jj': '\uF74F', '+': '\uF39E', '=>': '\uF523', 'inf': '\u221E', 'int': '\u222B', 'inter': '\u22C2', '@': '\uF76D', ',': '\uF765', 'is': '\uF360', 'i': '\u03B9', 'iota': '\u03B9', 'k': '\u03BA', 'kappa': '\u03BA', 'ko': '\u03DF', 'koppa': '\u03DF', 'l': '\u03BB', 'lambda': '\u03BB', '<': '\u2329', '<-': '\u2190', 'l|': '\uF603', 'lc': '\u2308', '[[': '\u301A', 'l||': '\uF605', 'lf': '\u230A', 'g<<': '\u00AB', '[': '\uF76B', '<->': '\u2194', 'lT': '\u22A3', '<=': '\u2264', '</': '\u2A7D', '<~': '\u2272', '_': '\uF754', 'ls': '\uF754', '--': '\u2014', '<--': '\u27F5', '<-->': '\u27F7', '-->': '\u27F6', 'l/': '\u0142', 'math': '\uF757', ' ': '\u205F', 'mho': '\u2127', 'mi': '\u00B5', '-+': '\u2213', 'm': '\u03BC', 'mu': '\u03BC', 'nand': '\u22BC', '- ': '\uF383', '- ': '\uF384', '- ': '\uF382', '- ': '\uF380', ':-|': '\uF722', 'nv': '\u0148', 'nb': '\u2060', 'nbs': '\u00A0', 'nor': '\u22BD', '!===': '\u2262', '!||': '\u2226', '!el': '\u2209', '!elem': '\u2209', '!=': '\u2260', '!=~': '\uF400', '!ex': '\u2204', '!>': '\u226F', '!>=': '\u2271', '!>/': '\uF429', '!>~': '\u2275', '!h=': '\uF401', '!<=': '\u2270', '!<': '\u226E', '!</': '\uF424', '!<~': '\u2274', '!': '\u00AC', 'not': '\u00AC', '!mem': '\u220C', '!sub': '\u2284', '!sub=': '\u2288', '!sup': '\u2285', '!sup=': '\u2289', '!~': '\u2241', '!~=': '\u2244', '!~==': '\u2247', '!~~': '\u2249', '!|': '\u2224', 'n~': '\u00F1', 'n': '\u03BD', 'nu': '\u03BD', 'null': '\uF3A0', "o'": '\u00F3', "o''": '\u0151', 'o"': '\u00F6', 'oe': '\u0153', 'o`': '\u00F2', 'o^': '\u00F4', 'o': '\u03C9', 'omega': '\u03C9', 'w': '\u03C9', 'om': '\u03BF', 'omicron': '\u03BF', 'opt': '\uF7D2', '||': '\u2228', 'or': '\u2228', 'o/': '\u00F8', 'o~': '\u00F5', 'o{': '\uFE37', 'o[': '\u23B4', 'o(': '\uFE35', 'pd': '\u2202', 'ph': '\u03D5', 'phi': '\u03D5', 'f': '\u03D5', 'p': '\u03C0', 'pi': '\u03C0', 'pw': '\uF361', 'pl': '\uF528', '+-': '\u00B1', "'": '\u2032', 'prod': '\u220F', 'prop': '\u221D', 'ps': '\u03C8', 'psi': '\u03C8', 'y': '\u03C8', 'rtm': '\u00AE', 'ret': '\u21B5', ' ret': '\uF766', '``': '\u2036', 'mem': '\u220B', '`': '\u2035', 'rv': '\u0159', 'r': '\u03C1', 'rho': '\u03C1', '>': '\u232A', ' ->': '\u2192', 'r|': '\uF604', 'rc': '\u2309', ']]': '\u301B', 'r||': '\uF606', 'rf': '\u230B', 'g>>': '\u00BB', ']': '\uF76C', 'rT': '\u22A2', 'vec': '\u21C0', '->': '\uF522', ':>': '\uF51F', ':-(': '\u2639', 'sa': '\u03E0', 'sampi': '\u03E0', 'sca': '\uF6B2', 'scb': '\uF6B3', 'scc': '\uF6B4', 'scA': '\uF770', 'scB': '\u212C', 'scC': '\uF772', 'scD': '\uF773', 'scE': '\u2130', 'scF': '\u2131', 'scG': '\uF776', 'scH': '\u210B', 'scI': '\u2110', 'scJ': '\uF779', 'scK': '\uF77A', 'scL': '\u2112', 'scM': '\u2133', 'scN': '\uF77D', 'scO': '\uF77E', 'scP': '\u2118', 'scQ': '\uF780', 'scR': '\u211B', 'scS': '\uF782', 'scT': '\uF783', 'scU': '\uF784', 'scV': '\uF785', 'scW': '\uF786', 'scX': '\uF787', 'scY': '\uF788', 'scZ': '\uF789', 'scd': '\uF6B5', 'sce': '\u212F', 'sc8': '\uF7F8', 'scf': '\uF6B7', 'sc5': '\uF7F5', 'sc4': '\uF7F4', 'scg': '\u210A', 'sch': '\uF6B9', 'sci': '\uF6BA', 'scj': '\uF6BB', 'sck': '\uF6BC', 'scl': '\u2113', 'scm': '\uF6BE', 'scn': '\uF6BF', 'sc9': '\uF7F9', 'sco': '\u2134', 'sc1': '\uF7F1', 'scp': '\uF6C1', 'scq': '\uF6C2', 'scr': '\uF6C3', 'scs': '\uF6C4', 'sc7': '\uF7F7', 'sc6': '\uF7F6', 'sct': '\uF6C5', 'sc3': '\uF7F3', 'sc2': '\uF7F2', 'scu': '\uF6C6', 'scv': '\uF6C7', 'scw': '\uF6C8', 'scx': '\uF6C9', 'scy': '\uF6CA', 'scz': '\uF6CB', 'sc0': '\uF7F0', 'spl': '\uF527', 'sv': '\u0161', 's': '\u03C3', 'sigma': '\u03C3', '*6': '\u2736', 'sc': '\u2218', 'space': '\u2423', 'spc': '\uF7BF', 'sqrt': '\u221A', 'sq': '\uF520', 'star': '\u22C6', 'sti': '\u03DB', 'stigma': '\u03DB', 'sub': '\u2282', 'sub=': '\u2286', 'st': '\u220D', 'sum': '\u2211', 'sup': '\u2283', 'sup=': '\u2287', 'sz': '\u00DF', 'ss': '\u00DF', 'tab': '\uF7BE', 't': '\u03C4', 'tau': '\u03C4', 'tv': '\u0165', 'tf': '\u2234', 'th': '\u03B8', 'theta': '\u03B8', 'q': '\u03B8', ' ': '\u2005', ' ': '\u2009', 'thn': '\u00FE', '~': '\u223C', '~=': '\u2243', '~==': '\u2245', '~~': '\u2248', '*': '\u00D7', 'tm': '\u2122', 'tr': '\uF3C7', "u'": '\u00FA', "u''": '\u0171', 'u"': '\u00FC', 'u`': '\u00F9', 'u^': '\u00FB', 'u{': '\uFE38', 'u[': '\u23B5', 'u(': '\uFE36', 'un': '\u22C3', 'u': '\u03C5', 'upsilon': '\u03C5', 'uT': '\u22A5', 'uo': '\u016F', 'v': '\u22C1', ' |': '\u2223', 'vline': '\u2502', '|': '\uF432', ' ': '\u200A', '^': '\u22C0', 'wp': '\u2118', 'wf': '\uF720', 'wolf': '\uF720', 'x': '\u03BE', 'xi': '\u03BE', 'xnor': '\uF4A2', 'xor': '\u22BB', "y'": '\u00FD', 'z': '\u03B6', 'zeta': '\u03B6', 'zv': '\u017E', }
bnjones/Mathics
mathics/core/characters.py
Python
gpl-3.0
43,648
0
# encoding: utf-8 # Simple example for PatternSelector from yast import import_module import_module('UI') from yast import * class PatternSelectorEmptyClient: def main(self): if not UI.HasSpecialWidget("PatternSelector"): UI.OpenDialog( VBox( Label("Error: This UI doesn't support the PatternSelector widget!"), PushButton(Opt("default"), "&OK") ) ) UI.UserInput() UI.CloseDialog() return UI.OpenDialog(Opt("defaultsize"), PatternSelector(Id("selector"))) input = UI.RunPkgSelection(Id("selector")) UI.CloseDialog() ycpbuiltins.y2milestone("Input: %1", input) PatternSelectorEmptyClient().main()
yast/yast-python-bindings
examples/PatternSelector-empty.py
Python
gpl-2.0
722
0.01385
# Name: Main.py # Author: Shawn Wilkinson # Imports from random import choice # Welcome Message print("Welcome to the Isolation Game!") # Make Board board = [['' for col in range(4)] for row in range(4)] # Print Board Functin def show(): # Tmp string tmpStr = "" # Loop through board tmpStr += "\nBoard:" tmpStr += "\n-------------------------\n" for x in range(4): for y in range(4): if board[x][y] == '': tmpStr += " |" else: tmpStr += str( board[x][y] ) + "|" tmpStr += "\n-------------------------\n" # Return tmp string print(tmpStr) # Select Vars player = '' ai = '' isXO = '' firstPlay = '' playBool = False # Loop For XO State while 1: isXO = str(input("Am I 'x' or 'o'? ")) if isXO == 'x': ai = 'x' player = 'o' break elif isXO == 'o': ai = 'o' player = 'x' break else: print("Invalid choice. Try again.") # Loop For First State while 1: firstPlay = input("Do I got first ('y' or 'n')? ") if firstPlay == 'y': playBool = True break elif firstPlay == 'n': playBool = False break else: print("Invalid choice. Try again.") # Start and Show Board board[0][0] = 'x' board[3][3] = 'o' show() # Move Functions def aiMove(): # Possible Moves possMoves = [] # Find Loc for x in range(4): for y in range(4): if board[x][y] == ai: locX = int(x) locY = int(y) # Horizontal for x in range(-4, 5): if (locX + x) < 4 and (locX + x) >= 0: if board[locX + x][locY] == "#" or board[locX + x][locY] == player: break if board[locX + x][locY] == '': possMoves.append( [locX + x, locY] ) # Vertical for y in range(-4, 5): if (locY + y) < 4 and (locY + y) >= 0: if board[locX][locY + y] == "#" or board[locX][locY + y] == player: break if board[locX][locY + y] == '': possMoves.append( [locX, locY + y] ) # Diagonal for dia in range(-4, 5): if (locY + dia) < 4 and (locY + dia) >= 0: if (locX + dia) < 4 and (locX + dia) >= 0: if board[locX + dia][locY + + dia] == "#" or board[locX + dia][locY + dia] == player: break if board[locX + dia][locY + dia] == '': possMoves.append( [locX + dia, locY + dia] ) # Possible Moves Len print("Possible Moves: " + str(len(possMoves))) if(len(possMoves) == 0): print("Gave Over!") move = choice(possMoves) print(move) moveX = move[0] moveY = move[1] print("Move Choice" + str(moveX) + ":" + str(moveY)) board[moveX][moveY] = ai # Clear Old Space board[locX][locY] = '#' def playerMove(PosX, PosY): for x in range(4): for y in range(4): if board[x][y] == player: board[x][y] = '#' board[PosX][PosY] = player # Game Loop while 1: if playBool == True: aiMove() playBool = False else: x = int(input("Enter Player X:")) y = int(input("Enter Player Y:")) playerMove(x, y) playBool = True show()
super3/PyDev
Class/IsoGame/main.py
Python
mit
2,825
0.044248
#!/usr/bin/python3 import sys, getpass, urllib.request, urllib.error, json def mgmt(cmd, data=None, is_json=False): # The base URL for the management daemon. (Listens on IPv4 only.) mgmt_uri = 'http://127.0.0.1:10222' setup_key_auth(mgmt_uri) req = urllib.request.Request(mgmt_uri + cmd, urllib.parse.urlencode(data).encode("utf8") if data else None) try: response = urllib.request.urlopen(req) except urllib.error.HTTPError as e: if e.code == 401: try: print(e.read().decode("utf8")) except: pass print("The management daemon refused access. The API key file may be out of sync. Try 'service mailinabox restart'.", file=sys.stderr) elif hasattr(e, 'read'): print(e.read().decode('utf8'), file=sys.stderr) else: print(e, file=sys.stderr) sys.exit(1) resp = response.read().decode('utf8') if is_json: resp = json.loads(resp) return resp def read_password(): first = getpass.getpass('password: ') second = getpass.getpass(' (again): ') while first != second: print('Passwords not the same. Try again.') first = getpass.getpass('password: ') second = getpass.getpass(' (again): ') return first def setup_key_auth(mgmt_uri): key = open('/var/lib/mailinabox/api.key').read().strip() auth_handler = urllib.request.HTTPBasicAuthHandler() auth_handler.add_password( realm='Mail-in-a-Box Management Server', uri=mgmt_uri, user=key, passwd='') opener = urllib.request.build_opener(auth_handler) urllib.request.install_opener(opener) if len(sys.argv) < 2: print("Usage: ") print(" tools/mail.py user (lists users)") print(" tools/mail.py user add user@domain.com [password]") print(" tools/mail.py user password user@domain.com [password]") print(" tools/mail.py user remove user@domain.com") print(" tools/mail.py user make-admin user@domain.com") print(" tools/mail.py user remove-admin user@domain.com") print(" tools/mail.py user admins (lists admins)") print(" tools/mail.py alias (lists aliases)") print(" tools/mail.py alias add incoming.name@domain.com sent.to@other.domain.com") print(" tools/mail.py alias add incoming.name@domain.com 'sent.to@other.domain.com, multiple.people@other.domain.com'") print(" tools/mail.py alias remove incoming.name@domain.com") print() print("Removing a mail user does not delete their mail folders on disk. It only prevents IMAP/SMTP login.") print() elif sys.argv[1] == "user" and len(sys.argv) == 2: # Dump a list of users, one per line. Mark admins with an asterisk. users = mgmt("/mail/users?format=json", is_json=True) for domain in users: for user in domain["users"]: if user['status'] == 'inactive': continue print(user['email'], end='') if "admin" in user['privileges']: print("*", end='') print() elif sys.argv[1] == "user" and sys.argv[2] in ("add", "password"): if len(sys.argv) < 5: if len(sys.argv) < 4: email = input("email: ") else: email = sys.argv[3] pw = read_password() else: email, pw = sys.argv[3:5] if sys.argv[2] == "add": print(mgmt("/mail/users/add", { "email": email, "password": pw })) elif sys.argv[2] == "password": print(mgmt("/mail/users/password", { "email": email, "password": pw })) elif sys.argv[1] == "user" and sys.argv[2] == "remove" and len(sys.argv) == 4: print(mgmt("/mail/users/remove", { "email": sys.argv[3] })) elif sys.argv[1] == "user" and sys.argv[2] in ("make-admin", "remove-admin") and len(sys.argv) == 4: if sys.argv[2] == "make-admin": action = "add" else: action = "remove" print(mgmt("/mail/users/privileges/" + action, { "email": sys.argv[3], "privilege": "admin" })) elif sys.argv[1] == "user" and sys.argv[2] == "admins": # Dump a list of admin users. users = mgmt("/mail/users?format=json", is_json=True) for domain in users: for user in domain["users"]: if "admin" in user['privileges']: print(user['email']) elif sys.argv[1] == "alias" and len(sys.argv) == 2: print(mgmt("/mail/aliases")) elif sys.argv[1] == "alias" and sys.argv[2] == "add" and len(sys.argv) == 5: print(mgmt("/mail/aliases/add", { "source": sys.argv[3], "destination": sys.argv[4] })) elif sys.argv[1] == "alias" and sys.argv[2] == "remove" and len(sys.argv) == 4: print(mgmt("/mail/aliases/remove", { "source": sys.argv[3] })) else: print("Invalid command-line arguments.") sys.exit(1)
Toilal/mailinabox
tools/mail.py
Python
cc0-1.0
4,331
0.027938
from __future__ import unicode_literals, division, absolute_import from builtins import * # pylint: disable=unused-import, redefined-builtin import logging from requests import RequestException from flexget import plugin from flexget.event import event from flexget.utils import json from flexget.utils.template import RenderError from flexget.config_schema import one_or_more log = logging.getLogger('rapidpush') url = 'https://rapidpush.net/api' class OutputRapidPush(object): """ Example:: rapidpush: apikey: xxxxxxx (can also be a list of api keys) [category: category, default FlexGet] [title: title, default New release] [group: device group, default no group] [message: the message, default {{title}}] [channel: the broadcast notification channel, if provided it will be send to the channel subscribers instead of your devices, default no channel] [priority: 0 - 6 (6 = highest), default 2 (normal)] [notify_accepted: boolean true or false, default true] [notify_rejected: boolean true or false, default false] [notify_failed: boolean true or false, default false] [notify_undecided: boolean true or false, default false] Configuration parameters are also supported from entries (eg. through set). """ schema = { 'type': 'object', 'properties': { 'apikey': one_or_more({'type': 'string'}), 'category': {'type': 'string', 'default': 'Flexget'}, 'title': {'type': 'string', 'default': 'New Release'}, 'group': {'type': 'string', 'default': ''}, 'channel': {'type': 'string', 'default': ''}, 'priority': {'type': 'integer', 'default': 2}, 'message': {'type': 'string', 'default': '{{title}}'}, 'notify_accepted': {'type': 'boolean', 'default': True}, 'notify_rejected': {'type': 'boolean', 'default': False}, 'notify_failed': {'type': 'boolean', 'default': False}, 'notify_undecided': {'type': 'boolean', 'default': False} }, 'additionalProperties': False, 'required': ['apikey'] } # Run last to make sure other outputs are successful before sending notification @plugin.priority(0) def on_task_output(self, task, config): # get the parameters if config['notify_accepted']: log.debug("Notify accepted entries") self.process_notifications(task, task.accepted, config) if config['notify_rejected']: log.debug("Notify rejected entries") self.process_notifications(task, task.rejected, config) if config['notify_failed']: log.debug("Notify failed entries") self.process_notifications(task, task.failed, config) if config['notify_undecided']: log.debug("Notify undecided entries") self.process_notifications(task, task.undecided, config) # Process the given events. def process_notifications(self, task, entries, config): for entry in entries: if task.options.test: log.info("Would send RapidPush notification about: %s", entry['title']) continue log.info("Send RapidPush notification about: %s", entry['title']) apikey = entry.get('apikey', config['apikey']) if isinstance(apikey, list): apikey = ','.join(apikey) title = config['title'] try: title = entry.render(title) except RenderError as e: log.error('Error setting RapidPush title: %s' % e) message = config['message'] try: message = entry.render(message) except RenderError as e: log.error('Error setting RapidPush message: %s' % e) # Check if we have to send a normal or a broadcast notification. if not config['channel']: priority = entry.get('priority', config['priority']) category = entry.get('category', config['category']) try: category = entry.render(category) except RenderError as e: log.error('Error setting RapidPush category: %s' % e) group = entry.get('group', config['group']) try: group = entry.render(group) except RenderError as e: log.error('Error setting RapidPush group: %s' % e) # Send the request data_string = json.dumps({ 'title': title, 'message': message, 'priority': priority, 'category': category, 'group': group}) data = {'apikey': apikey, 'command': 'notify', 'data': data_string} else: channel = config['channel'] try: channel = entry.render(channel) except RenderError as e: log.error('Error setting RapidPush channel: %s' % e) # Send the broadcast request data_string = json.dumps({ 'title': title, 'message': message, 'channel': channel}) data = {'apikey': apikey, 'command': 'broadcast', 'data': data_string} try: response = task.requests.post(url, data=data, raise_status=False) except RequestException as e: log.error('Error sending data to rapidpush: %s' % e) continue json_data = response.json() if 'code' in json_data: if json_data['code'] == 200: log.debug("RapidPush message sent") else: log.error(json_data['desc'] + " (" + str(json_data['code']) + ")") else: for item in json_data: if json_data[item]['code'] == 200: log.debug(item + ": RapidPush message sent") else: log.error(item + ": " + json_data[item]['desc'] + " (" + str(json_data[item]['code']) + ")") @event('plugin.register') def register_plugin(): plugin.register(OutputRapidPush, 'rapidpush', api_ver=2)
oxc/Flexget
flexget/plugins/output/rapidpush.py
Python
mit
6,452
0.00124
import uuid class RemoteProcessGroup(object): def __init__(self, url, name=None): self.uuid = uuid.uuid4() if name is None: self.name = str(self.uuid) else: self.name = name self.url = url def get_name(self): return self.name def get_uuid(self): return self.uuid
dtrodrigues/nifi-minifi-cpp
docker/test/integration/minifi/core/RemoteProcessGroup.py
Python
apache-2.0
353
0
import time script = u''' // Time stamp: %s // (This ensures the source text is *not* a byte-for-byte match with any // previously-fetched version of this script.) // This no-op fetch handler is necessary to bypass explicitly the no fetch // handler optimization by which this service worker script can be skipped. addEventListener('fetch', event => { return; }); addEventListener('install', event => { event.waitUntil(self.skipWaiting()); }); addEventListener('activate', event => { event.waitUntil(self.clients.claim()); });''' def main(request, response): return [(b'Content-Type', b'application/javascript')], script % time.time()
scheib/chromium
third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/update-claim-worker.py
Python
bsd-3-clause
661
0.001513
import xbmc import xbmcgui import xbmcaddon import xbmcvfs from PIL import Image, ImageOps ADDON = xbmcaddon.Addon(id = 'script.stargate.guide') def autocrop_image(infile,outfile): infile = xbmc.translatePath(infile) image = Image.open(infile) border = 0 size = image.size bb_image = image bbox = bb_image.getbbox() if (size[0] == bbox[2]) and (size[1] == bbox[3]): bb_image=bb_image.convert("RGB") bb_image = ImageOps.invert(bb_image) bbox = bb_image.getbbox() image = image.crop(bbox) (width, height) = image.size width += border * 2 height += border * 2 ratio = float(width)/height cropped_image = Image.new("RGBA", (width, height), (0,0,0,0)) cropped_image.paste(image, (border, border)) #TODO find epg height logo_height = 450 / int(ADDON.getSetting('channels.per.page')) logo_height = logo_height - 2 cropped_image = cropped_image.resize((int(logo_height*ratio), logo_height),Image.ANTIALIAS) outfile = xbmc.translatePath(outfile) cropped_image.save(outfile) d = xbmcgui.Dialog() old_path = d.browse(0, 'Source Logo Folder', 'files', '', False, False, 'special://home/') if not old_path: quit() new_path = d.browse(0, 'Destination Logo Folder', 'files', '', False, False,'special://home/') if not new_path or old_path == new_path: quit() dirs, files = xbmcvfs.listdir(old_path) p = xbmcgui.DialogProgressBG() p.create('TVGF', 'Processing Logos') images = [f for f in files if f.endswith('.png')] total = len(images) i = 0 for f in images: infile = old_path+f outfile = new_path+f autocrop_image(infile,outfile) percent = 100.0 * i / total i = i+1 p.update(int(percent),"TVGF",f) p.close()
TheWardoctor/Wardoctors-repo
script.stargate.guide/ResizeLogos.py
Python
apache-2.0
1,738
0.010357
from scrapy.http import Response from scrapy.selector import Selector def xmliter_lxml(obj, nodename, namespace=None, prefix='x'): from lxml import etree reader = _StreamReader(obj) tag = '{%s}%s' % (namespace, nodename) if namespace else nodename iterable = etree.iterparse(reader, tag=tag, encoding=reader.encoding) selxpath = '//' + ('%s:%s' % (prefix, nodename) if namespace else nodename) for _, node in iterable: nodetext = etree.tostring(node) node.clear() xs = Selector(text=nodetext, type='xml') if namespace: xs.register_namespace(prefix, namespace) yield xs.xpath(selxpath)[0] class _StreamReader(object): def __init__(self, obj): self._ptr = 0 if isinstance(obj, Response): self._text, self.encoding = obj.body, obj.encoding else: self._text, self.encoding = obj, 'utf-8' self._is_unicode = isinstance(self._text, unicode) def read(self, n=65535): self.read = self._read_unicode if self._is_unicode else self._read_string return self.read(n).lstrip() def _read_string(self, n=65535): s, e = self._ptr, self._ptr + n self._ptr = e return self._text[s:e] def _read_unicode(self, n=65535): s, e = self._ptr, self._ptr + n self._ptr = e return self._text[s:e].encode('utf-8')
Partoo/scrapy
scrapy/contrib_exp/iterators.py
Python
bsd-3-clause
1,404
0.000712
import os #: The title of this site SITE_TITLE = 'Job Board' #: Database backend SQLALCHEMY_DATABASE_URI = 'postgresql:///hasjob_testing' SERVER_NAME = 'hasjob.travis.local:5000' #: LastUser server LASTUSER_SERVER = 'https://hasgeek.com/' #: LastUser client id LASTUSER_CLIENT_ID = os.environ.get('LASTUSER_CLIENT_ID', '') #: LastUser client secret LASTUSER_CLIENT_SECRET = os.environ.get('LASTUSER_CLIENT_SECRET', '') STATIC_SUBDOMAIN = 'static' ASSET_SERVER = 'https://static.hasgeek.co.in/' ASSET_MANIFEST_PATH = "static/build/manifest.json" # no trailing slash ASSET_BASE_PATH = '/static/build'
hasgeek/hasjob
instance/testing.py
Python
agpl-3.0
602
0
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): depends_on = ( ('users', '0001_initial'), ) def forwards(self, orm): # Adding field 'RawDocument.user' db.add_column('document_upload_rawdocument', 'user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['users.KarmaUser'], null=True, on_delete=models.SET_NULL), keep_default=False) def backwards(self, orm): # Deleting field 'RawDocument.user' db.delete_column('document_upload_rawdocument', 'user_id') models = { 'contenttypes.contenttype': { 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) }, 'courses.course': { 'Meta': {'ordering': "['-file_count', 'school', 'name']", 'unique_together': "(('school', 'name', 'instructor_name'),)", 'object_name': 'Course'}, 'academic_year': ('django.db.models.fields.IntegerField', [], {'default': '2013', 'null': 'True', 'blank': 'True'}), 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'desc': ('django.db.models.fields.TextField', [], {'max_length': '511', 'null': 'True', 'blank': 'True'}), 'file_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'instructor_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), 'instructor_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'school': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['courses.School']"}), 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150', 'null': 'True'}), 'updated_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.utcnow'}), 'url': ('django.db.models.fields.URLField', [], {'max_length': '511', 'null': 'True', 'blank': 'True'}) }, 'courses.school': { 'Meta': {'ordering': "['-file_count', '-priority', 'name']", 'object_name': 'School'}, 'alias': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'facebook_id': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'blank': 'True'}), 'file_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'location': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'priority': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150', 'null': 'True'}), 'url': ('django.db.models.fields.URLField', [], {'max_length': '511', 'blank': 'True'}), 'usde_id': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'blank': 'True'}) }, 'document_upload.rawdocument': { 'Meta': {'ordering': "['-uploaded_at']", 'object_name': 'RawDocument'}, 'course': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['courses.Course']"}), 'fp_file': ('django_filepicker.models.FPFileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}), 'is_hidden': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_processed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'mimetype': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'null': 'True'}), 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.utcnow', 'null': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['users.KarmaUser']", 'null': 'True', 'on_delete': 'models.SET_NULL'}) }, 'taggit.tag': { 'Meta': {'ordering': "['namespace', 'name']", 'object_name': 'Tag'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), 'namespace': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) }, 'taggit.taggeditem': { 'Meta': {'object_name': 'TaggedItem'}, 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) }, 'users.karmauser': { 'Meta': {'object_name': 'KarmaUser'}, 'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '75'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) } } complete_apps = ['document_upload']
FinalsClub/karmaworld
karmaworld/apps/document_upload/migrations/0002_auto__add_field_rawdocument_user.py
Python
agpl-3.0
6,785
0.008106
# -*- coding: utf-8 -*- """ pyalgs ~~~~~ pyalgs provides the python implementation of the Robert Sedgwick's Coursera course on Algorithms (Part I and Part II). :copyright: (c) 2017 by Xianshun Chen. :license: BSD, see LICENSE for more details. """ __version__ = '0.0.14'
chen0040/pyalgs
pyalgs/__init__.py
Python
bsd-3-clause
291
0.006873
# Licensed under a 3-clause BSD style license - see LICENSE.rst from .. import config as _config class Conf(_config.ConfigNamespace): """ Configuration parameters for `astropy.table`. """ auto_colname = _config.ConfigItem( 'col{0}', 'The template that determines the name of a column if it cannot be ' 'determined. Uses new-style (format method) string formatting.', aliases=['astropy.table.column.auto_colname']) default_notebook_table_class = _config.ConfigItem( 'table-striped table-bordered table-condensed', 'The table class to be used in Jupyter notebooks when displaying ' 'tables (and not overridden). See <http://getbootstrap.com/css/#tables ' 'for a list of useful bootstrap classes.') replace_warnings = _config.ConfigItem( ['slice'], 'List of conditions for issuing a warning when replacing a table ' "column using setitem, e.g. t['a'] = value. Allowed options are " "'always', 'slice', 'refcount', 'attributes'.", 'list', ) replace_inplace = _config.ConfigItem( False, 'Always use in-place update of a table column when using setitem, ' "e.g. t['a'] = value. This overrides the default behavior of " "replacing the column entirely with the new value when possible. " "This configuration option will be deprecated and then removed in " "subsequent major releases." ) conf = Conf() from .column import Column, MaskedColumn, StringTruncateWarning, ColumnInfo from .groups import TableGroups, ColumnGroups from .table import (Table, QTable, TableColumns, Row, TableFormatter, NdarrayMixin, TableReplaceWarning) from .operations import join, setdiff, hstack, vstack, unique, TableMergeError from .bst import BST, FastBST, FastRBT from .sorted_array import SortedArray from .serialize import SerializedColumn # Finally import the formats for the read and write method but delay building # the documentation until all are loaded. (#5275) from ..io import registry with registry.delay_doc_updates(Table): # Import routines that connect readers/writers to astropy.table from .jsviewer import JSViewer from ..io.ascii import connect from ..io.fits import connect from ..io.misc import connect from ..io.votable import connect
funbaker/astropy
astropy/table/__init__.py
Python
bsd-3-clause
2,381
0.00378
"""An Itemexporter for scrapy that writes elasticsearch bulk format""" from scrapy.contrib.exporter import BaseItemExporter from scrapy.contrib.exporter import JsonLinesItemExporter class ElasticSearchBulkItemExporter(JsonLinesItemExporter): def export_item(self, item): requestdict = { "index": { "type": item.__class__.__name__ } } self.file.write(self.encoder.encode(requestdict) + '\n') super(ElasticSearchBulkItemExporter, self).export_item(item)
skade/scrapy-elasticsearch-bulk-item-exporter
scrapyelasticsearch.py
Python
bsd-3-clause
473
0.023256
#! /usr/bin/env python import csv import json import os import sys import time from collections import OrderedDict from locust import main, events from locust.exception import StopUser from requests.exceptions import HTTPError from bzt.utils import guess_csv_dialect class LocustStarter(object): def __init__(self): super(LocustStarter, self).__init__() self.fhd = None self.writer = None self.runner = None self.locust_start_time = None self.locust_stop_time = None self.locust_duration = sys.maxsize self.num_requests = sys.maxsize if os.getenv("LOCUST_DURATION"): self.locust_duration = float(os.getenv("LOCUST_DURATION")) if os.getenv("LOCUST_NUMREQUESTS"): self.num_requests = float(os.getenv("LOCUST_NUMREQUESTS")) def __check_limits(self): if self.locust_start_time is None: self.locust_start_time = time.time() # Only raise an exception if the actual test is running if self.locust_stop_time is None: if time.time() - self.locust_start_time >= self.locust_duration: raise StopUser('Duration limit reached') if self.num_requests <= 0: raise StopUser('Request limit reached') def __getrec(self, request_type, name, response_time, response_length, exc=None): rcode = '200' if exc is None else '500' rmsg = 'OK' if exc is None else '%s' % exc if isinstance(exc, HTTPError): exc_message = str(exc) rcode = exc_message[:exc_message.index(' ')] rmsg = exc_message[exc_message.index(':') + 2:] if isinstance(response_time, float): response_time = int(round(response_time)) return OrderedDict([ ('allThreads', self.runner.user_count if self.runner else 0), ('timeStamp', "%d" % (time.time() * 1000)), ('label', name), ('method', request_type), ('elapsed', response_time), ('bytes', response_length), ('responseCode', rcode), ('responseMessage', rmsg), ('success', 'true' if exc is None else 'false'), # NOTE: might be resource-consuming ('Latency', 0), ]) def __on_init(self, **args): if 'runner' in args: self.runner = args['runner'] def __on_request_success(self, request_type, name, response_time, response_length, **args): self.num_requests -= 1 self.writer.writerow(self.__getrec(request_type, name, response_time, response_length)) self.fhd.flush() self.__check_limits() def __on_request_failure(self, request_type, name, response_time, exception, response_length=0, **args): self.num_requests -= 1 self.writer.writerow(self.__getrec(request_type, name, response_time, response_length, exception)) self.fhd.flush() self.__check_limits() def __on_exception(self, locust_instance, exception, tb, **args): del locust_instance, tb self.__on_request_failure('', '', 0, exception) def __on_worker_report(self, client_id, data, **args): if data['stats'] or data['errors']: for item in data['stats']: self.num_requests -= item['num_requests'] data['client_id'] = client_id self.fhd.write("%s\n" % json.dumps(data)) self.fhd.flush() self.__check_limits() def __on_quit(self, **args): self.locust_stop_time = time.time() def execute(self): events.init.add_listener(self.__on_init) events.user_error.add_listener(self.__on_exception) events.worker_report.add_listener(self.__on_worker_report) events.quitting.add_listener(self.__on_quit) if os.getenv("JTL"): # regular locust worker fname = os.getenv("JTL") self.fhd = open(fname, 'wt') fieldnames = list(self.__getrec(None, None, None, None).keys()) dialect = guess_csv_dialect(",".join(fieldnames)) self.writer = csv.DictWriter(self.fhd, fieldnames=fieldnames, dialect=dialect) self.writer.writeheader() events.request.add_listener(self.__on_request_success) events.request.add_listener(self.__on_request_failure) elif os.getenv("WORKERS_LDJSON"): # master of distributed mode fname = os.getenv("WORKERS_LDJSON") self.fhd = open(fname, 'wt') self.writer = None else: raise ValueError("Please specify JTL or WORKERS_LDJSON environment variable") main.main() self.fhd.close() if __name__ == '__main__': locust_starter = LocustStarter() locust_starter.execute()
greyfenrir/taurus
bzt/resources/locustio-taurus-wrapper.py
Python
apache-2.0
4,812
0.001455
from unittest import TestCase from operator import itemgetter import simplejson as json class TestItemSortKey(TestCase): def test_simple_first(self): a = {'a': 1, 'c': 5, 'jack': 'jill', 'pick': 'axe', 'array': [1, 5, 6, 9], 'tuple': (83, 12, 3), 'crate': 'dog', 'zeak': 'oh'} self.assertEqual( '{"a": 1, "c": 5, "crate": "dog", "jack": "jill", "pick": "axe", "zeak": "oh", "array": [1, 5, 6, 9], "tuple": [83, 12, 3]}', json.dumps(a, item_sort_key=json.simple_first)) def test_case(self): a = {'a': 1, 'c': 5, 'Jack': 'jill', 'pick': 'axe', 'Array': [1, 5, 6, 9], 'tuple': (83, 12, 3), 'crate': 'dog', 'zeak': 'oh'} self.assertEqual( '{"Array": [1, 5, 6, 9], "Jack": "jill", "a": 1, "c": 5, "crate": "dog", "pick": "axe", "tuple": [83, 12, 3], "zeak": "oh"}', json.dumps(a, item_sort_key=itemgetter(0))) self.assertEqual( '{"a": 1, "Array": [1, 5, 6, 9], "c": 5, "crate": "dog", "Jack": "jill", "pick": "axe", "tuple": [83, 12, 3], "zeak": "oh"}', json.dumps(a, item_sort_key=lambda kv: kv[0].lower()))
itielshwartz/BackendApi
lib/simplejson/tests/test_item_sort_key.py
Python
apache-2.0
1,154
0.004333
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Functions to load the test cases ("koans") that make up the Path to Enlightenment. ''' import io import unittest # The path to enlightenment starts with the following: KOANS_FILENAME = 'koans.txt' def filter_koan_names(lines): ''' Strips leading and trailing whitespace, then filters out blank lines and comment lines. ''' for line in lines: line = line.strip() if line.startswith('#'): continue if line: yield line return def names_from_file(filename): ''' Opens the given ``filename`` and yields the fully-qualified names of TestCases found inside (one per line). ''' with io.open(filename, 'rt', encoding='utf8') as names_file: for name in filter_koan_names(names_file): yield name return def koans_suite(names): ''' Returns a ``TestSuite`` loaded with all tests found in the given ``names``, preserving the order in which they are found. ''' suite = unittest.TestSuite() loader = unittest.TestLoader() loader.sortTestMethodsUsing = None for name in names: tests = loader.loadTestsFromName(name) suite.addTests(tests) return suite def koans(filename=KOANS_FILENAME): ''' Returns a ``TestSuite`` loaded with all the koans (``TestCase``s) listed in ``filename``. ''' names = names_from_file(filename) return koans_suite(names)
haroldtreen/python_koans
runner/path_to_enlightenment.py
Python
mit
1,482
0
import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.environ['HERTZ_SECRET_KEY'] # SECURITY WARNING: don't run with debug turned on in production! DEBUG = os.environ['HERTZ_DEBUG'] != 'False' ALLOWED_HOSTS = ['*' if DEBUG else os.environ['HERTZ_HOST']] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'widget_tweaks', 'attendance', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'hertz.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ os.path.join(BASE_DIR, 'templates'), ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'hertz.wsgi.application' # Database if 'DATABASE_HOST' in os.environ: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'postgres', 'USER': os.environ['POSTGRES_USER'], 'PASSWORD': os.environ['POSTGRES_PASSWORD'], 'HOST': os.environ['DATABASE_HOST'], 'PORT': 5432, } } else: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Password validation AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization LANGUAGE_CODE = 'en-us' TIME_ZONE = 'America/Sao_Paulo' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') # STATICFILES_DIRS = [ # os.path.join(BASE_DIR, 'static'), # ] LOGIN_REDIRECT_URL = '/' LOGIN_URL = '/login'
seccom-ufsc/hertz
hertz/settings.py
Python
mit
3,237
0.001236
#!/usr/bin/env python # -*- coding: utf-8 -*- # send mail utf-8 using gmail smtp server /w jpegs from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.image import MIMEImage from email.Header import Header from email.Utils import formatdate import smtplib def send_email_with_jpeg(from_addr, to_addr, subject, body, jpegs=[], server='smtp.gmail.com', port=587): encoding='utf-8' msg = MIMEMultipart() mt = MIMEText(body.encode(encoding), 'plain', encoding) if jpegs: for fn in jpegs: img = open(fn, 'rb').read() mj = MIMEImage(img, 'jpeg', filename=fn) mj.add_header("Content-Disposition", "attachment", filename=fn) msg.attach(mj) msg.attach(mt) else: msg = mt msg['Subject'] = Header(subject, encoding) msg['From'] = from_addr msg['To'] = to_addr msg['Date'] = formatdate() _user = "xxxx@gmail.com" _pass = "xxxxxxxxxxxxxxxxxxxx" smtp = smtplib.SMTP(server, port) smtp.ehlo() smtp.starttls() smtp.ehlo() smtp.login(_user, _pass) smtp.sendmail(from_addr, [to_addr], msg.as_string()) smtp.close() ### if __name__ == '__main__': body = u'\n%s\n' % (u'写真') js = ['test.jpeg'] send_email_with_jpeg('xxxx@gmail.com', 'xxxx@blog.hatena.ne.jp', u'今日の家庭菜園', body, js)
karaage0703/denpa-gardening
send_mail.py
Python
mit
1,390
0.003644
#!/usr/bin/env python """ @author: delagarza """ from CTDopts.CTDopts import ModelError class CLIError(Exception): # Generic exception to raise and log different fatal errors. def __init__(self, msg): super(CLIError).__init__(type(self)) self.msg = "E: %s" % msg def __str__(self): return self.msg def __unicode__(self): return self.msg class InvalidModelException(ModelError): def __init__(self, message): super().__init__() self.message = message def __str__(self): return self.message def __repr__(self): return self.message class ApplicationException(Exception): def __init__(self, msg): super(ApplicationException).__init__(type(self)) self.msg = msg def __str__(self): return self.msg def __unicode__(self): return self.msg
WorkflowConversion/CTDConverter
ctdconverter/common/exceptions.py
Python
gpl-3.0
884
0
# -*- coding: utf-8 -*- # Copyright 2013 splinter authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import os import unittest import sys from splinter import Browser from .base import BaseBrowserTests from .fake_webapp import EXAMPLE_APP from .is_element_present_nojs import IsElementPresentNoJSTest @unittest.skipIf( sys.version_info[0] > 2, "zope.testbrowser is not currently compatible with Python 3", ) class ZopeTestBrowserDriverTest( BaseBrowserTests, IsElementPresentNoJSTest, unittest.TestCase ): @classmethod def setUpClass(cls): cls.browser = Browser("zope.testbrowser", wait_time=0.1) def setUp(self): self.browser.visit(EXAMPLE_APP) @classmethod def tearDownClass(self): self.browser.quit() def test_should_support_with_statement(self): with Browser("zope.testbrowser"): pass def test_attach_file(self): "should provide a way to change file field value" file_path = os.path.join( os.path.abspath(os.path.dirname(__file__)), "mockfile.txt" ) self.browser.attach_file("file", file_path) self.browser.find_by_name("upload").click() html = self.browser.html self.assertIn("text/plain", html) self.assertIn(open(file_path).read().encode("utf-8"), html) def test_forward_to_none_page(self): "should not fail when trying to forward to none" browser = Browser("zope.testbrowser") browser.visit(EXAMPLE_APP) browser.forward() self.assertEqual(EXAMPLE_APP, browser.url) browser.quit() def test_cant_switch_to_frame(self): "zope.testbrowser should not be able to switch to frames" with self.assertRaises(NotImplementedError) as cm: self.browser.get_iframe("frame_123") self.fail() e = cm.exception self.assertEqual("zope.testbrowser doesn't support frames.", e.args[0]) def test_simple_type(self): """ zope.testbrowser won't support type method because it doesn't interact with JavaScript """ with self.assertRaises(NotImplementedError): self.browser.type("query", "with type method") def test_simple_type_on_element(self): """ zope.testbrowser won't support type method because it doesn't interact with JavaScript """ with self.assertRaises(NotImplementedError): self.browser.find_by_name("query").type("with type method") def test_can_clear_password_field_content(self): "zope.testbrowser should not be able to clear" with self.assertRaises(NotImplementedError): self.browser.find_by_name("password").first.clear() def test_can_clear_tel_field_content(self): "zope.testbrowser should not be able to clear" with self.assertRaises(NotImplementedError): self.browser.find_by_name("telephone").first.clear() def test_can_clear_text_field_content(self): "zope.testbrowser should not be able to clear" with self.assertRaises(NotImplementedError): self.browser.find_by_name("query").first.clear() def test_slowly_typing(self): """ zope.testbrowser won't support type method because it doesn't interact with JavaScript """ with self.assertRaises(NotImplementedError): self.browser.type("query", "with type method", slowly=True) def test_slowly_typing_on_element(self): """ zope.testbrowser won't support type method on element because it doesn't interac with JavaScript """ with self.assertRaises(NotImplementedError): query = self.browser.find_by_name("query") query.type("with type method", slowly=True) def test_cant_mouseover(self): "zope.testbrowser should not be able to put the mouse over the element" with self.assertRaises(NotImplementedError): self.browser.find_by_css("#visible").mouse_over() def test_cant_mouseout(self): "zope.testbrowser should not be able to mouse out of an element" with self.assertRaises(NotImplementedError): self.browser.find_by_css("#visible").mouse_out() def test_links_with_nested_tags_xpath(self): links = self.browser.find_by_xpath('//a/span[text()="first bar"]/..') self.assertEqual( len(links), 1, 'Found not exactly one link with a span with text "BAR ONE". %s' % (map(lambda item: item.outer_html, links)), ) def test_finding_all_links_by_non_ascii_text(self): "should find links by non ascii text" non_ascii_encodings = { "pangram_pl": u"Jeżu klątw, spłódź Finom część gry hańb!", "pangram_ja": u"天 地 星 空", "pangram_ru": u"В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!", "pangram_eo": u"Laŭ Ludoviko Zamenhof bongustas freŝa ĉeĥa manĝaĵo kun spicoj.", } for key, text in non_ascii_encodings.iteritems(): link = self.browser.find_link_by_text(text) self.assertEqual(key, link["id"])
bmcculley/splinter
tests/test_zopetestbrowser.py
Python
bsd-3-clause
5,355
0.000378
# -*- coding: utf-8 -*- ''' Created on May 3, 2014 @author: andy ''' #list Tuple if __name__ == '__main__': pass
goday-org/learnPython
src/Arrays.py
Python
gpl-3.0
119
0.02521
import graphAttack as ga import numpy as np import pickle """Control script""" def run(simulationIndex, X, Y=None): """Run the model""" print("Training with:", simulationIndex) seriesLength, nFeatures = X.shape # ------ it is important that the exampleLength is the same as # ------ the number if examples in the mini batch so that # ------ the state of the RNN is continously passed forward exampleLength = 4 nExamples = exampleLength nHidden0 = 25 nHidden1 = 25 mainGraph = ga.Graph(False) dummyX = np.zeros((nExamples, exampleLength, nFeatures)) feed = mainGraph.addOperation(ga.Variable(dummyX), feederOperation=True) # ------ Generate the network, options are RNN and LSTM gates # ------ Add initial layer and then possibly append more hactivations0, cStates0 = ga.addInitialLSTMLayer(mainGraph, inputOperation=feed, nHidden=nHidden0) hactivations1, cStates1 = ga.appendLSTMLayer(mainGraph, previousActivations=hactivations0, nHidden=nHidden1) # hactivations0 = ga.addInitialRNNLayer(mainGraph, # inputOperation=feed, # activation=ga.TanhActivation, # nHidden=nHidden1) # hactivations1 = ga.appendRNNLayer(mainGraph, # previousActivations=hactivations0, # activation=ga.TanhActivation, # nHidden=nHidden1) finalCost, costOperationsList = ga.addRNNCost(mainGraph, hactivations1, costActivation=ga.SoftmaxActivation, costOperation=ga.CrossEntropyCostSoftmax, nHidden=nHidden1, labelsShape=feed.shape, labels=None) hactivations = [hactivations0, hactivations1] cStates = [cStates0, cStates1] nHiddenList = [nHidden0, nHidden1] def fprime(p, data, labels, costOperationsList=costOperationsList, mainGraph=mainGraph): mainGraph.feederOperation.assignData(data) mainGraph.resetAll() for index, cop in enumerate(costOperationsList): cop.assignLabels(labels[:, index, :]) mainGraph.attachParameters(p) c = mainGraph.feedForward() mainGraph.feedBackward() g = mainGraph.unrollGradients() nLayers = len(hactivations) for i in range(nLayers): hactivations[i][0].assignData(hactivations[i][-1].getValue()) cStates[i][0].assignData(cStates[i][-1].getValue()) return c, g param0 = mainGraph.unrollGradientParameters() print("Number of parameters to train:", len(param0)) adamGrad = ga.adaptiveSGDrecurrent(trainingData=X, param0=param0, epochs=1e3, miniBatchSize=nExamples, exampleLength=exampleLength, initialLearningRate=1e-3, beta1=0.9, beta2=0.999, epsilon=1e-8, testFrequency=1e2, function=fprime) pickleFilename = "minimizerParamsRNN_" + str(simulationIndex) + ".pkl" # with open(pickleFilename, "rb") as fp: # adamParams = pickle.load(fp) # adamGrad.restoreState(adamParams) # params = adamParams["params"] params = adamGrad.minimize(printTrainigCost=True, printUpdateRate=False, dumpParameters=pickleFilename) mainGraph.attachParameters(params) cache = (nFeatures, nHiddenList, hactivations, cStates, costOperationsList) return mainGraph, cache, adamGrad.costLists[-1] if(__name__ == "__main__"): # ------ This is a very limited dataset, load a lrger one for better results pickleFilename = "dataSet/singleSentence.pkl" with open(pickleFilename, "rb") as fp: x, index_to_word, word_to_index = pickle.load(fp) simulationIndex = 0 mainGraph, cache, finalCost = run(simulationIndex, x) nFeatures, nHiddenList, hactivations, cStates, costOperationsList = cache temp = ga.sampleManyLSTM(100, nFeatures, nHiddenList, hactivations=hactivations, cStates=cStates, costOperationsList=costOperationsList, mainGraph=mainGraph, index_to_word=index_to_word) print(temp) # temp = ga.sampleManyRNN(100, nFeatures, nHiddenList, # hactivations=hactivations, # costOperationsList=costOperationsList, # mainGraph=mainGraph, # index_to_word=index_to_word) # print(temp)
jgolebiowski/graphAttack
controlTrainRNN.py
Python
mit
5,411
0.000924
from sys import version_info py3 = version_info[0] > 2 if py3: response = input("Please enter your name: ") else: response = raw_input("Please enter your name: ") print("Hello " + response)
SonyStone/pylib
Practical Maya Programming/input.py
Python
mit
199
0.005025
import os, scrapy, argparse from realclearpolitics.spiders.spider import RcpSpider from scrapy.crawler import CrawlerProcess parser = argparse.ArgumentParser('Scrap realclearpolitics polls data') parser.add_argument('url', action="store") parser.add_argument('--locale', action="store", default='') parser.add_argument('--race', action="store", default='primary') parser.add_argument('--csv', dest='to_csv', action='store_true') parser.add_argument('--output', dest='output', action='store') args = parser.parse_args() url = args.url extra_fields = { 'locale': args.locale, 'race': args.race } if (args.to_csv): if args.output is None: filename = url.split('/')[-1].split('.')[0] output = filename + ".csv" print("No output file specified : using " + output) else: output = args.output if not output.endswith(".csv"): output = output + ".csv" if os.path.isfile(output): os.remove(output) os.system("scrapy crawl realclearpoliticsSpider -a url="+url+" -o "+output) else: settings = { 'ITEM_PIPELINES' : { 'realclearpolitics.pipeline.PollPipeline': 300, }, 'LOG_LEVEL' : 'ERROR', 'DOWNLOAD_HANDLERS' : {'s3': None,} } process = CrawlerProcess(settings); process.crawl(RcpSpider, url, extra_fields) process.start()
dpxxdp/berniemetrics
private/scrapers/realclearpolitics-scraper/scraper.py
Python
mit
1,355
0.005904
from cms.utils.conf import get_cms_setting from django.conf import settings from django.conf.urls import include, url from django.conf.urls.i18n import i18n_patterns from django.contrib import admin from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.views.i18n import JavaScriptCatalog from django.views.static import serve admin.autodiscover() urlpatterns = [ url(r"^media/(?P<path>.*)$", serve, {"document_root": settings.MEDIA_ROOT, "show_indexes": True}), url(r"^media/cms/(?P<path>.*)$", serve, {"document_root": get_cms_setting("MEDIA_ROOT"), "show_indexes": True}), url(r"^jsi18n/$", JavaScriptCatalog.as_view(), name="javascript-catalog"), ] urlpatterns += staticfiles_urlpatterns() urlpatterns += i18n_patterns( url(r"^admin/", admin.site.urls), url(r"^", include("cms.urls")), )
nephila/djangocms-apphook-setup
tests/test_utils/urls.py
Python
bsd-3-clause
842
0.002375
# The primary purpose of this module is to run data hashing and comparison functions # It is also called during the intialization of modules to register their hashing and comparison functions. # Try to leave all the boilerplate calls like DB access and JSON decoding in the main.py file import hijackingprevention.session as session import hijackingprevention.api_user as api_user from tornado import gen import logging logger = logging.getLogger(__name__) OK = (200, 'OK') class Receiver(): """This class handles all requests to hash and interpret data. Most of the shared functionalty that underpins the API is defined here. Functions in here fall into two catagories: Functions that allow modules to register hashers or comparers. Functions that run the registered hashers or comparers. Please note: If a function you are considering including in this file does not invoke a hasher, translator, or comparer it may not belong in this file. """ def __init__(self): self.__hashers = {} self.__translators = {} self.__comparers = {} self.__maxscores = {} self.__callbacks = {} # Module registration functions def add_hasher(self, name, fxn): """This is called by each module on startup to register its sitewide hasher.""" self.__hashers[name] = fxn def add_translator(self, name, fxn): """This is called by each module on startup to register its data translator. Translators hash data, which has already been hashed by a (sitewide) hasher, with a per user salt. """ self.__translators[name] = fxn def add_comparer(self, name, fxn, score): """This is called by each module on startup to register its hash comparer.""" self.__comparers[name] = fxn self.__maxscores[name] = score # Module users and API interface @gen.coroutine def add_data(self, req, headers, db): """This function is called when data is received from a browser to hash and store the data""" # This function has, rather irritatingly, remained in spite of my attempt to keep database access out of the api.py file. if req['name'] in self.__hashers.keys(): #setup to invoke hasher site = api_user.Site(db) yield site.get_by_client_key(req['ck'], headers.get("Host")) salt = site.get_salt(req['name']) #invoke hasher hash = yield self.__hashers[req['name']](req['data'], headers, salt) #store the result site_id = site.get_id() ses = session.Session(req['sid'], site_id, db) #setup session object yield ses.read_db() #read session if it exists ses.add_data({req['name']:hash}) #add data to session object yield ses.write_out() #update session object in database return(OK) #Nothing failed. Right? oops. else: logger.warning('Could not find a handler for "' + req['name'] + '"') return(400, 'Err: Could not find a handler for "' + req['name'] + '"') @gen.coroutine def copy_data(self, ses, member): """This function is called to store session data permenantly to the user profile""" data = {} for dt in ses.keys(): data[dt] = yield self.__translators[dt](ses[dt]) member.add_data(data) return(OK) @gen.coroutine def __calculate_sub_rating(self, data_type, session_dat, user_dat): """Calculate trust score for specific subtype of user data""" sub_tot = 0 if data_type in user_dat and data_type in session_dat: for h in user_dat[data_type]: #loop through all the user's hashed data of this type and compare it to the session temp = (yield self.__comparers[data_type]( session_dat[data_type], h)) if temp > sub_tot: #fix security issue created by the previous ability to combine multiple low scores sub_tot = temp elif data_type not in session_dat and data_type in user_dat: #the user's session data may have expired or have not been collected sub_tot = -1*self.__maxscores[data_type] #score nonexistant data negativly return(sub_tot) @gen.coroutine def get_trust(self, session_dat, user_dat): """This scores how trustworthy a user is as a number between -1 and 1. The score is based on how much session data matches the data stored in their user profile. A score of 1 means that the user is perfectly trustworthy, a score of 0 means they cannot be trusted. A negative score means that the session data has expired and an accurate determination cannot be made. """ total = 0 #total user score actmax = 0 #maximum achievable total (A user with this score is PERFECT) for dt in self.__comparers.keys(): #loop through all the types of data actmax += self.__maxscores[dt] #add data type's max score to the maximum total += yield self.__calculate_sub_rating(dt, session_dat, user_dat) #calculate sub score for given data type and add it to total try: return(200, str(total/actmax)) except ZeroDivisionError: logger.critical('This server does not have any client data collection and analysis modules installed') return(501, 'This server does not have any data collection and analysis modules installed')
michardy/account-hijacking-prevention
hijackingprevention/api.py
Python
mit
4,967
0.02879
class AuthenticationError(Exception): pass
kuldeep-k/pySocialFactory
socialFactory/core/AuthenticationError.py
Python
mit
56
0.017857
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt # Event # ------------- from __future__ import unicode_literals import frappe @frappe.whitelist() def get_cal_events(m_st, m_end): # load owned events res1 = frappe.db.sql("""select name from `tabEvent` WHERE ifnull(event_date,'2000-01-01') between %s and %s and owner = %s and event_type != 'Public' and event_type != 'Cancel'""", (m_st, m_end, frappe.user.name)) # load individual events res2 = frappe.db.sql("""select t1.name from `tabEvent` t1, `tabEvent User` t2 where ifnull(t1.event_date,'2000-01-01') between %s and %s and t2.person = %s and t1.name = t2.parent and t1.event_type != 'Cancel'""", (m_st, m_end, frappe.user.name)) # load role events roles = frappe.user.get_roles() myroles = ['t2.role = "%s"' % r.replace('"', '\"') for r in roles] myroles = '(' + (' OR '.join(myroles)) + ')' res3 = frappe.db.sql("""select t1.name from `tabEvent` t1, `tabEvent Role` t2 where ifnull(t1.event_date,'2000-01-01') between %s and %s and t1.name = t2.parent and t1.event_type != 'Cancel' and %s""" % ('%s', '%s', myroles), (m_st, m_end)) # load public events res4 = frappe.db.sql("select name from `tabEvent` \ where ifnull(event_date,'2000-01-01') between %s and %s and event_type='Public'", (m_st, m_end)) doclist, rl = [], [] for r in res1 + res2 + res3 + res4: if not r in rl: doclist += frappe.get_doc('Event', r[0]) rl.append(r) return doclist
gangadharkadam/shfr
frappe/widgets/event.py
Python
mit
1,523
0.0348
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, division, print_function, unicode_literals import http.server import itertools import json import logging import mimetypes import os import pkgutil import re from builtins import bytes, object, open, range, str, zip from collections import namedtuple from datetime import date, datetime from textwrap import dedent import pystache from future.moves.urllib.parse import parse_qs, urlencode, urlsplit, urlunparse from pants.base.build_environment import get_buildroot from pants.base.mustache import MustacheRenderer from pants.base.run_info import RunInfo from pants.pantsd.process_manager import ProcessManager logger = logging.getLogger(__name__) # Google Prettyprint plugin files. PPP_RE = re.compile(r"^lang-.*\.js$") class PantsHandler(http.server.BaseHTTPRequestHandler): """A handler that demultiplexes various pants reporting URLs.""" def __init__(self, settings, renderer, request, client_address, server): self._settings = settings # An instance of ReportingServer.Settings. self._root = self._settings.root self._renderer = renderer self._client_address = client_address # The underlying handlers for specific URL prefixes. self._GET_handlers = [ ('/runs/', self._handle_runs), # Show list of known pants runs. ('/run/', self._handle_run), # Show a report for a single pants run. ('/browse/', self._handle_browse), # Browse filesystem under build root. ('/content/', self._handle_content), # Show content of file. ('/assets/', self._handle_assets), # Statically serve assets (css, js etc.) ('/poll', self._handle_poll), # Handle poll requests for raw file content. ('/latestrunid', self._handle_latest_runid), # Return id of latest pants run. ('/favicon.ico', self._handle_favicon) # Return favicon. ] # TODO(#6071): BaseHTTPServer.BaseHTTPRequestHandler is an old-style class, so we must # invoke its __init__ like this. # TODO: Replace this entirely with a proper server as part of the pants daemon. http.server.BaseHTTPRequestHandler.__init__(self, request, client_address, server) def do_GET(self): """GET method implementation for BaseHTTPRequestHandler.""" if not self._client_allowed(): return try: (_, _, path, query, _) = urlsplit(self.path) params = parse_qs(query) # Give each handler a chance to respond. for prefix, handler in self._GET_handlers: if self._maybe_handle(prefix, handler, path, params): return # If no path specified, default to showing the list of all runs. if path == '/': self._handle_runs('', {}) return content = 'Invalid GET request {}'.format(self.path).encode('utf-8'), self._send_content(content, 'text/html', code=400) except (IOError, ValueError): pass # Printing these errors gets annoying, and there's nothing to do about them anyway. #sys.stderr.write('Invalid GET request {}'.format(self.path)) def _handle_runs(self, relpath, params): """Show a listing of all pants runs since the last clean-all.""" runs_by_day = self._partition_runs_by_day() args = self._default_template_args('run_list.html') args['runs_by_day'] = runs_by_day content = self._renderer.render_name('base.html', args).encode("utf-8") self._send_content(content, 'text/html') _collapsible_fmt_string = dedent(""" <div class="{class_prefix}" id="{id}"> <div class="{class_prefix}-header toggle-header" id="{id}-header"> <div class="{class_prefix}-header-icon toggle-header-icon" onclick="pants.collapsible.toggle('{id}')"> <i id="{id}-icon" class="visibility-icon icon-large icon-caret-right hidden"></i> </div> <div class="{class_prefix}-header-text toggle-header-text"> [<span id="{id}-header-text">{title}</span>] </div> </div> <div class="{class_prefix}-content toggle-content nodisplay" id="{id}-content"></div> </div> """) def _handle_run(self, relpath, params): """Show the report for a single pants run.""" args = self._default_template_args('run.html') run_id = relpath run_info = self._get_run_info_dict(run_id) if run_info is None: args['no_such_run'] = relpath if run_id == 'latest': args['is_latest'] = 'none' else: report_abspath = run_info['default_report'] report_relpath = os.path.relpath(report_abspath, self._root) report_dir = os.path.dirname(report_relpath) self_timings_path = os.path.join(report_dir, 'self_timings') cumulative_timings_path = os.path.join(report_dir, 'cumulative_timings') artifact_cache_stats_path = os.path.join(report_dir, 'artifact_cache_stats') run_info['timestamp_text'] = \ datetime.fromtimestamp(float(run_info['timestamp'])).strftime('%H:%M:%S on %A, %B %d %Y') timings_and_stats = '\n'.join([ self._collapsible_fmt_string.format(id='cumulative-timings-collapsible', title='Cumulative timings', class_prefix='aggregated-timings'), self._collapsible_fmt_string.format(id='self-timings-collapsible', title='Self timings', class_prefix='aggregated-timings'), self._collapsible_fmt_string.format(id='artifact-cache-stats-collapsible', title='Artifact cache stats', class_prefix='artifact-cache-stats') ]) args.update({'run_info': run_info, 'report_path': report_relpath, 'self_timings_path': self_timings_path, 'cumulative_timings_path': cumulative_timings_path, 'artifact_cache_stats_path': artifact_cache_stats_path, 'timings_and_stats': timings_and_stats}) if run_id == 'latest': args['is_latest'] = run_info['id'] content = self._renderer.render_name('base.html', args).encode("utf-8") self._send_content(content, 'text/html') def _handle_browse(self, relpath, params): """Handle requests to browse the filesystem under the build root.""" abspath = os.path.normpath(os.path.join(self._root, relpath)) if not abspath.startswith(self._root): raise ValueError # Prevent using .. to get files from anywhere other than root. if os.path.isdir(abspath): self._serve_dir(abspath, params) elif os.path.isfile(abspath): self._serve_file(abspath, params) def _handle_content(self, relpath, params): """Render file content for pretty display.""" abspath = os.path.normpath(os.path.join(self._root, relpath)) if os.path.isfile(abspath): with open(abspath, 'rb') as infile: content = infile.read() else: content = 'No file found at {}'.format(abspath).encode('utf-8') content_type = mimetypes.guess_type(abspath)[0] or 'text/plain' if not content_type.startswith('text/') and not content_type == 'application/xml': # Binary file. Display it as hex, split into lines. n = 120 # Display lines of this max size. content = repr(content)[1:-1] # Will escape non-printables etc, dropping surrounding quotes. content = '\n'.join([content[i:i + n] for i in range(0, len(content), n)]) prettify = False prettify_extra_langs = [] else: prettify = True if self._settings.assets_dir: prettify_extra_dir = os.path.join(self._settings.assets_dir, 'js', 'prettify_extra_langs') prettify_extra_langs = [{'name': x} for x in os.listdir(prettify_extra_dir)] else: # TODO: Find these from our package, somehow. prettify_extra_langs = [] linenums = True args = {'prettify_extra_langs': prettify_extra_langs, 'content': content, 'prettify': prettify, 'linenums': linenums} content = self._renderer.render_name('file_content.html', args).encode("utf-8") self._send_content(content, 'text/html') def _handle_assets(self, relpath, params): """Statically serve assets: js, css etc.""" if self._settings.assets_dir: abspath = os.path.normpath(os.path.join(self._settings.assets_dir, relpath)) with open(abspath, 'rb') as infile: content = infile.read() else: content = pkgutil.get_data(__name__, os.path.join('assets', relpath)) content_type = mimetypes.guess_type(relpath)[0] or 'text/plain' self._send_content(content, content_type) def _handle_poll(self, relpath, params): """Handle poll requests for raw file contents.""" request = json.loads(params.get('q')[0]) ret = {} # request is a polling request for multiple files. For each file: # - id is some identifier assigned by the client, used to differentiate the results. # - path is the file to poll. # - pos is the last byte position in that file seen by the client. for poll in request: _id = poll.get('id', None) path = poll.get('path', None) pos = poll.get('pos', 0) if path: abspath = os.path.normpath(os.path.join(self._root, path)) if os.path.isfile(abspath): with open(abspath, 'rb') as infile: if pos: infile.seek(pos) content = infile.read() ret[_id] = content.decode("utf-8") content = json.dumps(ret).encode("utf-8") self._send_content(content, 'application/json') def _handle_latest_runid(self, relpath, params): """Handle request for the latest run id. Used by client-side javascript to detect when there's a new run to display. """ latest_runinfo = self._get_run_info_dict('latest') if latest_runinfo is None: self._send_content(b'none', 'text/plain') else: self._send_content(latest_runinfo['id'].encode("utf-8"), 'text/plain') def _handle_favicon(self, relpath, params): """Statically serve the favicon out of the assets dir.""" self._handle_assets('favicon.ico', params) def _partition_runs_by_day(self): """Split the runs by day, so we can display them grouped that way.""" run_infos = self._get_all_run_infos() for x in run_infos: ts = float(x['timestamp']) x['time_of_day_text'] = datetime.fromtimestamp(ts).strftime('%H:%M:%S') def date_text(dt): delta_days = (date.today() - dt).days if delta_days == 0: return 'Today' elif delta_days == 1: return 'Yesterday' elif delta_days < 7: return dt.strftime('%A') # Weekday name. else: d = dt.day % 10 suffix = 'st' if d == 1 else 'nd' if d == 2 else 'rd' if d == 3 else 'th' return dt.strftime('%B %d') + suffix # E.g., October 30th. keyfunc = lambda x: datetime.fromtimestamp(float(x['timestamp'])) sorted_run_infos = sorted(run_infos, key=keyfunc, reverse=True) return [{'date_text': date_text(dt), 'run_infos': [x for x in infos]} for dt, infos in itertools.groupby(sorted_run_infos, lambda x: keyfunc(x).date())] def _get_run_info_dict(self, run_id): """Get the RunInfo for a run, as a dict.""" run_info_path = os.path.join(self._settings.info_dir, run_id, 'info') if os.path.exists(run_info_path): # We copy the RunInfo as a dict, so we can add stuff to it to pass to the template. return RunInfo(run_info_path).get_as_dict() else: return None def _get_all_run_infos(self): """Find the RunInfos for all runs since the last clean-all.""" info_dir = self._settings.info_dir if not os.path.isdir(info_dir): return [] paths = [os.path.join(info_dir, x) for x in os.listdir(info_dir)] # We copy the RunInfo as a dict, so we can add stuff to it to pass to the template. # We filter only those that have a timestamp, to avoid a race condition with writing # that field. return [d for d in [RunInfo(os.path.join(p, 'info')).get_as_dict() for p in paths if os.path.isdir(p) and not os.path.islink(p)] if 'timestamp' in d] def _serve_dir(self, abspath, params): """Show a directory listing.""" relpath = os.path.relpath(abspath, self._root) breadcrumbs = self._create_breadcrumbs(relpath) entries = [{'link_path': os.path.join(relpath, e), 'name': e} for e in os.listdir(abspath)] args = self._default_template_args('dir.html') args.update({'root_parent': os.path.dirname(self._root), 'breadcrumbs': breadcrumbs, 'entries': entries, 'params': params}) content = self._renderer.render_name('base.html', args).encode("utf-8") self._send_content(content, 'text/html') def _serve_file(self, abspath, params): """Show a file. The actual content of the file is rendered by _handle_content. """ relpath = os.path.relpath(abspath, self._root) breadcrumbs = self._create_breadcrumbs(relpath) link_path = urlunparse(['', '', relpath, '', urlencode(params), '']) args = self._default_template_args('file.html') args.update({'root_parent': os.path.dirname(self._root), 'breadcrumbs': breadcrumbs, 'link_path': link_path}) content = self._renderer.render_name('base.html', args).encode("utf-8") self._send_content(content, 'text/html') def _send_content(self, content, content_type, code=200): """Send content to client.""" assert isinstance(content, bytes) self.send_response(code) self.send_header('Content-Type', content_type) self.send_header('Content-Length', str(len(content))) self.end_headers() self.wfile.write(content) def _client_allowed(self): """Check if client is allowed to connect to this server.""" client_ip = self._client_address[0] if not client_ip in self._settings.allowed_clients and \ not 'ALL' in self._settings.allowed_clients: content = 'Access from host {} forbidden.'.format(client_ip).encode('utf-8') self._send_content(content, 'text/html') return False return True def _maybe_handle(self, prefix, handler, path, params, data=None): """Apply the handler if the prefix matches.""" if path.startswith(prefix): relpath = path[len(prefix):] if data: handler(relpath, params, data) else: handler(relpath, params) return True else: return False def _create_breadcrumbs(self, relpath): """Create filesystem browsing breadcrumb navigation. That is, make each path segment into a clickable element that takes you to that dir. """ if relpath == '.': breadcrumbs = [] else: path_parts = [os.path.basename(self._root)] + relpath.split(os.path.sep) path_links = ['/'.join(path_parts[1:i + 1]) for i, name in enumerate(path_parts)] breadcrumbs = [{'link_path': link_path, 'name': name} for link_path, name in zip(path_links, path_parts)] return breadcrumbs def _default_template_args(self, content_template): """Initialize template args.""" def include(text, args): template_name = pystache.render(text, args) return self._renderer.render_name(template_name, args) # Our base template calls include on the content_template. ret = {'content_template': content_template} ret['include'] = lambda text: include(text, ret) return ret def log_message(self, fmt, *args): """Silence BaseHTTPRequestHandler's logging.""" class ReportingServer(object): """Reporting Server HTTP server.""" class Settings(namedtuple('Settings', ['info_dir', 'template_dir', 'assets_dir', 'root', 'allowed_clients'])): """Reporting server settings. info_dir: path to dir containing RunInfo files. template_dir: location of mustache template files. If None, the templates embedded in our package are used. assets_dir: location of assets (js, css etc.) If None, the assets embedded in our package are used. root: build root. allowed_clients: list of ips or ['ALL']. """ def __init__(self, port, settings): renderer = MustacheRenderer(settings.template_dir, __name__) class MyHandler(PantsHandler): def __init__(self, request, client_address, server): PantsHandler.__init__(self, settings, renderer, request, client_address, server) self._httpd = http.server.HTTPServer(('', port), MyHandler) self._httpd.timeout = 0.1 # Not the network timeout, but how often handle_request yields. def server_port(self): return self._httpd.server_port def start(self): self._httpd.serve_forever() class ReportingServerManager(ProcessManager): def __init__(self, context=None, options=None): ProcessManager.__init__(self, name='reporting_server') self.context = context self.options = options def post_fork_child(self): """Post-fork() child callback for ProcessManager.daemonize().""" # The server finds run-specific info dirs by looking at the subdirectories of info_dir, # which is conveniently and obviously the parent dir of the current run's info dir. info_dir = os.path.dirname(self.context.run_tracker.run_info_dir) settings = ReportingServer.Settings(info_dir=info_dir, root=get_buildroot(), template_dir=self.options.template_dir, assets_dir=self.options.assets_dir, allowed_clients=self.options.allowed_clients) server = ReportingServer(self.options.port, settings) self.write_socket(server.server_port()) # Block forever. server.start()
twitter/pants
src/python/pants/reporting/reporting_server.py
Python
apache-2.0
17,903
0.00849
import chess chess.run()
renatopp/liac-chess
main.py
Python
mit
25
0.04
import logging from google.appengine.ext import ndb from endpoints_proto_datastore.ndb.model import EndpointsModel, EndpointsAliasProperty class UserModel(EndpointsModel): email = ndb.StringProperty() name = ndb.StringProperty()
LookThisCode/DeveloperBus
Season 2013/Bogota/Projects/06.Agile_Business/backend/app/models/user.py
Python
apache-2.0
231
0.021645
# MIT License # Copyright (c) 2016 https://github.com/sndnv # See the project's LICENSE file for the full text def get_header_files_size_data(sources_dir, header_files_by_size, rows_count): """ Builds table rows list containing data about header files sizes (largest/smallest). :param sources_dir: configured sources directory :param header_files_by_size: list of header files ordered by size (smallest to largest) :param rows_count: number of rows to build :return: the requested table rows """ data = [ ("-------------------", "----", "--------------------", "----"), ("Largest Header File", "Size", "Smallest Header File", "Size"), ("-------------------", "----", "--------------------", "----") ] largest_headers = header_files_by_size[-rows_count:] largest_headers.reverse() smallest_headers = header_files_by_size[:rows_count] for n in range(0, rows_count): top = largest_headers[n] if len(largest_headers) > n else None bottom = smallest_headers[n] if len(smallest_headers) > n else None data.append( ( top.file_path.replace(sources_dir, '~') if top is not None else "-", "{0:.2f} KB".format(top.size / 1024) if top is not None else "-", bottom.file_path.replace(sources_dir, '~') if bottom is not None else "-", "{0:.2f} KB".format(bottom.size / 1024) if bottom is not None else "-" ) ) return data def get_implementation_files_size_data(sources_dir, implementation_files_by_size, rows_count): """ Builds table rows list containing data about implementation files sizes (largest/smallest). :param sources_dir: configured sources directory :param implementation_files_by_size: list of implementation files ordered by size (smallest to largest) :param rows_count: number of rows to build :return: the requested table rows """ data = [ ("---------------------------", "----", "----------------------------", "----"), ("Largest Implementation File", "Size", "Smallest Implementation File", "Size"), ("---------------------------", "----", "----------------------------", "----") ] largest_implementations = implementation_files_by_size[-rows_count:] largest_implementations.reverse() smallest_implementations = implementation_files_by_size[:rows_count] for n in range(0, rows_count): top = largest_implementations[n] if len(largest_implementations) > n else None bottom = smallest_implementations[n] if len(smallest_implementations) > n else None data.append( ( top.file_path.replace(sources_dir, '~') if top is not None else "-", "{0:.2f} KB".format(top.size / 1024) if top is not None else "-", bottom.file_path.replace(sources_dir, '~') if bottom is not None else "-", "{0:.2f} KB".format(bottom.size / 1024) if bottom is not None else "-" ) ) return data def get_header_files_deps_data(sources_dir, header_files_by_deps_count, rows_count): """ Builds table rows list containing data about header files dependency counts (most/least). :param sources_dir: configured sources directory :param header_files_by_deps_count: list of header files ordered by dependency count (least to most) :param rows_count: number of rows to build :return: the requested table rows """ data = [ ("-----------------------------", "-----", "------------------------------", "-----"), ("Most Dependencies Header File", "Count", "Least Dependencies Header File", "Count"), ("-----------------------------", "-----", "------------------------------", "-----") ] most_deps_headers = header_files_by_deps_count[-rows_count:] most_deps_headers.reverse() least_deps_headers = header_files_by_deps_count[:rows_count] for n in range(0, rows_count): top = most_deps_headers[n] if len(most_deps_headers) > n else None bottom = least_deps_headers[n] if len(least_deps_headers) > n else None if top is not None: top_count = (len(top.internal_dependencies) + len(top.external_dependencies)) else: top_count = "-" if bottom is not None: bottom_count = (len(bottom.internal_dependencies) + len(bottom.external_dependencies)) else: bottom_count = "-" data.append( ( top.file_path.replace(sources_dir, '~') if top is not None else "-", top_count, bottom.file_path.replace(sources_dir, '~') if bottom is not None else "-", bottom_count ) ) return data def get_implementation_files_deps_data(sources_dir, implementation_files_by_deps_count, rows_count): """ Builds table rows list containing data about implementation files dependency counts (most/least). :param sources_dir: configured sources directory :param implementation_files_by_deps_count: list of implementation files ordered by dependency count (least to most) :param rows_count: number of rows to build :return: the requested table rows """ data = [ ("---------------------------", "-----", "----------------------------", "-----"), ("Most Dependencies Impl File", "Count", "Least Dependencies Impl File", "Count"), ("---------------------------", "-----", "----------------------------", "-----") ] most_deps_implementations = implementation_files_by_deps_count[-rows_count:] most_deps_implementations.reverse() least_deps_implementations = implementation_files_by_deps_count[:rows_count] for n in range(0, rows_count): top = most_deps_implementations[n] if len(most_deps_implementations) > n else None bottom = least_deps_implementations[n] if len(least_deps_implementations) > n else None if top is not None: top_count = ( len(top.internal_dependencies) + len(top.external_dependencies) ) else: top_count = "-" if bottom is not None: bottom_count = ( len(bottom.internal_dependencies) + len(bottom.external_dependencies) ) else: bottom_count = "-" data.append( ( top.file_path.replace(sources_dir, '~') if top is not None else "-", top_count, bottom.file_path.replace(sources_dir, '~') if bottom is not None else "-", bottom_count ) ) return data def get_internal_deps_data(sources_dir, internal_deps_by_use_count, internal_dependencies, rows_count): """ Builds table rows list containing data about internal dependency use counts (most/least). :param sources_dir: configured sources directory :param internal_deps_by_use_count: list of internal dependencies by use count (least to most) :param internal_dependencies: dict with all internal dependencies :param rows_count: number of rows to build :return: the requested table rows """ data = [ ("-----------------------------", "-----", "------------------------------", "-----"), ("Most Used Internal Dependency", "Count", "Least Used Internal Dependency", "Count"), ("-----------------------------", "-----", "------------------------------", "-----") ] most_used_deps = internal_deps_by_use_count[-rows_count:] most_used_deps.reverse() least_used_deps = internal_deps_by_use_count[:rows_count] for n in range(0, rows_count): top = most_used_deps[n] if len(most_used_deps) > n else None bottom = least_used_deps[n] if len(least_used_deps) > n else None data.append( ( top.replace(sources_dir, '~') if top is not None else "-", len(internal_dependencies[top]) if top is not None else "-", bottom.replace(sources_dir, '~') if bottom is not None else "-", len(internal_dependencies[bottom]) if bottom is not None else "-" ) ) return data def get_external_deps_data(external_deps_by_use_count, external_dependencies, rows_count): """ Builds table rows list containing data about external dependency use counts (most/least). :param external_deps_by_use_count: list of external dependencies by use count (least to most) :param external_dependencies: dict with all external dependencies :param rows_count: number of rows to build :return: the requested table rows """ data = [ ("-----------------------------", "-----", "------------------------------", "-----"), ("Most Used External Dependency", "Count", "Least Used External Dependency", "Count"), ("-----------------------------", "-----", "------------------------------", "-----") ] most_used_deps = external_deps_by_use_count[-rows_count:] most_used_deps.reverse() least_used_deps = external_deps_by_use_count[:rows_count] for n in range(0, rows_count): top = most_used_deps[n] if len(most_used_deps) > n else None bottom = least_used_deps[n] if len(least_used_deps) > n else None data.append( ( top if top is not None else "-", len(external_dependencies[top]) if top is not None else "-", bottom if bottom is not None else "-", len(external_dependencies[bottom]) if bottom is not None else "-" ) ) return data
sndnv/cadb
cadb/utils/Stats.py
Python
mit
9,700
0.005773
"""Urls for the Zinnia entries""" from django.conf.urls import url from django.conf.urls import patterns from zinnia.views.entries import EntryDetail urlpatterns = patterns( '', url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', EntryDetail.as_view(), name='zinnia_entry_detail'), )
pczhaoyun/obtainfo
zinnia/urls/entries.py
Python
apache-2.0
335
0
from mercurial import cmdutil _hgignore_content = """\ syntax: glob *~ *.pyc *.pyo *.bak cache/* databases/* sessions/* errors/* """ def commit(): app = request.args[0] path = apath(app, r=request) uio = ui.ui() uio.quiet = True if not os.environ.get('HGUSER') and not uio.config("ui", "username"): os.environ['HGUSER'] = 'web2py@localhost' try: r = hg.repository(ui=uio, path=path) except: r = hg.repository(ui=uio, path=path, create=True) hgignore = os.path.join(path, '.hgignore') if not os.path.exists(hgignore): open(hgignore, 'w').write(_hgignore_content) form = FORM('Comment:',INPUT(_name='comment',requires=IS_NOT_EMPTY()), INPUT(_type='submit',_value='Commit')) if form.accepts(request.vars,session): oldid = r[r.lookup('.')] cmdutil.addremove(r) r.commit(text=form.vars.comment) if r[r.lookup('.')] == oldid: response.flash = 'no changes' files = r[r.lookup('.')].files() return dict(form=form,files=TABLE(*[TR(file) for file in files]),repo=r)
henkelis/sonospy
web2py/applications/admin/controllers/mercurial.py
Python
gpl-3.0
1,107
0.00813
#!/usr/bin/python import os import json from pprint import pprint from os import environ as env import glanceclient.exc from collections import Counter import novaclient.v1_1.client as nvclient import glanceclient.v2.client as glclient import keystoneclient.v2_0.client as ksclient def get_nova_credentials(): cred = {} cred['username'] = os.environ['OS_USERNAME'] cred['api_key'] = os.environ['OS_PASSWORD'] cred['auth_url'] = os.environ['OS_AUTH_URL'] cred['project_id'] = os.environ['OS_TENANT_NAME'] return cred def main(): keystone = ksclient.Client(auth_url=env['OS_AUTH_URL'], username=env['OS_USERNAME'], password=env['OS_PASSWORD'], tenant_name=env['OS_TENANT_NAME']) credentials = get_nova_credentials() glance_endpoint = keystone.service_catalog.url_for(service_type='image') nc = nvclient.Client(**credentials) gc = glclient.Client(glance_endpoint, token=keystone.auth_token) L = [] for server in nc.servers.list(detailed=True): imagedata = server.image if imagedata: try: jsondata = json.dumps(imagedata['id']) image_id = jsondata.translate(None, '"') except ValueError: print "Decoding JSON has failed" try: imageinfo = gc.images.get(image_id) except glanceclient.exc.HTTPException: continue try: jsondata = json.dumps(imageinfo['name']) image_name = jsondata.translate(None, '"') except ValueError: print "Decoding JSON has failed" L.append(image_name) count = Counter(L) print "***** %s *****" % os.environ['OS_TENANT_NAME'] for key, value in sorted(count.iteritems()): print "%s,%d" % (key, value) if __name__ == '__main__': main()
kionetworks/openstack-api-scripts
tenant_glance_images.py
Python
apache-2.0
1,996
0.002004
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np # type: ignore import onnx from ..base import Base from . import expect class Atan(Base): @staticmethod def export(): # type: () -> None node = onnx.helper.make_node( 'Atan', inputs=['x'], outputs=['y'], ) x = np.array([-1, 0, 1]).astype(np.float32) y = np.arctan(x) expect(node, inputs=[x], outputs=[y], name='test_atan_example') x = np.random.randn(3, 4, 5).astype(np.float32) y = np.arctan(x) expect(node, inputs=[x], outputs=[y], name='test_atan')
mlperf/training_results_v0.6
Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/onnx-tensorrt/third_party/onnx/onnx/backend/test/case/node/atan.py
Python
apache-2.0
767
0
""" ManyMan - A Many-core Visualization and Management System Copyright (C) 2012 University of Amsterdam - Computer Systems Architecture Jimi van der Woning and Roy Bakker This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ from SocketServer import BaseRequestHandler as brh, TCPServer as tcps from chip import Chip from messageprocessor import MessageProcessor from threading import Thread from time import sleep, time import SocketServer import config import json import logging import sys import subprocess as sp default_settings = { 'address': ['', 11111], 'dummy_mode': False, 'logging_format': '[%(asctime)s %(levelname)-5s] %(name)s: %(message)s', 'logging_datefmt': '%B %d, %H:%M:%S', 'log_filename': 'log', 'logging_to_console': True, 'logging_level': 'DEBUG', 'logging_level_console': 'INFO', 'max_output_msg_len': 100, 'status_frequency': 1, 'frequency_timeout': 5, 'frequency_scale_command': '/shared/jimivdw/jimivdw/tests/power/setpwr', 'chip_name': 'Intel SCC', 'chip_cores': 48, 'chip_orientation': [ [37, 39, 41, 43, 45, 47], [36, 38, 40, 42, 44, 46], [25, 27, 29, 31, 33, 35], [24, 26, 28, 30, 32, 34], [13, 15, 17, 19, 21, 23], [12, 14, 16, 18, 20, 22], [1, 3, 5, 7, 9, 11], [0, 2, 4, 6, 8, 10] ], 'frequency_islands': [ [0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19], [20, 21], [22, 23], [24, 25], [26, 27], [28, 29], [30, 31], [32, 33], [34, 35], [36, 37], [38, 39], [40, 41], [42, 43], [44, 45], [46, 47] ], 'voltage_islands': [ [0, 1, 2, 3, 12, 13, 14, 15], [4, 5, 6, 7, 16, 17, 18, 19], [8, 9, 10, 11, 20, 21, 22, 23], [24, 25, 26, 27, 36, 37, 38, 39], [28, 29, 30, 31, 40, 41, 42, 43], [32, 33, 34, 35, 44, 45, 46, 47] ], 'frequency_dividers': { 800: 2, 533: 3, 400: 4, 320: 5, 267: 6, 229: 7, 200: 8, 178: 9, 160: 10, 145: 11, 133: 12, 123: 13, 114: 14, 107: 15, 100: 16 } } class Client: """Client object for storing front-end connections.""" def __init__(self, request, name): self.request = request self.name = name self.initialized = False class Server(SocketServer.TCPServer): """Server object. Sets up, handles and closes client connections.""" def __init__(self, address, chip, settings): self.logger = logging.getLogger('Server') self.chip = chip self.settings = settings self.connection_count = 0 self.clients = [] self.frequency_scaler = None self.frequency_thread = None self.logger.debug("Initialized on port %d" % address[1]) tcps.__init__(self, address, MessageHandler) self.init_frequency_scaler() return def init_frequency_scaler(self): """Initialize the frequency scaler.""" self.frequency_scaler = FrequencyScaler(self, self.settings) self.frequency_thread = Thread( target=self.frequency_scaler.wait_for_assignment ) self.frequency_thread.deamon = True self.logger.info("Initialized the FrequencyScaler") def serve_forever(self, max_lines): """Keep serving client connections.""" self.frequency_thread.start() self.processor = MessageProcessor(self, max_lines) self.logger.info("Started") try: tcps.serve_forever(self) finally: self.frequency_scaler.running = False self.frequency_thread.join() self.logger.info('Stopped the FrequencyScaler') self.logger.info("Stopped") def finish_request(self, request, client_address): """A client has successfully connected.""" self.logger.info("New connection from %s." % client_address[0]) self.connection_count += 1 client = Client(request, "Client%d" % self.connection_count) self.clients.append(client) self.RequestHandlerClass(request, client_address, self, client) def close_request(self, request): """A client has disconnected.""" for client in self.clients: if client.request == request: self.logger.info("Closed connection to %s." % client.name) self.clients.remove(client) break return tcps.close_request(self, request) class MessageHandler(SocketServer.BaseRequestHandler): """Handler for all received messages. Calls the messageprocessor.""" def __init__(self, request, client_address, server, client): self.logger = logging.getLogger('MessageHandler') self.client = client self.buffer = "" brh.__init__(self, request, client_address, server) return def handle(self): """Handle all received messages.""" while True: try: data = self.request.recv(1024) if not data: break if '\n' in data: # A message is not complete until receiving linebreak parts = data.split('\n') self.server.processor.process( self.client, "%s%s" % (self.buffer, parts[0]) ) # Handle any adjacent fully received messages for part in parts[1:-1]: self.server.processor.process(self.client, part) self.buffer = parts[-1] else: self.buffer += data except: self.logger.error("Exception occurred in MessageHandler") break class StatusSender: """Module that sends the chip status at adjustable intervals.""" def __init__(self, chip, server): self.logger = logging.getLogger('StatusSender') self.chip = chip self.server = server self.running = True def send_forever(self, interval): """Keep sending the status messages on the specified interval.""" while self.running: try: sleep(1. / interval) msg = { 'type': 'status', 'content': { 'chip': self.chip.as_dict() } } for client in self.server.clients: client.request.sendall("%s\n" % json.dumps(msg)) except Exception, e: self.logger.warning( 'Exception occurred in StatusSender: %s' % e ) class FrequencyScaler: def __init__(self, server, settings): self.server = server self.settings = settings self.logger = logging.getLogger('FrequencyScaler') self.running = True self.frequencies = [533] * 6 self.last_change = time() self.changed = False self.changed_island = None def wait_for_assignment(self): while self.running: sleep(1) if self.changed: self.update_frequencies() def update_frequencies(self): self.logger.info("Updating frequencies") if self.changed_island != None: cmd = 'ssh -S ~/.ssh/root@rck00 root@rck00 \'%s -d %s -f %s\'' % ( self.settings['frequency_scale_command'], self.changed_island, self.frequencies[self.changed_island] ) else: cmd = 'ssh -S ~/.ssh/root@rck00 root@rck00 \'%s -c -f %s\'' % ( self.settings['frequency_scale_command'], self.frequencies[0] ) p = sp.Popen( cmd, shell=True, stdout=sp.PIPE, stderr=sp.PIPE ) # Show output, if any out, err = p.communicate() if len(err) > 0: self.logger.warning( "Error when setting frequency: %s" % err ) self.logger.info("out: %s" % out) self.changed = False self.changed_island = None def set_core_frequency(self, f, core=None): value = self.settings['frequency_dividers'][f] if time() - self.last_change < self.settings['frequency_timeout']: self.logger.warning("Too little time between frequency scalings.") return if core != None: for i, island in enumerate(self.settings['voltage_islands']): if core in island: break if self.frequencies[i] == value: return self.frequencies[i] = value self.changed_island = i for c in self.settings['voltage_islands'][i]: self.server.chip.cores[c].frequency = f else: for i in xrange(len(self.settings['voltage_islands'])): self.frequencies[i] = value for c in self.server.chip.cores: c.frequency = f self.changed = True self.last_change = time() def get_core_frequency(self): cmd = 'ssh -S ~/.ssh/root@rck00 root@rck00 \'%s -l\'' % ( self.settings['frequency_scale_command'] ) p = sp.Popen( cmd, shell=True, stdout=sp.PIPE, stderr=sp.PIPE ) # Show output, if any out, err = p.communicate() if len(err) > 0: self.logger.warning( "Error when getting frequency: %s" % err ) self.logger.info("out: %s" % out) out = out.split("\n") for line in out: self.logger.info("Tile %s:", line.split(":")) class App: """Main application object. Sets up the back-end system.""" def __init__(self, **kwargs): self.settings_file = "settings.cfg" if len(sys.argv) > 1 and sys.argv[-1] != '-d': self.settings_file = sys.argv[-1] self.settings = default_settings.copy() self.logger = logging.getLogger('App') self.chip = None self.server = None self.status_sender = None self.status_thread = None self.load_settings() self.settings['dummy_mode'] = kwargs.get('dummy_mode', False) self.config_logger() self.init_chip() self.init_server() self.init_status_sender() self.serve() self.shutdown() def load_settings(self): """Load settings from settings file.""" try: self.settings.update(config.Config(file(self.settings_file))) except Exception, err: print 'Settings could not be loaded: %s' % err exit(1) def config_logger(self): """Setup the logger.""" logging.basicConfig( format=self.settings['logging_format'], datefmt=self.settings['logging_datefmt'], level=getattr(logging, self.settings['logging_level']), filename=self.settings['log_filename'], filemode='w' ) if self.settings['logging_to_console']: # Define console logger console = logging.StreamHandler() console.setLevel( getattr(logging, self.settings['logging_level_console']) ) formatter = logging.Formatter( fmt=self.settings['logging_format'], datefmt=self.settings['logging_datefmt'] ) console.setFormatter(formatter) # Add the handler to the root logger logging.getLogger('').addHandler(console) def init_chip(self): """Initialize chip control.""" self.chip = Chip( self.settings['chip_name'], self.settings['chip_cores'], self.settings['chip_orientation'], self.settings['voltage_islands'], dummy_mode=self.settings['dummy_mode'] ) self.logger.info("Setup chip control") def init_server(self): """Initialize the server.""" self.server = Server( tuple(self.settings['address']), self.chip, self.settings ) self.logger.info("Initialized the server") def init_status_sender(self): """Initialize the status sender.""" self.status_sender = StatusSender(self.chip, self.server) self.status_thread = Thread( target=self.status_sender.send_forever, args=(self.settings['status_frequency'], ) ) self.status_thread.deamon = True self.logger.info("Initialized the StatusSender") def serve(self): """Start the status sender and the server.""" self.status_thread.start() self.logger.info("Started the StatusSender") self.logger.info("Starting the server...") try: self.server.serve_forever(self.settings['max_output_msg_len']) except: self.logger.warning('Exception in serve') def shutdown(self): """Shutdown the system.""" self.status_sender.running = False self.status_thread.join() self.logger.info('Stopped the StatusSender') self.chip.stop() self.chip.join() self.logger.info('Stopped chip control') if __name__ == "__main__": # Run the program. Start in dummy mode with -d arg if '-d' in sys.argv: App(dummy_mode=True) else: App()
FlorisTurkenburg/ManyMan
SCC_backend/server.py
Python
gpl-2.0
14,884
0.000336
""" BIC for LINEAR light curve -------------------------- Figure 10.19 BIC as a function of the number of frequency components for the light curve shown in figure 10.18. BIC for the two prominent frequency peaks is shown. The inset panel details the area near the maximum. For both frequencies, the BIC peaks at between 10 and 15 terms; note that a high value of BIC is achieved already with 6 components. Comparing the two, the longer period model (bottom panel) is much more significant. """ # Author: Jake VanderPlas # License: BSD # The figure produced by this code is published in the textbook # "Statistics, Data Mining, and Machine Learning in Astronomy" (2013) # For more information, see http://astroML.github.com # To report a bug or issue, use the following forum: # https://groups.google.com/forum/#!forum/astroml-general import numpy as np from matplotlib import pyplot as plt from astroML.time_series import multiterm_periodogram, lomb_scargle_BIC from astroML.datasets import fetch_LINEAR_sample #---------------------------------------------------------------------- # This function adjusts matplotlib settings for a uniform feel in the textbook. # Note that with usetex=True, fonts are rendered with LaTeX. This may # result in an error if LaTeX is not installed on your system. In that case, # you can set usetex to False. from astroML.plotting import setup_text_plots setup_text_plots(fontsize=8, usetex=True) #------------------------------------------------------------ # Fetch the data data = fetch_LINEAR_sample() t, y, dy = data[14752041].T omega0 = 17.217 # focus only on the region with the peak omega1 = np.linspace(17.213, 17.220, 100) omega2 = 0.5 * omega1 #------------------------------------------------------------ # Compute the delta BIC terms = np.arange(1, 21) BIC_max = np.zeros((2, len(terms))) for i, omega in enumerate([omega1, omega2]): for j in range(len(terms)): P = multiterm_periodogram(t, y, dy, omega, terms[j]) BIC = lomb_scargle_BIC(P, y, dy, n_harmonics=terms[j]) BIC_max[i, j] = BIC.max() #---------------------------------------------------------------------- # Plot the results fig = plt.figure(figsize=(5, 3.75)) ax = [fig.add_axes((0.15, 0.53, 0.8, 0.37)), fig.add_axes((0.15, 0.1, 0.8, 0.37))] ax_inset = [fig.add_axes((0.15 + 7 * 0.04, 0.55, 0.79 - 7 * 0.04, 0.17)), fig.add_axes((0.15 + 7 * 0.04, 0.12, 0.79 - 7 * 0.04, 0.17))] ylims = [(22750, 22850), (26675, 26775)] omega0 = [17.22, 8.61] for i in range(2): # Plot full panel ax[i].plot(terms, BIC_max[i], '-k') ax[i].set_xlim(0, 20) ax[i].set_ylim(0, 30000) ax[i].text(0.02, 0.95, r"$\omega_0 = %.2f$" % omega0[i], ha='left', va='top', transform=ax[i].transAxes) ax[i].set_ylabel(r'$\Delta BIC$') if i == 1: ax[i].set_xlabel('N frequencies') ax[i].grid(color='gray') # plot inset ax_inset[i].plot(terms, BIC_max[i], '-k') ax_inset[i].xaxis.set_major_locator(plt.MultipleLocator(5)) ax_inset[i].xaxis.set_major_formatter(plt.NullFormatter()) ax_inset[i].yaxis.set_major_locator(plt.MultipleLocator(25)) ax_inset[i].yaxis.set_major_formatter(plt.FormatStrFormatter('%i')) ax_inset[i].set_xlim(7, 19.75) ax_inset[i].set_ylim(ylims[i]) ax_inset[i].set_title('zoomed view') ax_inset[i].grid(color='gray') plt.show()
nhuntwalker/astroML
book_figures/chapter10/fig_LINEAR_BIC.py
Python
bsd-2-clause
3,400
0.001176
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_pcapcffi ---------------------------------- Tests for `pcapcffi` module. """ import pytest import pcapcffi from pcapcffi.wrappers import PcapError def test_findalldevs(): devs = pcapcffi.wrappers.pcap_findalldevs() assert devs def test_pcap(): pcap = pcapcffi.Pcap() assert pcap._pcap_t is None assert not pcap.activated with pytest.raises(PcapError): pcap.snaplen() with pytest.raises(PcapError): pcap.datalinks() pcap.close()
GertBurger/pcapcffi
tests/test_pcapcffi.py
Python
bsd-3-clause
542
0
# Prepare per-patient clinical data # TODO: Possibly incorporate Palumbo data import os from load_patient_data import load_per_patient_data import numpy as np import pandas as pd pd.options.mode.chained_assignment = None # Load input data data, per_patient_dict, per_patient_fields = load_per_patient_data() # Dictionary of categorical mappings cats = {} # Build a cleaned up dataset data # Lots of the cols are redundant # Build a separate dataset of endpoints endp endp = data[['PUBLIC_ID']] # Study ID - CoMMpass vs Palumbo # For now, we'll just take the CoMMpass patients study = data[['PUBLIC_ID']] # Therapy info - this is a simplified version of the stuff in the other table, but is enough to get started with coarse # classes treat = data[['PUBLIC_ID']] # Keep PUBLIC_ID as the main index # Drop informed consent date D_PT_ic_day # Drop reason for dropping study D_PT_disc_com data.drop(['D_PT_ic_day', 'D_PT_disc_com'], axis=1, inplace=True) # Study end to endp endp = endp.join(data['D_PT_lastdy']) data.drop('D_PT_lastdy', axis=1, inplace=True) # Nobody has completed the study, they're either still in it or dropped for some reason (including death?) complete_map = { '': np.nan, 'No': 0 } cats['D_PT_DIDPATIENTCOM'] = complete_map endp = endp.join(data['D_PT_DIDPATIENTCOM'].replace(complete_map)) data.drop('D_PT_DIDPATIENTCOM', axis=1, inplace=True) # Primary reason for patient drop - death vs other drop_reason_map = { '': np.nan, 'Death': 1, 'Other': 0, 'Patient no longer consents to participate in the study': 0, 'Patient is lost to follow-up': 0, 'Inter-current illness that interferes with study assessments': 0, 'Noncompliance with study procedures': 0 } cats['D_PT_PRIMARYREASON'] = drop_reason_map endp = endp.join(data['D_PT_PRIMARYREASON'].replace(drop_reason_map)) data.drop('D_PT_PRIMARYREASON', axis=1, inplace=True) # Cause of death due to MM or other # For some analyses, other is a form of right-censoring death_reason_map = { '': np.nan, 'Disease Progression': 1, 'Other': 0 } cats['D_PT_CAUSEOFDEATH'] = death_reason_map endp = endp.join(data['D_PT_CAUSEOFDEATH'].replace(death_reason_map)) data.drop('D_PT_CAUSEOFDEATH', axis=1, inplace=True) # Date of death endp = endp.join(data['D_PT_deathdy']) data.drop('D_PT_deathdy', axis=1, inplace=True) # Drop some redundant cols that are hard to interpret # A bunch of these are coded versions of more descriptive cols # D_PT_trtstdy is just 1 for everyone data.drop(['D_PT_complete', 'D_PT_discont', 'D_PT_DISCREAS', 'D_PT_dthreas', 'D_PT_raceoth', 'D_PT_race', 'D_PT_ethnic', 'D_PT_gender', 'D_PT_DIDTHEPATIENT', 'D_PT_screen', 'D_PT_trtstdy', 'D_PT_sdeathdy', 'D_PT_enr', 'D_PT_lvisit', 'D_PT_lvisitdy', 'D_PT_lvisitc'], axis=1, inplace=True) # Last day seen alive is important for right-censoring endp = endp.join(data['D_PT_lstalive']) data.drop('D_PT_lstalive', axis=1, inplace=True) # Keep age D_PT_age # Drop Palumbo stuff for now data.drop(['CLINICAL', 'RANDOM', 'gender_char', 'race_char', 'informed_consent_version', 'Date_of_diagnosis', 'ENROLLED'], axis=1, inplace=True) # Keep apparant Palumbo col but actually applies to everyone: demog_height and demog_weight # Standardize height and weight according to units # Use cm for height # Use kg for weight height_map = { 'cm': 1.0, 'in': 2.54 } data['DEMOG_HEIGHTUNITOFM'] = data['DEMOG_HEIGHTUNITOFM'].replace(height_map) data['demog_height'] = data['demog_height'] * data['DEMOG_HEIGHTUNITOFM'] weight_map = { 'kg': 1.0, 'lb': 0.4536 } data['DEMOG_WEIGHTUNITOFM'] = data['DEMOG_WEIGHTUNITOFM'].replace(weight_map) data['demog_weight'] = data['demog_weight'] * data['DEMOG_WEIGHTUNITOFM'] # Drop cols for height and weight data.drop(['DEMOG_HEIGHTUNITOFM', 'DEMOG_WEIGHTUNITOFM'], axis=1, inplace=True) # ISS disease stage "endpoint": D_PT_iss endp = endp.join(data['D_PT_iss']) data.drop('D_PT_iss', axis=1, inplace=True) # CoMMpass vs Palumbo patients study_map = { 'CoMMpass': 1, 'Palumbo': 0 } cats['STUDY_ID'] = study_map study = study.join(data['STUDY_ID'].replace(study_map)) data.drop('STUDY_ID', axis=1, inplace=True) # Drop redundant stage info data.drop(['D_PT_issstage_char', 'D_PT_issstage'], axis=1, inplace=True) # Preprocess basic treatment info # 3 individual treatments: Bortezomib, Carfilzomib, IMIDs # 3 dual treatments: bortezomib/carfilzomib, bortezomib/IMIDs, IMIDs/carfilzomib # 1 triple treatment: bortezomib/IMIDs/carfilzomib # Make indicators of presence of each treatment from D_PT_therclass col # Could use a regex... has_bor = (data['D_PT_therclass'] == 'Bortezomib-based') | \ (data['D_PT_therclass'] == 'combined bortezomib/carfilzomib-based') | \ (data['D_PT_therclass'] == 'combined bortezomib/IMIDs-based') | \ (data['D_PT_therclass'] == 'combined bortezomib/IMIDs/carfilzomib-based') has_car = (data['D_PT_therclass'] == 'Carfilzomib-based') | \ (data['D_PT_therclass'] == 'combined bortezomib/carfilzomib-based') | \ (data['D_PT_therclass'] == 'combined IMIDs/carfilzomib-based') | \ (data['D_PT_therclass'] == 'combined bortezomib/IMIDs/carfilzomib-based') has_imi = (data['D_PT_therclass'] == 'IMIDs-based') | \ (data['D_PT_therclass'] == 'combined bortezomib/IMIDs-based') | \ (data['D_PT_therclass'] == 'combined IMIDs/carfilzomib-based') | \ (data['D_PT_therclass'] == 'combined bortezomib/IMIDs/carfilzomib-based') treat['TREAT_BOR'] = has_bor.astype(int) # True/False -> 1/0 map treat['TREAT_CAR'] = has_car.astype(int) treat['TREAT_IMI'] = has_imi.astype(int) # Drop the rest of the treatment cols data.drop(['D_PT_therclass', 'D_PT_therfstn', 'D_PT_therclassn', 'D_PT_maxline', 'ftrttrpl'], axis=1, inplace=True) # Copy over the SCT (stem cell transplant) codes, but I don't know what they are treat = treat.join(data[['sct_bresp', 'line1sct']]) data.drop(['sct_bresp', 'line1sct'], axis=1, inplace=True) # What is PD? It sounds like a response, so move to endp table endp = endp.join(data[['D_PT_pddy', 'D_PT_pdflag', 'D_PT_ttfpdw', 'D_PT_respdur', 'D_PT_mmstatus', 'D_PT_mmstatus1', 'D_PT_mmstatus2', 'D_PT_mmstatus3', 'D_PT_rapd', 'D_PT_dresp']]) data.drop(['D_PT_pddy', 'D_PT_pdflag', 'D_PT_ttfpdw', 'D_PT_respdur', 'D_PT_mmstatus', 'D_PT_mmstatus1', 'D_PT_mmstatus2', 'D_PT_mmstatus3', 'D_PT_rapd', 'D_PT_dresp'], axis=1, inplace=True) # Drop redundant cols data.drop(['demog_vj_interval', 'demog_visitdy'], axis=1, inplace=True) # Keep race cols, lose other+unknown cols to get a linearly independent categorical set # Keep DEMOG_AMERICANINDIA, DEMOG_BLACKORAFRICA, DEMOG_NATIVEHAWAIIA, DEMOG_WHITE, DEMOG_ASIAN and convert checked checked_map = { '': 0, 'Checked': 1 } data['DEMOG_AMERICANINDIA'] = data['DEMOG_AMERICANINDIA'].replace(checked_map) data['DEMOG_BLACKORAFRICA'] = data['DEMOG_BLACKORAFRICA'].replace(checked_map) data['DEMOG_NATIVEHAWAIIA'] = data['DEMOG_NATIVEHAWAIIA'].replace(checked_map) data['DEMOG_WHITE'] = data['DEMOG_WHITE'].replace(checked_map) data['DEMOG_ASIAN'] = data['DEMOG_ASIAN'].replace(checked_map) data.drop(['DEMOG_OTHER', 'DEMOG_SPECIFY'], axis=1, inplace=True) # Gender - use this col since we know/control the coding gender_map = { 'Male': 1, 'Female': 0, '': np.nan } cats['DEMOG_GENDER'] = gender_map data['DEMOG_GENDER'] = data['DEMOG_GENDER'].replace(gender_map) # Ethnicity: Hispanic/Latino or not eth_map = { 'Hispanic or Latino': 1, 'Not Hispanic or Latino': 0, 'Other': 0, '': 0 } cats['DEMOG_ETHNICITY'] = eth_map data['DEMOG_ETHNICITY'] = data['DEMOG_ETHNICITY'].replace(eth_map) data.drop(['DEMOG_SPECIFY2'], axis=1, inplace=True) # Drop redundant visit and age cols data.drop(['DEMOG_DAYOFVISIT', 'DEMOG_DAYOFBIRTH', 'DEMOG_PATIENTAGE', 'demog_visit', 'enr'], axis=1, inplace=True) # print(data['DEMOG_ETHNICITY'].unique()) # print(data) # print(treat) # Save processed tables output_dir = 'data/processed' data.set_index('PUBLIC_ID', inplace=True) data.to_csv(os.path.join(output_dir, 'patient_data.csv')) endp.set_index('PUBLIC_ID', inplace=True) endp.to_csv(os.path.join(output_dir, 'patient_endp.csv')) treat.set_index('PUBLIC_ID', inplace=True) treat.to_csv(os.path.join(output_dir, 'patient_treat.csv')) study.set_index('PUBLIC_ID', inplace=True) study.to_csv(os.path.join(output_dir, 'patient_study.csv'))
xpspectre/multiple-myeloma
prep_patient_data.py
Python
mit
8,458
0.002365
# coding: utf-8 from django.contrib import admin from hub.models import ExtraUserDetail from .models import AuthorizedApplication # Register your models here. admin.site.register(AuthorizedApplication) admin.site.register(ExtraUserDetail)
onaio/kpi
kpi/admin.py
Python
agpl-3.0
241
0
# coding=utf-8 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os import tempfile import unittest from pants.backend.jvm.subsystems.shader import Shader, Shading from pants.java.distribution.distribution import DistributionLocator from pants.java.executor import SubprocessExecutor from pants.util.contextutil import open_zip from pants.util.dirutil import safe_delete from pants_test.subsystem.subsystem_util import subsystem_instance class ShaderTest(unittest.TestCase): def setUp(self): self.jarjar = '/not/really/jarjar.jar' with subsystem_instance(DistributionLocator): executor = SubprocessExecutor(DistributionLocator.cached()) self.shader = Shader(jarjar=self.jarjar, executor=executor) self.output_jar = '/not/really/shaded.jar' def populate_input_jar(self, *entries): fd, input_jar_path = tempfile.mkstemp() os.close(fd) self.addCleanup(safe_delete, input_jar_path) with open_zip(input_jar_path, 'w') as jar: for entry in entries: jar.writestr(entry, '0xCAFEBABE') return input_jar_path def test_assemble_default_rules(self): input_jar = self.populate_input_jar('org/pantsbuild/tools/fake/Main.class', 'com/google/common/base/Function.class') rules = self.shader.assemble_binary_rules('org.pantsbuild.tools.fake.Main', input_jar) self.assertEqual(Shader.exclude_package('org.pantsbuild.tools.fake'), rules[0]) self.assertIn(Shader.exclude_package('javax.annotation'), rules[1:-1]) self.assertEqual(Shader.shade_package('com.google.common.base'), rules[-1]) def test_assemble_default_rules_default_package(self): input_jar = self.populate_input_jar('main.class', 'com/google/common/base/Function.class') rules = self.shader.assemble_binary_rules('main', input_jar) self.assertEqual(Shader.exclude_package(), rules[0]) self.assertIn(Shader.exclude_package('javax.annotation'), rules[1:-1]) self.assertEqual(Shader.shade_package('com.google.common.base'), rules[-1]) def test_assemble_custom_rules(self): input_jar = self.populate_input_jar('main.class') rules = self.shader.assemble_binary_rules('main', input_jar, custom_rules=[Shader.shade_class('bob'), Shader.exclude_class('fred')]) self.assertEqual(Shader.shade_class('bob'), rules[0]) self.assertEqual(Shader.exclude_class('fred'), rules[1]) self.assertEqual(Shader.exclude_package(), rules[2]) self.assertIn(Shader.exclude_package('javax.annotation'), rules[3:]) def test_runner_command(self): input_jar = self.populate_input_jar('main.class', 'com/google/common/base/Function.class') custom_rules = [Shader.exclude_package('log4j', recursive=True)] with self.shader.binary_shader(self.output_jar, 'main', input_jar, custom_rules=custom_rules) as shader: command = shader.command self.assertTrue(command.pop(0).endswith('java')) jar_or_cp = command.pop(0) self.assertIn(jar_or_cp, {'-cp', 'classpath', '-jar'}) self.assertEqual(self.jarjar, os.path.abspath(command.pop(0))) if jar_or_cp != '-jar': # We don't really care what the name of the jarjar main class is - shader.command[2] command.pop(0) self.assertEqual('process', command.pop(0)) rules_file = command.pop(0) self.assertTrue(os.path.exists(rules_file)) with open(rules_file) as fp: lines = fp.read().splitlines() self.assertEqual('rule log4j.** log4j.@1', lines[0]) # The custom rule. self.assertEqual('rule * @1', lines[1]) # Exclude main's package. self.assertIn('rule javax.annotation.* javax.annotation.@1', lines) # Exclude system. self.assertEqual('rule com.google.common.base.* {}com.google.common.base.@1' .format(Shading.SHADE_PREFIX), lines[-1]) # Shade the rest. self.assertEqual(input_jar, command.pop(0)) self.assertEqual(self.output_jar, command.pop(0)) def test_sanitize_package_name(self): def assert_sanitize(name, sanitized): self.assertEqual(sanitized, Shading.Relocate._sanitize_package_name(name)) assert_sanitize('hello', 'hello') assert_sanitize('hello.goodbye', 'hello.goodbye') assert_sanitize('.hello.goodbye', 'hello.goodbye') assert_sanitize('hello.goodbye.', 'hello.goodbye') assert_sanitize('123', '_123') assert_sanitize('123.456', '_123._456') assert_sanitize('123.v2', '_123.v2') assert_sanitize('hello-goodbye', 'hello_goodbye') assert_sanitize('hello-/.goodbye.?', 'hello__.goodbye._') assert_sanitize('one.two..three....four.', 'one.two.three.four') def test_infer_shaded_pattern(self): def assert_inference(from_pattern, prefix, to_pattern): result = ''.join(Shading.Relocate._infer_shaded_pattern_iter(from_pattern, prefix)) self.assertEqual(to_pattern, result) assert_inference('com.foo.bar.Main', None, 'com.foo.bar.Main') assert_inference('com.foo.bar.', None, 'com.foo.bar.') assert_inference('com.foo.bar.', '__prefix__.', '__prefix__.com.foo.bar.') assert_inference('com.*.bar.', None, 'com.@1.bar.') assert_inference('com.*.bar.*.', None, 'com.@1.bar.@2.') assert_inference('com.*.bar.**', None, 'com.@1.bar.@2') assert_inference('*', None, '@1') assert_inference('**', None, '@1') assert_inference('**', '__prefix__.', '__prefix__.@1') def test_shading_exclude(self): def assert_exclude(from_pattern, to_pattern): self.assertEqual((from_pattern, to_pattern), Shading.Exclude.new(from_pattern).rule()) assert_exclude('com.foo.bar.Main', 'com.foo.bar.Main') assert_exclude('com.foo.bar.**', 'com.foo.bar.@1') assert_exclude('com.*.bar.**', 'com.@1.bar.@2') def test_shading_exclude_package(self): self.assertEqual(('com.foo.bar.**', 'com.foo.bar.@1'), Shading.ExcludePackage.new('com.foo.bar').rule()) self.assertEqual(('com.foo.bar.*', 'com.foo.bar.@1'), Shading.ExcludePackage.new('com.foo.bar', recursive=False).rule()) def test_relocate(self): self.assertEqual(('com.foo.bar.**', '{}com.foo.bar.@1'.format(Shading.SHADE_PREFIX)), Shading.Relocate.new(from_pattern='com.foo.bar.**').rule()) self.assertEqual(('com.foo.bar.**', '{}com.foo.bar.@1'.format('__my_prefix__.')), Shading.Relocate.new(from_pattern='com.foo.bar.**', shade_prefix='__my_prefix__.').rule()) self.assertEqual(('com.foo.bar.**', 'org.biz.baz.@1'.format('__my_prefix__.')), Shading.Relocate.new(from_pattern='com.foo.bar.**', shade_prefix='__my_prefix__.', shade_pattern='org.biz.baz.@1').rule()) def test_relocate_package(self): self.assertEqual(('com.foo.bar.**', '{}com.foo.bar.@1'.format(Shading.SHADE_PREFIX)), Shading.RelocatePackage.new('com.foo.bar').rule()) self.assertEqual(('com.foo.bar.*', '{}com.foo.bar.@1'.format(Shading.SHADE_PREFIX)), Shading.RelocatePackage.new('com.foo.bar', recursive=False).rule()) self.assertEqual(('com.foo.bar.**', '__p__.com.foo.bar.@1'), Shading.RelocatePackage.new('com.foo.bar', shade_prefix='__p__.').rule())
scode/pants
tests/python/pants_test/backend/jvm/subsystems/test_shader.py
Python
apache-2.0
7,708
0.007654
#!/usr/bin/python # # Fabien Chereau fchereau@eso.org # import gzip import os def writePolys(pl, f): """Write a list of polygons pl into the file f. The result is under the form [[[ra1, de1],[ra2, de2],[ra3, de3],[ra4, de4]], [[ra1, de1],[ra2, de2],[ra3, de3]]]""" f.write('[') for idx, poly in enumerate(pl): f.write('[') for iv, v in enumerate(poly): f.write('[%.8f, %.8f]' % (v[0], v[1])) if iv != len(poly) - 1: f.write(', ') f.write(']') if idx != len(pl) - 1: f.write(', ') f.write(']') class StructCredits: def __init__(self): self.short = None self.full = None self.infoUrl = None return def outJSON(self, f, levTab): if self.short != None: f.write(levTab + '\t\t"short": "' + self.short + '",\n') if self.full != None: f.write(levTab + '\t\t"full": "' + self.full + '",\n') if self.infoUrl != None: f.write(levTab + '\t\t"infoUrl": "' + self.infoUrl + '",\n') f.seek(-2, os.SEEK_CUR) f.write('\n') class SkyImageTile: """Contains all the properties needed to describe a multiresolution image tile""" def __init__(self): self.subTiles = [] self.imageCredits = StructCredits() self.serverCredits = StructCredits() self.imageInfo = StructCredits() self.imageUrl = None self.alphaBlend = None self.maxBrightness = None return def outputJSON(self, prefix='', qCompress=False, maxLevelPerFile=10, outDir=''): """Output the tiles tree in the JSON format""" fName = outDir + prefix + "x%.2d_%.2d_%.2d.json" % (2 ** self.level, self.i, self.j) # Actually write the file with maxLevelPerFile level with open(fName, 'w') as f: self.__subOutJSON(prefix, qCompress, maxLevelPerFile, f, 0, outDir) if (qCompress): with open(fName) as ff: fout = gzip.GzipFile(fName + ".gz", 'w') fout.write(ff.read()) fout.close() os.remove(fName) def __subOutJSON(self, prefix, qCompress, maxLevelPerFile, f, curLev, outDir): """Write the tile in the file f""" levTab = "" for i in range(0, curLev): levTab += '\t' f.write(levTab + '{\n') if self.imageInfo.short != None or self.imageInfo.full != None or self.imageInfo.infoUrl != None: f.write(levTab + '\t"imageInfo": {\n') self.imageInfo.outJSON(f, levTab) f.write(levTab + '\t},\n') if self.imageCredits.short != None or self.imageCredits.full != None or self.imageCredits.infoUrl != None: f.write(levTab + '\t"imageCredits": {\n') self.imageCredits.outJSON(f, levTab) f.write(levTab + '\t},\n') if self.serverCredits.short != None or self.serverCredits.full != None or self.serverCredits.infoUrl != None: f.write(levTab + '\t"serverCredits": {\n') self.serverCredits.outJSON(f, levTab) f.write(levTab + '\t},\n') if self.imageUrl: f.write(levTab + '\t"imageUrl": "' + self.imageUrl + '",\n') f.write(levTab + '\t"worldCoords": ') writePolys(self.skyConvexPolygons, f) f.write(',\n') f.write(levTab + '\t"textureCoords": ') writePolys(self.textureCoords, f) f.write(',\n') if self.maxBrightness: f.write(levTab + '\t"maxBrightness": %f,\n' % self.maxBrightness) if self.alphaBlend: f.write(levTab + '\t"alphaBlend": true,\n') f.write(levTab + '\t"minResolution": %f' % self.minResolution) if not self.subTiles: f.write('\n' + levTab + '}') return f.write(',\n') f.write(levTab + '\t"subTiles": [\n') if curLev + 1 < maxLevelPerFile: # Write the tiles in the same file for st in self.subTiles: assert isinstance(st, SkyImageTile) st.__subOutJSON(prefix, qCompress, maxLevelPerFile, f, curLev + 1, outDir) f.write(',\n') else: # Write the tiles in a new file for st in self.subTiles: st.outputJSON(prefix, qCompress, maxLevelPerFile, outDir) f.write(levTab + '\t\t{"$ref": "' + prefix + "x%.2d_%.2d_%.2d.json" % (2 ** st.level, st.i, st.j)) if qCompress: f.write(".gz") f.write('"},\n') f.seek(-2, os.SEEK_CUR) f.write('\n' + levTab + '\t]\n') f.write(levTab + '}')
Stellarium/stellarium
util/skyTile.py
Python
gpl-2.0
4,700
0.004681
#!/usr/bin/python # pl2dir - Generates a directory structure based on your Traktor playlists. # Copyright (C) 2015 Erik Stambaugh # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program (see the file LICENSE); if not, see # http://www.gnu.org/licenses/, or write to the # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301 USA from bs4 import BeautifulSoup import os,re,sys def help(): print "Usage: %s COLLECTION PATH1 [PATH2 ...]\n" % sys.argv[0] print " COLLECTION is a Traktor collection_*.nml file" print " PATH1, PATH2, etc. are lists of directories to recurse" print " when searching for audio files" try: collection_filename = sys.argv[1] collection_fh = open(collection_filename) except (IndexError, IOError), e: print "ERROR: invalid collection (%s)\n" % e help() sys.exit(1) source_paths = sys.argv[2:] if len(source_paths) < 1: print "ERROR: No source paths specified\n" help() sys.exit(1) soup = BeautifulSoup(collection_fh, "xml") print '# Getting a full list of source files...' allfiles=[] pathdict={} for srcpath in source_paths: for path,dirs,files in os.walk(srcpath): for f in files: fullpath="%s/%s" % (path,f) allfiles.append(fullpath) d = pathdict.get(f,[]) d.append(fullpath) pathdict[f] = d ### collection class Track: def __str__(self): if self.artist: return "%s - %s" % (self.artist.encode('utf8'),self.title.encode('utf8')) return "%s" % (self.title.encode('utf8')) def __unicode__(self): return self.__str__() def __init__(self,soup): self.soup = soup self.artist = soup.attrs.get('ARTIST','') self.title = soup.attrs.get('TITLE','') loc = soup.find('LOCATION') self.drive = loc.attrs.get('VOLUME','') self.dir = loc.attrs.get('DIR','') self.filename = loc.attrs.get('FILE','') self.pk = "%s%s%s" % (self.drive,self.dir,self.filename) self.located = None def find(self,pathdict): if self.located is None: if pathdict.has_key(self.filename): self.located = pathdict[self.filename][0] else: print "# NOT FOUND: %s" % self.filename ### playlists class Playlist: def __str__(self): return self.name.encode('utf8') def __unicode__(self): return self.__str__() def __init__(self,soup,collection={}): self.soup = soup self.name = soup.attrs['NAME'] self.tracklist = [] self.tracks = [] for t in self.soup.find_all('PRIMARYKEY', attrs={'TYPE': 'TRACK'}): self.tracklist.append(t["KEY"].encode('utf8')) if collection.has_key(t["KEY"]): track = collection[t['KEY']] self.tracks.append(track) else: print "# ***NOT FOUND IN COLLECTION: %s" % t["KEY"] def find_files(self, pathdict): for t in self.tracks: t.find(pathdict=pathdict) collection={} c = soup.find('COLLECTION') for e in c.find_all('ENTRY'): track = Track(e) collection[track.pk] = track playlists = [] pl = soup.find_all('NODE', attrs={"TYPE": "PLAYLIST"}) for l in pl: playlist = Playlist(l, collection=collection) playlists.append(playlist) print "# Searching playlists..." for l in playlists: if len(l.tracks) > 0: l.find_files(pathdict) found = reduce(lambda x,y: x+y, map(lambda z: 0 if z.located is None else 1, l.tracks)) print "# %s - %s found %s not found" % (l, found, len(l.tracks) - found) for l in playlists: if len(l.tracks) > 0: found = reduce(lambda x,y: x+y, map(lambda z: 0 if z.located is None else 1, l.tracks)) if found > 0: dirname = re.sub(r'[^0-9a-zA-Z-_]','-',str(l)) print "mkdir %s" % dirname for track in l.tracks: if track.located is not None: extension = re.sub('.*\.','',track.located) target = re.sub('[^0-9a-zA-Z-_]','_',str(track)) target = re.sub('_+$','',target) target = "%s.%s" % (target,extension) print 'cp -lvf "%s" "%s/%s"' % (re.sub(r'(["$])',r'\\\1',track.located), dirname, target) else: print "# NO TRACKS FOUND: %s" % l
poorsquinky/traktor-tools
pl2dir.py
Python
gpl-3.0
4,990
0.012024
# File: TscTelnetLib.py ; This file is part of Twister. # version: 2.002 # # Copyright (C) 2012 , Luxoft # # Authors: # Adrian Toader <adtoader@luxoft.com> # # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # """ This module contains Telnet connection functions. """ from telnetlib import Telnet from time import sleep #from time import time as epochtime from thread import start_new_thread #from os import remove, rename #from os.path import dirname, exists, abspath, join, getsize #Efrom json import load, dump #__dir__ = dirname(abspath(__file__)) __all__ = ['TelnetManager', 'TelnetConnection'] # class TelnetManager(object): """ Twister Telnet connections manager """ def __init__(self): """ init """ # connections are TelnetConnection instances self.connections = {} # active connection name; is used for all commands as default # if no name is specified self.activeConnection = None def open_connection(self, name, host, port=23, user=None, password=None, userExpect=None, passwordExpect=None, keepalive=True): """ open a new TelnetConnection instance and add it to manager list """ if not self.connections.has_key(name): connection = TelnetConnection(name, host, port, user, password, userExpect, passwordExpect, keepalive) self.connections.update([(name, connection), ]) return True else: print('telnet open connection error: connection name already in use') return False def login(self, name, user=None, password=None, userExpect=None, passwordExpect=None): """ login on telnet connection """ try: return self.connections[name].login(user, password, userExpect, passwordExpect) except Exception, e: print('telnet manager login error: {er}'.format(er=e)) return False def write(self, command, name=None): """ write command to telnet connection """ if ((not name and not self.activeConnection) or (name and not self.connections.has_key(name))): print 'connection not found' return False if name: return self.connections[name].write(command) elif self.activeConnection: return self.connections[self.activeConnection].write(command) return False def read(self, name=None): """ read from telnet connection """ if ((not name and not self.activeConnection) or (name and not self.connections.has_key(name))): print 'connection not found' return False if name: return self.connections[name].read() elif self.activeConnection: return self.connections[self.activeConnection].read() return False def read_until(self, expected, name=None): """ read from telnet connection until expected """ if ((not name and not self.activeConnection) or (name and not self.connections.has_key(name))): print 'connection not found' return False if name: return self.connections[name].read_until(expected) elif self.activeConnection: return self.connections[self.activeConnection].read_until(expected) return False def set_newline(self, newline, name=None): """ set the new line char for telnet connection """ if ((not name and not self.activeConnection) or (name and not self.connections.has_key(name))): print 'connection not found' return False if name: return self.connections[name].set_newline(newline) elif self.activeConnection: return self.connections[self.activeConnection].set_newline(newline) return False def set_timeout(self, timeout, name=None): """ set timeout for operations on telnet connection """ if ((not name and not self.activeConnection) or (name and not self.connections.has_key(name))): print 'connection not found' return False if name: return self.connections[name].set_timeout(timeout) elif self.activeConnection: return self.connections[self.activeConnection].set_timeout(timeout) return False def get_connection(self, name=None): """ get the TelnetConnection instance """ if ((not name and not self.activeConnection) or (name and not self.connections.has_key(name))): print 'connection not found' return False if name: return self.connections[name] elif self.activeConnection: return self.connections[self.activeConnection] return False def set_active_connection(self, name): """ set the active connection """ if not self.connections.has_key(name): print 'connection not found' return False self.activeConnection = name return True def list_connections(self): """ list all connections """ return [name for name in self.connections.iterkeys()] def close_connection(self, name=None): """ close connection """ if ((not name and not self.activeConnection) or (name and not self.connections.has_key(name))): print 'connection not found' return False if not name and self.activeConnection: del(self.connections[self.activeConnection]) self.activeConnection = None return True try: del(self.connections[name]) if name == self.activeConnection: self.activeConnection = None except Exception, e: print('telnet manager error while closing connection: {er}'.format(er=e)) return False return True def close_all_connections(self): """ close all connections """ del(self.connections) self.connections = {} self.activeConnection = None print('all connections closed') return True class TelnetConnection: """ tsc telnet connection """ def __init__(self, name, host, port=23, user=None, password=None, userExpect=None, passwordExpect=None, keepalive=True): """ init """ self.connection = None self.host = host self.port = port self.loginAccount = { 'user': user, 'password': password } self.name = name self.newline = '\n' self.timeout = 4 self.keepAliveRetries = 0 self.keepAliveThread = None self.keepAlive = keepalive self.loginDriver = { 'userExpect': userExpect, 'passwordExpect': passwordExpect } """ self.loginDrivers = None self.loginDriversPath = join(__dir__, 'logindrivers.list') self.loginDriversLockPath = join(__dir__, 'logindrivers.lock') self.loadLoginDrivers() """ try: self.connection = Telnet(self.host, self.port, self.timeout) print('telnet connection created!') self.login() if self.keepAlive: self.keepAliveThread = start_new_thread(self.keep_alive, ()) else: self.keepAliveThread = None except Exception, e: self.connection = None self.keepAliveThread = None print('telnet connection failed: {er}'.format(er=e)) def __del__(self): """ delete """ if self.connection: self.connection.close() sleep(2) del(self) def keep_alive(self): """ keep connection alive """ timeout = (0.2, self.timeout)[self.timeout>2] while not self.connection.eof: self.connection.write('') sleep(timeout) def alive(self): """ check if connection is alive """ if self.connection and not self.connection.eof: return True try: self.connection = Telnet(self.host, self.port) print('telnet connection created!') self.login() if self.keepAlive: self.keepAliveThread = start_new_thread(self.keep_alive, ()) else: self.keepAliveThread = None except Exception, e: self.connection = None self.keepAliveThread = None self.keepAliveRetries += 1 if self.keepAliveRetries > 4: print('telnet connection restore retry failed!') return False print('telnet connection restore failed: {er}'\ 'retry: {n}!'.format(er=e, n=self.keepAliveRetries)) self.alive() return True def set_newline(self, newline): """ set the new line char for telnet connection """ if isinstance(newline, str): self.newline = newline return True return False def set_timeout(self, timeout): """ set timeout for operations on telnet connection """ if isinstance(timeout, int): self.timeout = [2, timeout][timeout > 2] return True return False def read(self): """ read from telnet connection """ if not self.alive(): return False try: response = self.connection.read_very_eager() if response: return response except Exception, e: print('read command error: {er}'.format(er=e)) return False return False def read_until(self, expected): """ read from telnet connection until expected """ if not self.alive(): return False try: response = self.connection.read_until(expected, self.timeout) if response: print(response) return True except Exception, e: print('read until command error: {er}'.format(er=e)) return False return False def write(self, command, result=True, display=True): """ write command to telnet connection """ if not self.alive(): return False try: self.connection.write( str(command) + self.newline ) sleep(2) if display: print('command: {c}'.format(c=command)) if result: return self.connection.read_very_eager() else: return True except Exception, e: print('send command error: {er}'.format(er=e)) return False def expect(self, expected, command=None, result=True, display=True): """ write command to telnet connection on expected prompt """ if not self.alive(): return False try: response = self.connection.read_until(expected, self.timeout) print(response) if response: if command: self.connection.write( str(command) + self.newline) sleep(2) if display: print('command: {c}'.format(c=command)) if result: return self.connection.read_very_eager() else: return True return False except Exception, e: print('expect send command error: {er}'.format(er=e)) return False def login(self, user=None, password=None, userExpect=None, passwordExpect=None): """ login on telnet connection """ if not self.alive(): return False self.loginAccount['user'] = (user, self.loginAccount['user'])[user is None] self.loginAccount['password'] = (password, self.loginAccount['password'])[password is None] self.loginDriver['userExpect'] = (userExpect, self.loginDriver['userExpect'])[userExpect is None] self.loginDriver['passwordExpect'] = (passwordExpect, self.loginDriver['passwordExpect'])[passwordExpect is None] print('login ..') if None in [self.loginAccount['user'], self.loginAccount['password']]: print('no login data!') return False if None in [self.loginDriver['userExpect'], self.loginDriver['passwordExpect']]: print('no login expected data!') return False #return self.autologin() response = self.expect(self.loginDriver['userExpect'], self.loginAccount['user'], False) if response: response = self.expect(self.loginDriver['passwordExpect'], self.loginAccount['password'], True, False) if response: print(response) """ if ((self.loginDriver['userExpect'] not in self.loginDrivers['userExpect'] or self.loginDriver['passwordExpect'] not in self.loginDrivers['passwordExpect']) and not None in self.loginDriver.itervalues()): self.saveLoginDrivers(self.loginDriver['userExpect'], self.loginDriver['passwordExpect']) """ return True print('fail') return False """ def autologin(self): # autologin on telnet connection print('tring autologin ..') response = self.connection.expect(self.loginDrivers['userExpect'], self.timeout) if not None in response: print(response) self.write(self.loginAccount['user'], False) response = self.connection.expect( self.loginDrivers['passwordExpect'], self.timeout) if not None in response: print(response) print self.write(self.loginAccount['password'], True, False) return True print('fail') return False def loadLoginDrivers(self): # load the known login drivers retries = 0 while exists(self.loginDriversLockPath) and retries <= self.timeout * 2: retries += 1 sleep(0.4) with open(self.loginDriversLockPath, 'wb+') as loginDriversLockFile: loginDriversLockFile.write('lock\n') if not exists(self.loginDriversPath): with open(self.loginDriversPath, 'wb+') as loginDriversFile: self.loginDrivers = {} self.loginDrivers['userExpect'] = [] self.loginDrivers['passwordExpect'] = [] dump(self.loginDrivers, loginDriversFile) if getsize(self.loginDriversPath) > 524288L: rename(self.loginDriversPath, self.loginDriversPath + '.bck' + str(epochtime())) with open(self.loginDriversPath, 'rb') as loginDriversFile: self.loginDrivers = load(loginDriversFile) remove(self.loginDriversLockPath) def saveLoginDrivers(self, userExpect, passwordExpect): # save new login driver retries = 0 while exists(self.loginDriversLockPath) and retries <= self.timeout * 2: retries += 1 sleep(0.4) with open(self.loginDriversLockPath, 'wb+') as loginDriversLockFile: loginDriversLockFile.write('lock\n') with open(self.loginDriversPath, 'rb') as loginDriversFile: self.loginDrivers = load(loginDriversFile) self.loginDrivers['userExpect'].append(userExpect) self.loginDrivers['passwordExpect'].append(passwordExpect) with open(self.loginDriversPath, 'wb+') as loginDriversFile: dump(self.loginDrivers, loginDriversFile) remove(self.loginDriversLockPath) """
twister/twister.github.io
lib/TscTelnetLib.py
Python
apache-2.0
17,030
0.003288
import adaptive_binning_chisquared_2sam import os systematics_fraction = 0.01 dim_list = [1,2,3,4,5,6,7,8,9,10] adaptive_binning=True CPV = True PLOT = True if CPV: orig_name="chi2_gauss_0_95__0_95_CPV_not_redefined_syst_"+str(systematics_fraction).replace(".","_")+"_" orig_title="Gauss 0.95 0.95 syst{} adaptbin".format(systematics_fraction) #orig_name="chi2_gauss_0_95__0_95_CPV_not_redefined_syst_"+str(systematics_fraction).replace(".","_")+"_euclidean_plot_" #orig_title="Gauss 1.0 0.95 syst{} euclidean adaptbin".format(systematics_fraction) else: orig_name="chi2_gauss__1_0__1_0_noCPV_not_redefined_syst_"+str(systematics_fraction).replace(".","_")+"_" orig_title="Gauss 1.0 1.0 syst{} adaptbin".format(systematics_fraction) #orig_name="chi2_gauss__1_0__1_0_noCPV_not_redefined_syst_"+str(systematics_fraction).replace(".","_")+"_euclidean_" #orig_title="Gauss 1.0 1.0 syst{} euclidean adaptbin".format(systematics_fraction) if PLOT: dim_list = [2,6,10] orig_name="plot_"+orig_name orig_title= "Plot "+orig_title sample_list_typical= [79, 74, 22] sample_list= [[item,item+1] for item in sample_list_typical] else: sample_list = [range(100)]*len(dim_list) comp_file_list_list = [] for dim_data_index, dim_data in enumerate(dim_list): comp_file_list=[] for i in sample_list[dim_data_index]: if CPV: comp_file_list.append((os.environ['learningml']+"/GoF/data/gaussian_same_projection_on_each_axis/gauss_data/gaussian_same_projection_on_each_axis_{1}D_10000_0.0_1.0_1.0_{0}.txt".format(i,dim_data),os.environ['learningml']+"/GoF/data/gaussian_same_projection_on_each_axis/gauss_data/gaussian_same_projection_on_each_axis_{1}D_10000_0.0_0.95_0.95_{0}.txt".format(i,dim_data))) #comp_file_list.append((os.environ['learningml']+"/GoF/data/gaussian_same_projection_on_each_axis/gauss_data/gaussian_same_projection_on_each_axis_{1}D_10000_0.0_1.0_1.0_{0}_euclidean.txt".format(i,dim_data),os.environ['learningml']+"/GoF/data/gaussian_same_projection_on_each_axis/gauss_data/gaussian_same_projection_on_each_axis_{1}D_10000_0.0_0.95_0.95_{0}_euclidean.txt".format(i,dim_data))) else: comp_file_list.append((os.environ['learningml']+"/GoF/data/gaussian_same_projection_on_each_axis/gauss_data/gaussian_same_projection_on_each_axis_{1}D_10000_0.0_1.0_1.0_{0}.txt".format(i,dim_data),os.environ['learningml']+"/GoF/data/gaussian_same_projection_on_each_axis/gauss_data/gaussian_same_projection_on_each_axis_{1}D_10000_0.0_1.0_1.0_1{0}.txt".format(str(i).zfill(2),dim_data))) #comp_file_list.append((os.environ['learningml']+"/GoF/data/gaussian_same_projection_on_each_axis/gauss_data/gaussian_same_projection_on_each_axis_{1}D_10000_0.0_1.0_1.0_{0}_euclidean.txt".format(i,dim_data),os.environ['learningml']+"/GoF/data/gaussian_same_projection_on_each_axis/gauss_data/gaussian_same_projection_on_each_axis_{1}D_10000_0.0_1.0_1.0_1{0}_euclidean.txt".format(str(i).zfill(2),dim_data))) comp_file_list_list.append(comp_file_list) if adaptive_binning==True: if PLOT: number_of_splits_list = [3] else: number_of_splits_list = [1,2,3,4,5,6,7,8,9,10] adaptive_binning_chisquared_2sam.chi2_adaptive_binning_wrapper(orig_title, orig_name, dim_list, comp_file_list_list,number_of_splits_list,systematics_fraction) else: single_no_bins_list=[2,3,5] adaptive_binning_chisquared_2sam.chi2_regular_binning_wrapper(orig_title, orig_name, dim_list, comp_file_list_list,single_no_bins_list,systematics_fraction)
weissercn/learningml
learningml/GoF/chi2/gauss/miranda_adaptive_binning_systematics_Gaussian_same_projection_evaluation_of_optimised_classifiers.py
Python
mit
3,491
0.030077
""" Illustrates various methods of associating multiple types of parents with a particular child object. The examples all use the declarative extension along with declarative mixins. Each one presents the identical use case at the end - two classes, ``Customer`` and ``Supplier``, both subclassing the ``HasAddresses`` mixin, which ensures that the parent class is provided with an ``addresses`` collection which contains ``Address`` objects. The :viewsource:`.discriminator_on_association` and :viewsource:`.generic_fk` scripts are modernized versions of recipes presented in the 2007 blog post `Polymorphic Associations with SQLAlchemy <http://techspot.zzzeek.org/2007/05/29/polymorphic-associations-with-sqlalchemy/>`_. .. autosource:: """
wfxiang08/sqlalchemy
examples/generic_associations/__init__.py
Python
mit
748
0.005348
#!/usr/bin/env python3 # # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Test for error handling helpers.""" import unittest from unittest.mock import ANY, Mock import grpc from testbench import error class TestError(unittest.TestCase): def test_csek(self): with self.assertRaises(error.RestException) as rest: error.csek(None) self.assertEqual(rest.exception.code, 400) context = Mock() error.csek(context) context.abort.assert_called_once_with(grpc.StatusCode.INVALID_ARGUMENT, ANY) def test_invalid(self): with self.assertRaises(error.RestException) as rest: error.invalid("bad bucket name", None) self.assertEqual(rest.exception.code, 400) context = Mock() error.invalid("bad bucket name", context) context.abort.assert_called_once_with(grpc.StatusCode.INVALID_ARGUMENT, ANY) def test_missing(self): with self.assertRaises(error.RestException) as rest: error.missing("object name", None) self.assertEqual(rest.exception.code, 400) context = Mock() error.missing("object name", context) context.abort.assert_called_once_with(grpc.StatusCode.INVALID_ARGUMENT, ANY) def test_mismatch(self): with self.assertRaises(error.RestException) as rest: error.mismatch("ifGenerationMatch", "0", "123", None) self.assertEqual(rest.exception.code, 412) context = Mock() error.mismatch("ifGenerationMatch", "0", "123", context) context.abort.assert_called_once_with(grpc.StatusCode.FAILED_PRECONDITION, ANY) def test_notchanged(self): with self.assertRaises(error.RestException) as rest: error.notchanged("ifGenerationNotMatch:7", None) self.assertEqual(rest.exception.code, 304) context = Mock() error.notchanged("ifGenerationNotMatch:7", context) context.abort.assert_called_once_with(grpc.StatusCode.ABORTED, ANY) def test_notfound(self): with self.assertRaises(error.RestException) as rest: error.notfound("test-object", None) self.assertEqual(rest.exception.code, 404) context = Mock() error.notfound("test-object", context) context.abort.assert_called_once_with(grpc.StatusCode.NOT_FOUND, ANY) def test_not_allowed(self): with self.assertRaises(error.RestException) as rest: error.notallowed(None) self.assertEqual(rest.exception.code, 405) if __name__ == "__main__": unittest.main()
googleapis/storage-testbench
tests/test_error.py
Python
apache-2.0
3,099
0.001291
""" Script used to convert data into sparse matrix format that can easily be imported into MATLAB. Use like this python convertToSparseMatrix.py ../../../../../data/train_triplets.txt 1000 ../../../../../data/eval/year1_test_triplets_visible.txt ../../../../../data/eval/year1_test_triplets_hidden.txt 100 """ import sys import time # Analysing command line arguments if len(sys.argv) < 5: print 'Usage:' print ' python %s <triplets training file> <number of triplets> <triplets visible history file> <triplets hidden history file> <number of triplets>' % sys.argv[0] exit() inputTrainingFile = sys.argv[1] numTriplets = int(sys.argv[2]) inputTestFile = sys.argv[3] inputHiddenTestFile = sys.argv[4] numTripletsTest = int(sys.argv[5]) start = time.time() userIdToIndex = {} # Key: userid, Value: Row in matrix songIdToIndex = {} # Key: songid, Value: Column in matrix userIndex = 0 songIndex = 0 rows = [] columns = [] entries = [] linesRead = 0 maxLines = numTriplets for inputFile in [inputTrainingFile, inputTestFile, inputHiddenTestFile]: linesRead = 0 f = open(inputFile) for line in f: userid, song, songCount = line.strip().split('\t') # Fill in indices if song not in songIdToIndex: songIdToIndex[song] = songIndex songIndex += 1 if userid not in userIdToIndex: userIdToIndex[userid] = userIndex userIndex += 1 # Fill in rows, columns and entries rows.append(userIdToIndex[userid]) columns.append(songIdToIndex[song]) entries.append(int(songCount)) linesRead += 1 if linesRead >= maxLines: break if inputFile == inputTrainingFile: numUsersInTraining = userIndex maxLines = numTripletsTest if inputFile == inputTestFile: numSongs = songIndex numUsers = userIndex numNonZeros = len(entries) rows = rows columns = columns entries = entries # Write to a sparse matrix file that can be read with MATLAB matrix_file = open('UserSongSparseMatrix' + str(numTriplets) + '_' + str(numTripletsTest) + '.txt', 'w') for i in range(len(entries)): matrix_file.write(str(rows[i]+1) + "\t" + str(columns[i]+1) + "\t" + str(entries[i]) + "\n") #matrix_file.write(str(numUsers-1) + "\t" + str(numSongs-1) + "\t" + str(0.000000) + "\n") matrix_file.close() # reset everything to zero to read in the hidden matrix rows = [] columns = [] entries = [] if inputFile == inputHiddenTestFile: # Write to a sparse matrix file that can be read with MATLAB matrix_file_test = open('UserSongSparseMatrixTest' + str(numTriplets) + '_' + str(numTripletsTest) + '.txt', 'w') for i in range(len(entries)): matrix_file_test.write(str(rows[i]+1) + "\t" + str(columns[i]+1) + "\t" + str(entries[i]) + "\n") #matrix_file_test.write(str(userIndex-1) + "\t" + str(songIndex-1) + "\t" + str(0.000000) + "\n") matrix_file_test.close() f.close() print "Done loading %d triplets!" % (numTriplets + numTripletsTest) end = time.time() print "Took %s seconds" % (end - start) print "Number of users", numUsers print "Number of songs", numSongs print "You need to predict for the last %s users" % (numUsers - numUsersInTraining)
EmilienDupont/cs229project
convertToSparseMatrix.py
Python
mit
3,343
0.007777
########################################################################### # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ########################################################################### # # This code generated (see starthinker/scripts for possible source): # - Command: "python starthinker_ui/manage.py airflow" # ########################################################################### ''' -------------------------------------------------------------- Before running this Airflow module... Install StarThinker in cloud composer ( recommended ): From Release: pip install starthinker From Open Source: pip install git+https://github.com/google/starthinker Or push local code to the cloud composer plugins directory ( if pushing local code changes ): source install/deploy.sh 4) Composer Menu l) Install All -------------------------------------------------------------- If any recipe task has "auth" set to "user" add user credentials: 1. Ensure an RECIPE['setup']['auth']['user'] = [User Credentials JSON] OR 1. Visit Airflow UI > Admin > Connections. 2. Add an Entry called "starthinker_user", fill in the following fields. Last step paste JSON from authentication. - Conn Type: Google Cloud Platform - Project: Get from https://github.com/google/starthinker/blob/master/tutorials/cloud_project.md - Keyfile JSON: Get from: https://github.com/google/starthinker/blob/master/tutorials/deploy_commandline.md#optional-setup-user-credentials -------------------------------------------------------------- If any recipe task has "auth" set to "service" add service credentials: 1. Ensure an RECIPE['setup']['auth']['service'] = [Service Credentials JSON] OR 1. Visit Airflow UI > Admin > Connections. 2. Add an Entry called "starthinker_service", fill in the following fields. Last step paste JSON from authentication. - Conn Type: Google Cloud Platform - Project: Get from https://github.com/google/starthinker/blob/master/tutorials/cloud_project.md - Keyfile JSON: Get from: https://github.com/google/starthinker/blob/master/tutorials/cloud_service.md -------------------------------------------------------------- DV360 / CM360 Privacy Audit Dashboard that shows performance metrics across browser to see the impact of privacy changes. - Follow the instructions from 1-this document. 1-this document: https://docs.google.com/document/d/1HaRCMaBBEo0tSKwnofWNtaPjlW0ORcVHVwIRabct4fY/ -------------------------------------------------------------- This StarThinker DAG can be extended with any additional tasks from the following sources: - https://google.github.io/starthinker/ - https://github.com/google/starthinker/tree/master/dags ''' from starthinker.airflow.factory import DAG_Factory INPUTS = { 'recipe_timezone':'America/Los_Angeles', # Timezone for report dates. 'auth_sheets':'user', # Credentials used for Sheets. 'auth_bq':'service', # Credentials used for BigQuery. 'auth_dv':'user', # Credentials used for DV360. 'auth_cm':'user', # Credentials used for CM. 'cm_account_id':'', # Campaign Manager Account Id. 'floodlight_configuration_ids':[], # Comma delimited list of floodlight configuration ids for the Campaign Manager floodlight report. 'date_range':'LAST_365_DAYS', # Timeframe to run the ITP report for. 'cm_advertiser_ids':[], # Optional: Comma delimited list of CM advertiser ids. 'dv360_partner_id':'', # DV360 Partner id 'dv360_advertiser_ids':[], # Optional: Comma delimited list of DV360 Advertiser ids. 'recipe_name':'', # Name of report in DBM, should be unique. 'recipe_slug':'ITP_Audit_Dashboard', # BigQuery dataset for store dashboard tables. } RECIPE = { 'setup':{ 'hour':[ 3 ], 'day':[ 'Mon' ] }, 'tasks':[ { 'drive':{ 'auth':{'field':{'name':'auth_sheets','kind':'authentication','order':1,'default':'user','description':'Credentials used for Sheets.'}}, 'hour':[ ], 'copy':{ 'source':'https://docs.google.com/spreadsheets/d/1rH_PGXOYW2mVdmAYnKbv6kcaB6lQihAyMsGtFfinnqg/', 'destination':{'field':{'name':'recipe_name','prefix':'Privacy Audit ','kind':'string','order':1,'description':'Name of document to deploy to.','default':''}} } } }, { 'dataset':{ 'auth':{'field':{'name':'auth_bq','kind':'authentication','order':1,'default':'service','description':'Credentials used for BigQuery.'}}, 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':1,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}} } }, { 'dbm':{ 'auth':{'field':{'name':'auth_dv','kind':'authentication','order':1,'default':'user','description':'Credentials used for DV360.'}}, 'report':{ 'name':{'field':{'name':'recipe_name','kind':'string','prefix':'ITP_Audit_Browser_','default':'ITP_Audit_Browser_','order':1,'description':'Name of report in DV360, should be unique.'}}, 'timeout':90, 'filters':{ 'FILTER_ADVERTISER':{ 'values':{'field':{'name':'dv360_advertiser_ids','kind':'integer_list','order':6,'default':[],'description':'Optional: Comma delimited list of DV360 Advertiser ids.'}} }, 'FILTER_PARTNER':{ 'values':{'field':{'name':'dv360_partner_id','kind':'integer','order':5,'default':'','description':'DV360 Partner id'}} } }, 'body':{ 'timezoneCode':{'field':{'name':'recipe_timezone','kind':'timezone','description':'Timezone for report dates.','default':'America/Los_Angeles'}}, 'metadata':{ 'title':{'field':{'name':'recipe_name','default':'ITP_Audit_Browser_','kind':'string','prefix':'ITP_Audit_Browser_','order':1,'description':'Name of report in DV360, should be unique.'}}, 'dataRange':{'field':{'name':'date_range','kind':'choice','order':3,'default':'LAST_365_DAYS','choices':['LAST_7_DAYS','LAST_14_DAYS','LAST_30_DAYS','LAST_365_DAYS','LAST_60_DAYS','LAST_7_DAYS','LAST_90_DAYS','MONTH_TO_DATE','PREVIOUS_MONTH','PREVIOUS_QUARTER','PREVIOUS_WEEK','PREVIOUS_YEAR','QUARTER_TO_DATE','WEEK_TO_DATE','YEAR_TO_DATE'],'description':'Timeframe to run the ITP report for.'}}, 'format':'CSV' }, 'params':{ 'type':'TYPE_GENERAL', 'groupBys':[ 'FILTER_ADVERTISER', 'FILTER_ADVERTISER_NAME', 'FILTER_ADVERTISER_CURRENCY', 'FILTER_MEDIA_PLAN', 'FILTER_MEDIA_PLAN_NAME', 'FILTER_CAMPAIGN_DAILY_FREQUENCY', 'FILTER_INSERTION_ORDER', 'FILTER_INSERTION_ORDER_NAME', 'FILTER_LINE_ITEM', 'FILTER_LINE_ITEM_NAME', 'FILTER_PAGE_LAYOUT', 'FILTER_WEEK', 'FILTER_MONTH', 'FILTER_YEAR', 'FILTER_PARTNER', 'FILTER_PARTNER_NAME', 'FILTER_LINE_ITEM_TYPE', 'FILTER_DEVICE_TYPE', 'FILTER_BROWSER', 'FILTER_ANONYMOUS_INVENTORY_MODELING', 'FILTER_OS' ], 'metrics':[ 'METRIC_MEDIA_COST_ADVERTISER', 'METRIC_IMPRESSIONS', 'METRIC_CLICKS', 'METRIC_TOTAL_CONVERSIONS', 'METRIC_LAST_CLICKS', 'METRIC_LAST_IMPRESSIONS', 'METRIC_CM_POST_CLICK_REVENUE', 'METRIC_CM_POST_VIEW_REVENUE', 'METRIC_REVENUE_ADVERTISER' ] } } }, 'delete':False, 'out':{ 'bigquery':{ 'auth':{'field':{'name':'auth_bq','kind':'authentication','order':1,'default':'service','description':'Credentials used for BigQuery.'}}, 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':1,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}}, 'table':'z_Dv360_Browser_Report_Dirty', 'header':True, 'schema':[ { 'name':'Advertiser_Id', 'type':'INTEGER', 'mode':'NULLABLE' }, { 'name':'Advertiser', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Advertiser_Currency', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Campaign_Id', 'type':'INTEGER', 'mode':'NULLABLE' }, { 'name':'Campaign', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Insertion_Order_Daily_Frequency', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Insertion_Order_Id', 'type':'INTEGER', 'mode':'NULLABLE' }, { 'name':'Insertion_Order', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Line_Item_Id', 'type':'INTEGER', 'mode':'NULLABLE' }, { 'name':'Line_Item', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Environment', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Week', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Month', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Year', 'type':'INTEGER', 'mode':'NULLABLE' }, { 'name':'Partner_Id', 'type':'INTEGER', 'mode':'NULLABLE' }, { 'name':'Partner', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Line_Item_Type', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Device_Type', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Browser', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Anonymous_Inventory_Modeling', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Operating_System', 'type':'STRING', 'mode':'NULLABLE' }, { 'name':'Media_Cost_Advertiser_Currency', 'type':'FLOAT', 'mode':'NULLABLE' }, { 'name':'Impressions', 'type':'INTEGER', 'mode':'NULLABLE' }, { 'name':'Clicks', 'type':'INTEGER', 'mode':'NULLABLE' }, { 'name':'Total_Conversions', 'type':'FLOAT', 'mode':'NULLABLE' }, { 'name':'Post_Click_Conversions', 'type':'FLOAT', 'mode':'NULLABLE' }, { 'name':'Post_View_Conversions', 'type':'FLOAT', 'mode':'NULLABLE' }, { 'name':'Cm_Post_Click_Revenue', 'type':'FLOAT', 'mode':'NULLABLE' }, { 'name':'Cm_Post_View_Revenue', 'type':'FLOAT', 'mode':'NULLABLE' }, { 'name':'Revenue_Adv_Currency', 'type':'FLOAT', 'mode':'NULLABLE' } ] } } } }, { 'dcm':{ 'auth':{'field':{'name':'auth_cm','kind':'authentication','order':1,'default':'user','description':'Credentials used for CM.'}}, 'timeout':90, 'report':{ 'timeout':90, 'account':{'field':{'name':'cm_account_id','kind':'string','order':2,'default':'','description':'Campaign Manager Account Id.'}}, 'filters':{ 'advertiser':{ 'values':{'field':{'name':'cm_advertiser_ids','kind':'integer_list','order':3,'default':[],'description':'Optional: Comma delimited list of CM advertiser ids.'}} } }, 'body':{ 'kind':'dfareporting#report', 'name':{'field':{'name':'recipe_name','kind':'string','order':1,'prefix':'ITP_Audit_Browser_','default':'ITP_Audit_Dashboard_Browser','description':'Name of the Campaign Manager browser report.'}}, 'format':'CSV', 'type':'STANDARD', 'criteria':{ 'dateRange':{ 'kind':'dfareporting#dateRange', 'relativeDateRange':{'field':{'name':'date_range','kind':'choice','order':3,'default':'LAST_365_DAYS','choices':['LAST_7_DAYS','LAST_14_DAYS','LAST_30_DAYS','LAST_365_DAYS','LAST_60_DAYS','LAST_7_DAYS','LAST_90_DAYS','MONTH_TO_DATE','PREVIOUS_MONTH','PREVIOUS_QUARTER','PREVIOUS_WEEK','PREVIOUS_YEAR','QUARTER_TO_DATE','WEEK_TO_DATE','YEAR_TO_DATE'],'description':'Timeframe to run the ITP report for.'}} }, 'dimensions':[ { 'kind':'dfareporting#sortedDimension', 'name':'campaign' }, { 'kind':'dfareporting#sortedDimension', 'name':'campaignId' }, { 'kind':'dfareporting#sortedDimension', 'name':'site' }, { 'kind':'dfareporting#sortedDimension', 'name':'advertiser' }, { 'kind':'dfareporting#sortedDimension', 'name':'advertiserId' }, { 'kind':'dfareporting#sortedDimension', 'name':'browserPlatform' }, { 'kind':'dfareporting#sortedDimension', 'name':'platformType' }, { 'kind':'dfareporting#sortedDimension', 'name':'month' }, { 'kind':'dfareporting#sortedDimension', 'name':'week' } ], 'metricNames':[ 'impressions', 'clicks', 'totalConversions', 'activityViewThroughConversions', 'activityClickThroughConversions' ], 'dimensionFilters':[ ] }, 'schedule':{ 'active':True, 'repeats':'WEEKLY', 'every':1, 'repeatsOnWeekDays':[ 'Sunday' ] }, 'delivery':{ 'emailOwner':False } } }, 'out':{ 'bigquery':{ 'auth':{'field':{'name':'auth_bq','kind':'authentication','order':1,'default':'service','description':'Credentials used for BigQuery.'}}, 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':1,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}}, 'table':'z_CM_Browser_Report_Dirty', 'header':True, 'is_incremental_load':False } }, 'delete':False } }, { 'sdf':{ 'auth':{'field':{'name':'auth_dv','kind':'authentication','order':1,'default':'user','description':'Credentials used for DV360.'}}, 'version':'SDF_VERSION_5_3', 'partner_id':{'field':{'name':'dv360_partner_id','kind':'integer','order':5,'default':'','description':'DV360 Partner id'}}, 'file_types':[ 'FILE_TYPE_CAMPAIGN', 'FILE_TYPE_LINE_ITEM', 'FILE_TYPE_INSERTION_ORDER' ], 'filter_type':'FILTER_TYPE_ADVERTISER_ID', 'read':{ 'filter_ids':{ 'single_cell':True, 'bigquery':{ 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':7,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}}, 'query':'select distinct Advertiser_Id from `{dataset}.z_Dv360_Browser_Report_Dirty`', 'parameters':{ 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':7,'description':'BigQuery dataset for store dashboard tables.'}} }, 'legacy':False } } }, 'time_partitioned_table':False, 'create_single_day_table':False, 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':7,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}} } }, { 'bigquery':{ 'auth':{'field':{'name':'auth_bq','kind':'authentication','order':1,'default':'service','description':'Credentials used for BigQuery.'}}, 'from':{ 'values':[ [ 'App', 'App' ], [ 'Web optimized for device', 'Web' ], [ 'Web not optimized for device', 'Web' ] ] }, 'to':{ 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':7,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}}, 'table':'z_Environment' }, 'schema':[ { 'name':'Environment', 'type':'STRING' }, { 'name':'Environment_clean', 'type':'STRING' } ] } }, { 'bigquery':{ 'auth':{'field':{'name':'auth_bq','kind':'authentication','order':1,'default':'service','description':'Credentials used for BigQuery.'}}, 'from':{ 'values':[ [ 'Other', 'TrueView', '' ], [ 'Opera', 'Other', '' ], [ 'Google Chrome', 'Chrome/Android', '' ], [ 'Android Webkit', 'Chrome/Android', '' ], [ 'Safari', 'Safari/iOS', '' ], [ 'Safari 10', 'Safari/iOS', '' ], [ 'Safari 11', 'Safari/iOS', '' ], [ 'Safari 6', 'Safari/iOS', '' ], [ 'Safari 8', 'Safari/iOS', '' ], [ 'Safari 9', 'Safari/iOS', '' ], [ 'Safari 12', 'Safari/iOS', 'Includes Safari mobile web and webkit, both re v12' ], [ 'Safari 13', 'Safari/iOS', '' ], [ 'Safari 12+13', 'Safari/iOS', '' ], [ 'Safari 14', 'Safari/iOS', '' ], [ 'Safari 7', 'Safari/iOS', '' ], [ 'Safari 5', 'Safari/iOS', '' ], [ 'Safari 4', 'Safari/iOS', '' ], [ 'Safari 3', 'Safari/iOS', '' ], [ 'Firefox', 'Firefox', '' ], [ 'Microsoft Edge', 'IE/Edge', '' ], [ 'Internet Explorer 11', 'IE/Edge', '' ], [ 'Internet Explorer 10', 'IE/Edge', '' ], [ 'Internet Explorer 9', 'IE/Edge', '', '' ], [ 'Internet Explorer 8', 'IE/Edge', '' ] ] }, 'to':{ 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':7,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}}, 'table':'z_Browser' }, 'schema':[ { 'name':'Browser_Platform', 'type':'STRING' }, { 'name':'Browser_Platform_clean', 'type':'STRING' }, { 'name':'Browser_Platform_detail', 'type':'STRING' } ] } }, { 'bigquery':{ 'auth':{'field':{'name':'auth_bq','kind':'authentication','order':1,'default':'service','description':'Credentials used for BigQuery.'}}, 'from':{ 'values':[ [ 'Other', 'Other', 0 ], [ 'Android Webkit', 'Android', 1 ], [ 'Firefox', 'Firefox', 2 ], [ 'Chrome', 'Chrome/Android', 3 ], [ 'Internet Explorer 9', 'IE/Edge', 4 ], [ 'Safari', 'Safari/iOS', 6 ], [ 'Safari 5', 'Safari/iOS', 7 ], [ 'Internet Explorer 10', 'IE/Edge', 9 ], [ 'Safari 6', 'Safari/iOS', 10 ], [ 'Opera', 'Opera', 1038 ], [ 'Internet Explorer 11', 'IE/Edge', 12 ], [ 'Internet Explorer 8', 'IE/Edge', 13 ], [ 'Internet Explorer 7', 'IE/Edge', 14 ], [ 'Internet Explorer 6', 'IE/Edge', 15 ], [ 'Internet Explorer 5', 'IE/Edge', 16 ], [ 'Safari 4', 'Safari/iOS', 17 ], [ 'Safari 3', 'Safari/iOS', 18 ], [ 'Safari 2', 'Safari/iOS', 19 ], [ 'Safari 1', 'Safari/iOS', 20 ], [ 'Microsoft Edge', 'IE/Edge', 21 ], [ 'Safari 7', 'Safari/iOS', 22 ], [ 'Safari 8', 'Safari/iOS', 23 ], [ 'Safari 9', 'Safari/iOS', 24 ], [ 'Safari 10', 'Safari/iOS', 25 ], [ 'Safari 11', 'Safari/iOS', 26 ], [ 'Safari 12', 'Safari/iOS', 27 ], [ 'Safari 13', 'Safari/iOS', 28 ], [ 'Safari 14', 'Safari/iOS', 29 ] ] }, 'to':{ 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':7,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}}, 'table':'z_Browser_SDF_lookup' }, 'schema':[ { 'name':'Browser_Platform', 'type':'STRING' }, { 'name':'Browser_Platform_clean', 'type':'STRING' }, { 'name':'Browser_Platform_id', 'type':'INTEGER' } ] } }, { 'sheets':{ 'auth':{'field':{'name':'auth_sheets','kind':'authentication','order':1,'default':'user','description':'Credentials used for Sheets.'}}, 'sheet':{'field':{'name':'recipe_name','prefix':'Privacy Audit ','kind':'string','order':1,'description':'Name of document to deploy to.','default':''}}, 'tab':'SdfScoring', 'range':'A2:M', 'header':False, 'out':{ 'auth':{'field':{'name':'auth_bq','kind':'authentication','order':1,'default':'service','description':'Credentials used for BigQuery.'}}, 'bigquery':{ 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':7,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}}, 'table':'z_dv360_scoring_matrix', 'schema':[ { 'name':'Whole_Attribution_Score', 'type':'INTEGER' }, { 'name':'Safari_Attribution_Score', 'type':'INTEGER' }, { 'name':'Safari_Reach_Score', 'type':'INTEGER' }, { 'name':'Audience_Targeting_Include', 'type':'BOOL' }, { 'name':'Google_Audience_Include', 'type':'BOOL' }, { 'name':'Contextual_Targeting_Include', 'type':'BOOL' }, { 'name':'Conversion_Bid_Optimization', 'type':'BOOL' }, { 'name':'Browser_Targeting_Include', 'type':'BOOL' }, { 'name':'Safari_Browser_Targeting_Include', 'type':'BOOL' }, { 'name':'Chrome_Browser_Targeting_Include', 'type':'BOOL' }, { 'name':'FF_Browser_Targeting_Include', 'type':'BOOL' }, { 'name':'View_Through_Enabled', 'type':'BOOL' }, { 'name':'Comment', 'type':'STRING' } ] } } } }, { 'bigquery':{ 'auth':{'field':{'name':'auth_bq','kind':'authentication','order':1,'default':'service','description':'Credentials used for BigQuery.'}}, 'from':{ 'values':[ [ 'Firefox', 'Firefox', 'Firefox' ], [ 'Mozilla', 'Firefox', 'Firefox' ], [ 'Microsoft Edge', 'IE/Edge', 'IE/Edge' ], [ 'Microsoft Internet Explorer', 'IE/Edge', 'IE/Edge' ], [ 'Netscape Navigator', 'Other', 'Other' ], [ 'Opera', 'Other', 'Other' ], [ 'Opera Next', 'Other', 'Other' ], [ 'Roku', 'Other', 'Other' ], [ 'Yandex', 'Other', 'Other' ], [ 'Android', 'Chrome/Android', 'Android' ], [ 'Chrome', 'Chrome/Android', 'Chrome' ], [ 'iPad', 'Safari/iOS', 'iDevice' ], [ 'iPhone / iPod touch', 'Safari/iOS', 'iDevice' ], [ 'Safari', 'Safari/iOS', 'Safari' ], [ 'Unknown', 'Unknown', 'Unknown' ] ] }, 'to':{ 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':7,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}}, 'table':'z_CM_Browser_lookup' }, 'schema':[ { 'name':'Browser_Platform', 'type':'STRING' }, { 'name':'Browser_Platform_clean', 'type':'STRING' }, { 'name':'Browser_Platform_detail', 'type':'STRING' } ] } }, { 'bigquery':{ 'auth':{'field':{'name':'auth_bq','kind':'authentication','order':1,'default':'service','description':'Credentials used for BigQuery.'}}, 'from':{ 'values':[ [ 'Desktop', 'Desktop' ], [ 'Smart Phone', 'Mobile' ], [ 'Tablet', 'Mobile' ], [ 'Connected TV', 'Connected TV' ] ] }, 'to':{ 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':7,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}}, 'table':'z_Device_Type' }, 'schema':[ { 'name':'Device_Type', 'type':'STRING' }, { 'name':'Device', 'type':'STRING' } ] } }, { 'bigquery':{ 'auth':{'field':{'name':'auth_bq','kind':'authentication','order':1,'default':'service','description':'Credentials used for BigQuery.'}}, 'from':{ 'values':[ [ 'View-through', 'Attributed' ], [ 'Attributed', 'Attributed' ], [ 'Unattributed', 'Unattributed' ], [ 'Click-through', 'Unattributed' ] ] }, 'to':{ 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':7,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}}, 'table':'z_Floodlight_Attribution' }, 'schema':[ { 'name':'Floodlight_Attribution_Type', 'type':'STRING' }, { 'name':'Attribution_Type', 'type':'STRING' } ] } }, { 'itp_audit':{ 'auth_dv':{'field':{'name':'auth_dv','kind':'authentication','order':1,'default':'user','description':'Credentials used for DV360.'}}, 'auth_cm':{'field':{'name':'auth_cm','kind':'authentication','order':1,'default':'user','description':'Credentials used for CM.'}}, 'auth_sheets':{'field':{'name':'auth_sheets','kind':'authentication','order':1,'default':'user','description':'Credentials used for Sheets.'}}, 'auth_bq':{'field':{'name':'auth_bq','kind':'authentication','order':1,'default':'service','description':'Credentials used for BigQuery.'}}, 'account':{'field':{'name':'cm_account_id','kind':'string','order':2,'default':'','description':'Campaign Manager Account Id.'}}, 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':7,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}}, 'sheet':{'field':{'name':'recipe_name','prefix':'Privacy Audit ','kind':'string','order':7,'description':'Name of document to deploy to.','default':''}}, 'timeout':60, 'read':{ 'advertiser_ids':{ 'single_cell':True, 'bigquery':{ 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':7,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}}, 'query':'select distinct Advertiser_Id from `{dataset}.z_CM_Browser_Report_Dirty`', 'parameters':{ 'dataset':{'field':{'name':'recipe_slug','kind':'string','order':7,'default':'ITP_Audit_Dashboard','description':'BigQuery dataset for store dashboard tables.'}} }, 'legacy':False } } }, 'floodlightConfigIds':{'field':{'name':'floodlight_configuration_ids','kind':'integer_list','order':2,'default':[],'description':'Comma delimited list of floodlight configuration ids for the Campaign Manager floodlight report.'}}, 'reportPrefix':{'field':{'name':'recipe_name','kind':'string','prefix':'ITP_Audit_Floodlight_','order':7,'description':'Name of report in DBM, should be unique.'}} } } ] } dag_maker = DAG_Factory('itp_audit', RECIPE, INPUTS) dag = dag_maker.generate() if __name__ == "__main__": dag_maker.print_commandline()
google/starthinker
dags/itp_audit_dag.py
Python
apache-2.0
35,487
0.026968
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Tangible() result.template = "object/tangible/ship/components/reactor/shared_rct_sds_imperial_1.iff" result.attribute_template_id = 8 result.stfName("space/space_item","rct_sds_imperial_1_n") #### BEGIN MODIFICATIONS #### #### END MODIFICATIONS #### return result
anhstudios/swganh
data/scripts/templates/object/tangible/ship/components/reactor/shared_rct_sds_imperial_1.py
Python
mit
482
0.045643
from __future__ import unicode_literals import numpy as np import param from ..core import (HoloMap, DynamicMap, CompositeOverlay, Layout, GridSpace, NdLayout, Store) from ..core.util import (match_spec, is_number, wrap_tuple, basestring, get_overlay_spec, unique_iterator, safe_unicode) def displayable(obj): """ Predicate that returns whether the object is displayable or not (i.e whether the object obeys the nesting hierarchy """ if isinstance(obj, HoloMap): return not (obj.type in [Layout, GridSpace, NdLayout]) if isinstance(obj, (GridSpace, Layout, NdLayout)): for el in obj.values(): if not displayable(el): return False return True return True class Warning(param.Parameterized): pass display_warning = Warning(name='Warning') def collate(obj): if isinstance(obj, HoloMap): display_warning.warning("Nesting %ss within a HoloMap makes it difficult " "to access your data or control how it appears; " "we recommend calling .collate() on the HoloMap " "in order to follow the recommended nesting " "structure shown in the Composing Data tutorial" "(http://git.io/vtIQh)" % obj.type.__name__) return obj.collate() elif isinstance(obj, (Layout, NdLayout)): try: display_warning.warning( "Layout contains HoloMaps which are not nested in the " "recommended format for accessing your data; calling " ".collate() on these objects will resolve any violations " "of the recommended nesting presented in the Composing Data " "tutorial (http://git.io/vqs03)") expanded = [] for el in obj.values(): if isinstance(el, HoloMap) and not displayable(el): collated_layout = Layout.from_values(el.collate()) expanded.extend(collated_layout.values()) return Layout(expanded) except: raise Exception(undisplayable_info(obj)) else: raise Exception(undisplayable_info(obj)) def undisplayable_info(obj, html=False): "Generate helpful message regarding an undisplayable object" collate = '<tt>collate</tt>' if html else 'collate' info = "For more information, please consult the Composing Data tutorial (http://git.io/vtIQh)" if isinstance(obj, HoloMap): error = "HoloMap of %s objects cannot be displayed." % obj.type.__name__ remedy = "Please call the %s method to generate a displayable object" % collate elif isinstance(obj, Layout): error = "Layout containing HoloMaps of Layout or GridSpace objects cannot be displayed." remedy = "Please call the %s method on the appropriate elements." % collate elif isinstance(obj, GridSpace): error = "GridSpace containing HoloMaps of Layouts cannot be displayed." remedy = "Please call the %s method on the appropriate elements." % collate if not html: return '\n'.join([error, remedy, info]) else: return "<center>{msg}</center>".format(msg=('<br>'.join( ['<b>%s</b>' % error, remedy, '<i>%s</i>' % info]))) def compute_sizes(sizes, size_fn, scaling_factor, scaling_method, base_size): """ Scales point sizes according to a scaling factor, base size and size_fn, which will be applied before scaling. """ if scaling_method == 'area': pass elif scaling_method == 'width': scaling_factor = scaling_factor**2 else: raise ValueError( 'Invalid value for argument "scaling_method": "{}". ' 'Valid values are: "width", "area".'.format(scaling_method)) sizes = size_fn(sizes) return (base_size*scaling_factor*sizes) def get_sideplot_ranges(plot, element, main, ranges): """ Utility to find the range for an adjoined plot given the plot, the element, the Element the plot is adjoined to and the dictionary of ranges. """ key = plot.current_key dims = element.dimensions(label=True) dim = dims[1] if dims[1] != 'Frequency' else dims[0] range_item = main if isinstance(main, HoloMap): if issubclass(main.type, CompositeOverlay): range_item = [hm for hm in main.split_overlays()[1] if dim in hm.dimensions('all', label=True)][0] else: range_item = HoloMap({0: main}, kdims=['Frame']) ranges = match_spec(range_item.last, ranges) if dim in ranges: main_range = ranges[dim] else: framewise = plot.lookup_options(range_item.last, 'norm').options.get('framewise') if framewise and range_item.get(key, False): main_range = range_item[key].range(dim) else: main_range = range_item.range(dim) # If .main is an NdOverlay or a HoloMap of Overlays get the correct style if isinstance(range_item, HoloMap): range_item = range_item.last if isinstance(range_item, CompositeOverlay): range_item = [ov for ov in range_item if dim in ov.dimensions('all', label=True)][0] return range_item, main_range, dim def within_range(range1, range2): """Checks whether range1 is within the range specified by range2.""" return ((range1[0] is None or range2[0] is None or range1[0] >= range2[0]) and (range1[1] is None or range2[1] is None or range1[1] <= range2[1])) def validate_sampled_mode(holomaps, dynmaps): composite = HoloMap(enumerate(holomaps), kdims=['testing_kdim']) holomap_kdims = set(unique_iterator([kd.name for dm in holomaps for kd in dm.kdims])) hmranges = {d: composite.range(d) for d in holomap_kdims} if any(not set(d.name for d in dm.kdims) <= holomap_kdims for dm in dynmaps): raise Exception('In sampled mode DynamicMap key dimensions must be a ' 'subset of dimensions of the HoloMap(s) defining the sampling.') elif not all(within_range(hmrange, dm.range(d)) for dm in dynmaps for d, hmrange in hmranges.items() if d in dm.kdims): raise Exception('HoloMap(s) have keys outside the ranges specified on ' 'the DynamicMap(s).') def get_dynamic_mode(composite): "Returns the common mode of the dynamic maps in given composite object" dynmaps = composite.traverse(lambda x: x, [DynamicMap]) holomaps = composite.traverse(lambda x: x, ['HoloMap']) dynamic_modes = [m.call_mode for m in dynmaps] dynamic_sampled = any(m.sampled for m in dynmaps) if holomaps: validate_sampled_mode(holomaps, dynmaps) elif dynamic_sampled and not holomaps: raise Exception("DynamicMaps in sampled mode must be displayed alongside " "a HoloMap to define the sampling.") if len(set(dynamic_modes)) > 1: raise Exception("Cannot display composites of DynamicMap objects " "with different interval modes (i.e open or bounded mode).") elif dynamic_modes and not holomaps: return 'bounded' if dynamic_modes[0] == 'key' else 'open', dynamic_sampled else: return None, dynamic_sampled def initialize_sampled(obj, dimensions, key): """ Initializes any DynamicMaps in sampled mode. """ select = dict(zip([d.name for d in dimensions], key)) try: obj.select([DynamicMap], **select) except KeyError: pass def save_frames(obj, filename, fmt=None, backend=None, options=None): """ Utility to export object to files frame by frame, numbered individually. Will use default backend and figure format by default. """ backend = Store.current_backend if backend is None else backend renderer = Store.renderers[backend] fmt = renderer.params('fig').objects[0] if fmt is None else fmt plot = renderer.get_plot(obj) for i in range(len(plot)): plot.update(i) renderer.save(plot, '%s_%s' % (filename, i), fmt=fmt, options=options) def dynamic_update(plot, subplot, key, overlay, items): """ Given a plot, subplot and dynamically generated (Nd)Overlay find the closest matching Element for that plot. """ match_spec = get_overlay_spec(overlay, wrap_tuple(key), subplot.current_frame) specs = [(i, get_overlay_spec(overlay, wrap_tuple(k), el)) for i, (k, el) in enumerate(items)] return closest_match(match_spec, specs) def closest_match(match, specs, depth=0): """ Recursively iterates over type, group, label and overlay key, finding the closest matching spec. """ new_specs = [] match_lengths = [] for i, spec in specs: if spec[0] == match[0]: new_specs.append((i, spec[1:])) else: if is_number(match[0]) and is_number(spec[0]): match_length = -abs(match[0]-spec[0]) elif all(isinstance(s[0], basestring) for s in [spec, match]): match_length = max(i for i in range(len(match[0])) if match[0].startswith(spec[0][:i])) else: match_length = 0 match_lengths.append((i, match_length, spec[0])) if len(new_specs) == 1: return new_specs[0][0] elif new_specs: depth = depth+1 return closest_match(match[1:], new_specs, depth) else: if depth == 0 or not match_lengths: return None else: return sorted(match_lengths, key=lambda x: -x[1])[0][0] def map_colors(arr, crange, cmap, hex=True): """ Maps an array of values to RGB hex strings, given a color range and colormap. """ if crange: cmin, cmax = crange else: cmin, cmax = np.nanmin(arr), np.nanmax(arr) arr = (arr - cmin) / (cmax-cmin) arr = np.ma.array(arr, mask=np.logical_not(np.isfinite(arr))) arr = cmap(arr) if hex: arr *= 255 return ["#{0:02x}{1:02x}{2:02x}".format(*(int(v) for v in c[:-1])) for c in arr] else: return arr def dim_axis_label(dimensions, separator=', '): """ Returns an axis label for one or more dimensions. """ if not isinstance(dimensions, list): dimensions = [dimensions] return separator.join([safe_unicode(d.pprint_label) for d in dimensions])
vascotenner/holoviews
holoviews/plotting/util.py
Python
bsd-3-clause
10,673
0.002342
#!/usr/bin/python2.4 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. '''Handling of the <message> element. ''' import re import types from grit.node import base import grit.format.rc_header import grit.format.rc from grit import clique from grit import exception from grit import tclib from grit import util # Finds whitespace at the start and end of a string which can be multiline. _WHITESPACE = re.compile('(?P<start>\s*)(?P<body>.+?)(?P<end>\s*)\Z', re.DOTALL | re.MULTILINE) class MessageNode(base.ContentNode): '''A <message> element.''' # For splitting a list of things that can be separated by commas or # whitespace _SPLIT_RE = re.compile('\s*,\s*|\s+') def __init__(self): super(type(self), self).__init__() # Valid after EndParsing, this is the MessageClique that contains the # source message and any translations of it that have been loaded. self.clique = None # We don't send leading and trailing whitespace into the translation # console, but rather tack it onto the source message and any # translations when formatting them into RC files or what have you. self.ws_at_start = '' # Any whitespace characters at the start of the text self.ws_at_end = '' # --"-- at the end of the text # A list of "shortcut groups" this message is in. We check to make sure # that shortcut keys (e.g. &J) within each shortcut group are unique. self.shortcut_groups_ = [] def _IsValidChild(self, child): return isinstance(child, (PhNode)) def _IsValidAttribute(self, name, value): if name not in ['name', 'offset', 'translateable', 'desc', 'meaning', 'internal_comment', 'shortcut_groups', 'custom_type', 'validation_expr', 'use_name_for_id']: return False if name == 'translateable' and value not in ['true', 'false']: return False return True def MandatoryAttributes(self): return ['name|offset'] def DefaultAttributes(self): return { 'translateable' : 'true', 'desc' : '', 'meaning' : '', 'internal_comment' : '', 'shortcut_groups' : '', 'custom_type' : '', 'validation_expr' : '', 'use_name_for_id' : 'false', } def GetTextualIds(self): ''' Returns the concatenation of the parent's node first_id and this node's offset if it has one, otherwise just call the superclass' implementation ''' if 'offset' in self.attrs: # we search for the first grouping node in the parents' list # to take care of the case where the first parent is an <if> node grouping_parent = self.parent import grit.node.empty while grouping_parent and not isinstance(grouping_parent, grit.node.empty.GroupingNode): grouping_parent = grouping_parent.parent assert 'first_id' in grouping_parent.attrs return [grouping_parent.attrs['first_id'] + '_' + self.attrs['offset']] else: return super(type(self), self).GetTextualIds() def IsTranslateable(self): return self.attrs['translateable'] == 'true' def ItemFormatter(self, t): if t == 'rc_header': return grit.format.rc_header.Item() elif (t in ['rc_all', 'rc_translateable', 'rc_nontranslateable'] and self.SatisfiesOutputCondition()): return grit.format.rc.Message() else: return super(type(self), self).ItemFormatter(t) def EndParsing(self): super(type(self), self).EndParsing() # Make the text (including placeholder references) and list of placeholders, # then strip and store leading and trailing whitespace and create the # tclib.Message() and a clique to contain it. text = '' placeholders = [] for item in self.mixed_content: if isinstance(item, types.StringTypes): text += item else: presentation = item.attrs['name'].upper() text += presentation ex = ' ' if len(item.children): ex = item.children[0].GetCdata() original = item.GetCdata() placeholders.append(tclib.Placeholder(presentation, original, ex)) m = _WHITESPACE.match(text) if m: self.ws_at_start = m.group('start') self.ws_at_end = m.group('end') text = m.group('body') self.shortcut_groups_ = self._SPLIT_RE.split(self.attrs['shortcut_groups']) self.shortcut_groups_ = [i for i in self.shortcut_groups_ if i != ''] description_or_id = self.attrs['desc'] if description_or_id == '' and 'name' in self.attrs: description_or_id = 'ID: %s' % self.attrs['name'] assigned_id = None if self.attrs['use_name_for_id'] == 'true': assigned_id = self.attrs['name'] message = tclib.Message(text=text, placeholders=placeholders, description=description_or_id, meaning=self.attrs['meaning'], assigned_id=assigned_id) self.clique = self.UberClique().MakeClique(message, self.IsTranslateable()) for group in self.shortcut_groups_: self.clique.AddToShortcutGroup(group) if self.attrs['custom_type'] != '': self.clique.SetCustomType(util.NewClassInstance(self.attrs['custom_type'], clique.CustomType)) elif self.attrs['validation_expr'] != '': self.clique.SetCustomType( clique.OneOffCustomType(self.attrs['validation_expr'])) def GetCliques(self): if self.clique: return [self.clique] else: return [] def Translate(self, lang): '''Returns a translated version of this message. ''' assert self.clique msg = self.clique.MessageForLanguage(lang, self.PseudoIsAllowed(), self.ShouldFallbackToEnglish() ).GetRealContent() return msg.replace('[GRITLANGCODE]', lang) def NameOrOffset(self): if 'name' in self.attrs: return self.attrs['name'] else: return self.attrs['offset'] def GetDataPackPair(self, output_dir, lang): '''Returns a (id, string) pair that represents the string id and the string in utf8. This is used to generate the data pack data file. ''' from grit.format import rc_header id_map = rc_header.Item.tids_ id = id_map[self.GetTextualIds()[0]] message = self.ws_at_start + self.Translate(lang) + self.ws_at_end # |message| is a python unicode string, so convert to a utf16 byte stream # because that's the format of datapacks. We skip the first 2 bytes # because it is the BOM. return id, message.encode('utf16')[2:] # static method def Construct(parent, message, name, desc='', meaning='', translateable=True): '''Constructs a new message node that is a child of 'parent', with the name, desc, meaning and translateable attributes set using the same-named parameters and the text of the message and any placeholders taken from 'message', which must be a tclib.Message() object.''' # Convert type to appropriate string if translateable: translateable = 'true' else: translateable = 'false' node = MessageNode() node.StartParsing('message', parent) node.HandleAttribute('name', name) node.HandleAttribute('desc', desc) node.HandleAttribute('meaning', meaning) node.HandleAttribute('translateable', translateable) items = message.GetContent() for ix in range(len(items)): if isinstance(items[ix], types.StringTypes): text = items[ix] # Ensure whitespace at front and back of message is correctly handled. if ix == 0: text = "'''" + text if ix == len(items) - 1: text = text + "'''" node.AppendContent(text) else: phnode = PhNode() phnode.StartParsing('ph', node) phnode.HandleAttribute('name', items[ix].GetPresentation()) phnode.AppendContent(items[ix].GetOriginal()) if len(items[ix].GetExample()) and items[ix].GetExample() != ' ': exnode = ExNode() exnode.StartParsing('ex', phnode) exnode.AppendContent(items[ix].GetExample()) exnode.EndParsing() phnode.AddChild(exnode) phnode.EndParsing() node.AddChild(phnode) node.EndParsing() return node Construct = staticmethod(Construct) class PhNode(base.ContentNode): '''A <ph> element.''' def _IsValidChild(self, child): return isinstance(child, ExNode) def MandatoryAttributes(self): return ['name'] def EndParsing(self): super(type(self), self).EndParsing() # We only allow a single example for each placeholder if len(self.children) > 1: raise exception.TooManyExamples() class ExNode(base.ContentNode): '''An <ex> element.''' pass
kuiche/chromium
tools/grit/grit/node/message.py
Python
bsd-3-clause
9,031
0.009412
"""Kytos Core-Defined Exceptions.""" class KytosCoreException(Exception): """Exception thrown when KytosCore is broken.""" def __str__(self): """Return message of KytosCoreException.""" return 'KytosCore exception: ' + super().__str__() class KytosSwitchOfflineException(Exception): """Exception thrown when a switch is offline.""" def __init__(self, switch): """Require a switch. Args: switch (:class:`~kytos.core.switch.Switch`): A switch offline. """ super().__init__() self.switch = switch def __str__(self): """Return message of KytosSwitchOfflineException.""" msg = 'The switch {} is not reachable. Please check the connection ' msg += 'between the switch and the controller.' return msg.format(self.switch.dpid) class KytosEventException(Exception): """Exception thrown when a KytosEvent have an illegal use.""" def __init__(self, message="KytosEvent exception", event=None): """Assign parameters to instance variables. Args: message (string): message from KytosEventException. event (:class:`~kytos.core.events.KytosEvent`): Event malformed. """ super().__init__() self.message = message self.event = event def __str__(self): """Return the full message from KytosEventException.""" message = self.message if self.event: message += ". EventType: " + type(self.event) return message class KytosWrongEventType(KytosEventException): """Exception related to EventType. When related to buffers, it means that the EventType is not allowed on that buffer. """ class KytosNoTagAvailableError(Exception): """Exception raised when a link has no vlan available.""" def __init__(self, link): """Require a link. Args: link (:class:`~kytos.core.link.Link`): A link with no vlan available. """ super().__init__() self.link = link def __str__(self): """Full message.""" msg = f'Link {self.link.id} has no vlan available.' return msg class KytosLinkCreationError(Exception): """Exception thrown when the link has an empty endpoint.""" # Exceptions related to NApps class KytosNAppException(Exception): """Exception raised on a KytosNApp.""" def __init__(self, message="KytosNApp exception"): """Assign the parameters to instance variables. Args: message (string): message from KytosNAppException. """ super().__init__() self.message = message def __str__(self): """Return the message from KytosNAppException.""" return self.message class KytosNAppMissingInitArgument(KytosNAppException): """Exception thrown when NApp have a missing init argument.""" def __init__(self, message="KytosNAppMissingInitArgument"): """Assing parameters to instance variables. Args: message (str): Name of the missed argument. """ super().__init__(message=message)
kytos/kytos
kytos/core/exceptions.py
Python
mit
3,168
0
# -*- coding: utf-8 -*- """ Vented box enclosure """ import numpy as np from . import air class VentedBox(object): """ Model a vented box loudspeaker enclosure """ def __init__(self, Vab, fb, Ql): self._Vab = Vab #: Acoustic compliance of box :math:`C_{ab}` #: #: .. note:: Do not set this directly, use :meth:`Vab` self.Cab = Vab / (air.RHO*air.C**2) self._fb = fb #: Angular frequency :math:`\omega_b = 2 \pi f_b` #: #: .. note:: Do not set this directly, use :meth:`fb` self.wb = 2.0*np.pi*fb #: Time constant of the box :math:`T_b = \frac{1}{\omega_b}`; not to #: be confused with a period #: :math:`t = \frac{1}{f} = \frac{2\pi}{\omega}` #: #: .. note:: Do not set this directly, use :meth:`fb` self.Tb = 1.0 / self.wb #: Enclosure leakage losses self.Ql = Ql @property def Vab(self): """ Box Volume in m³ The box volume in m³. Setting this attribute also sets :attr:`Cab`. """ return self._Vab @Vab.setter def Vab(self, Vab): """ Sets Vab, as well as Cab """ self._Vab = Vab self.Cab = Vab / (air.RHO*air.C**2) @property def fb(self): """ Box Tuning Frequency in Hz The tuning frequency of the box. Setting this attribute also sets :attr:`wb` and :attr:`Tb`. """ return self._fb @fb.setter def fb(self, fb): """ Sets fb, as well as wb and Tb """ self._fb = fb self.wb = 2*np.pi*fb self.Tb = 1 / self.wb
Psirus/altay
altai/lib/vented_box.py
Python
bsd-3-clause
1,632
0
from django.conf.urls.defaults import patterns, url, include from django.contrib import admin from django.conf import settings from django.views.generic.simple import direct_to_template admin.autodiscover() urlpatterns = patterns( '', url(r'^', include('reciblog.blog.urls')), url(r'^about$', direct_to_template, {'template': 'about.html'}, name='about'), url(r'^admin/', include(admin.site.urls)), ) if settings.DEBUG == True: urlpatterns += patterns( '', url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), )
wraithan/reciblog
urls.py
Python
bsd-2-clause
617
0.003241
# encoding: utf-8 from __future__ import unicode_literals import os import re import sys from .common import InfoExtractor from .youtube import YoutubeIE from ..compat import ( compat_etree_fromstring, compat_urllib_parse_unquote, compat_urlparse, compat_xml_parse_error, ) from ..utils import ( determine_ext, ExtractorError, float_or_none, HEADRequest, is_html, orderedSet, sanitized_Request, smuggle_url, unescapeHTML, unified_strdate, unsmuggle_url, UnsupportedError, url_basename, xpath_text, ) from .brightcove import ( BrightcoveLegacyIE, BrightcoveNewIE, ) from .nbc import NBCSportsVPlayerIE from .ooyala import OoyalaIE from .rutv import RUTVIE from .tvc import TVCIE from .sportbox import SportBoxEmbedIE from .smotri import SmotriIE from .myvi import MyviIE from .condenast import CondeNastIE from .udn import UDNEmbedIE from .senateisvp import SenateISVPIE from .svt import SVTIE from .pornhub import PornHubIE from .xhamster import XHamsterEmbedIE from .tnaflix import TNAFlixNetworkEmbedIE from .vimeo import VimeoIE from .dailymotion import ( DailymotionIE, DailymotionCloudIE, ) from .onionstudios import OnionStudiosIE from .viewlift import ViewLiftEmbedIE from .screenwavemedia import ScreenwaveMediaIE from .mtv import MTVServicesEmbeddedIE from .pladform import PladformIE from .videomore import VideomoreIE from .googledrive import GoogleDriveIE from .jwplatform import JWPlatformIE from .digiteka import DigitekaIE from .arkena import ArkenaIE from .instagram import InstagramIE from .liveleak import LiveLeakIE from .threeqsdn import ThreeQSDNIE from .theplatform import ThePlatformIE from .vessel import VesselIE from .kaltura import KalturaIE from .eagleplatform import EaglePlatformIE from .facebook import FacebookIE from .soundcloud import SoundcloudIE from .vbox7 import Vbox7IE class GenericIE(InfoExtractor): IE_DESC = 'Generic downloader that works on some sites' _VALID_URL = r'.*' IE_NAME = 'generic' _TESTS = [ # Direct link to a video { 'url': 'http://media.w3.org/2010/05/sintel/trailer.mp4', 'md5': '67d406c2bcb6af27fa886f31aa934bbe', 'info_dict': { 'id': 'trailer', 'ext': 'mp4', 'title': 'trailer', 'upload_date': '20100513', } }, # Direct link to media delivered compressed (until Accept-Encoding is *) { 'url': 'http://calimero.tk/muzik/FictionJunction-Parallel_Hearts.flac', 'md5': '128c42e68b13950268b648275386fc74', 'info_dict': { 'id': 'FictionJunction-Parallel_Hearts', 'ext': 'flac', 'title': 'FictionJunction-Parallel_Hearts', 'upload_date': '20140522', }, 'expected_warnings': [ 'URL could be a direct video link, returning it as such.' ] }, # Direct download with broken HEAD { 'url': 'http://ai-radio.org:8000/radio.opus', 'info_dict': { 'id': 'radio', 'ext': 'opus', 'title': 'radio', }, 'params': { 'skip_download': True, # infinite live stream }, 'expected_warnings': [ r'501.*Not Implemented', r'400.*Bad Request', ], }, # Direct link with incorrect MIME type { 'url': 'http://ftp.nluug.nl/video/nluug/2014-11-20_nj14/zaal-2/5_Lennart_Poettering_-_Systemd.webm', 'md5': '4ccbebe5f36706d85221f204d7eb5913', 'info_dict': { 'url': 'http://ftp.nluug.nl/video/nluug/2014-11-20_nj14/zaal-2/5_Lennart_Poettering_-_Systemd.webm', 'id': '5_Lennart_Poettering_-_Systemd', 'ext': 'webm', 'title': '5_Lennart_Poettering_-_Systemd', 'upload_date': '20141120', }, 'expected_warnings': [ 'URL could be a direct video link, returning it as such.' ] }, # RSS feed { 'url': 'http://phihag.de/2014/youtube-dl/rss2.xml', 'info_dict': { 'id': 'http://phihag.de/2014/youtube-dl/rss2.xml', 'title': 'Zero Punctuation', 'description': 're:.*groundbreaking video review series.*' }, 'playlist_mincount': 11, }, # RSS feed with enclosure { 'url': 'http://podcastfeeds.nbcnews.com/audio/podcast/MSNBC-MADDOW-NETCAST-M4V.xml', 'info_dict': { 'id': 'pdv_maddow_netcast_m4v-02-27-2015-201624', 'ext': 'm4v', 'upload_date': '20150228', 'title': 'pdv_maddow_netcast_m4v-02-27-2015-201624', } }, # SMIL from http://videolectures.net/promogram_igor_mekjavic_eng { 'url': 'http://videolectures.net/promogram_igor_mekjavic_eng/video/1/smil.xml', 'info_dict': { 'id': 'smil', 'ext': 'mp4', 'title': 'Automatics, robotics and biocybernetics', 'description': 'md5:815fc1deb6b3a2bff99de2d5325be482', 'upload_date': '20130627', 'formats': 'mincount:16', 'subtitles': 'mincount:1', }, 'params': { 'force_generic_extractor': True, 'skip_download': True, }, }, # SMIL from http://www1.wdr.de/mediathek/video/livestream/index.html { 'url': 'http://metafilegenerator.de/WDR/WDR_FS/hds/hds.smil', 'info_dict': { 'id': 'hds', 'ext': 'flv', 'title': 'hds', 'formats': 'mincount:1', }, 'params': { 'skip_download': True, }, }, # SMIL from https://www.restudy.dk/video/play/id/1637 { 'url': 'https://www.restudy.dk/awsmedia/SmilDirectory/video_1637.xml', 'info_dict': { 'id': 'video_1637', 'ext': 'flv', 'title': 'video_1637', 'formats': 'mincount:3', }, 'params': { 'skip_download': True, }, }, # SMIL from http://adventure.howstuffworks.com/5266-cool-jobs-iditarod-musher-video.htm { 'url': 'http://services.media.howstuffworks.com/videos/450221/smil-service.smil', 'info_dict': { 'id': 'smil-service', 'ext': 'flv', 'title': 'smil-service', 'formats': 'mincount:1', }, 'params': { 'skip_download': True, }, }, # SMIL from http://new.livestream.com/CoheedandCambria/WebsterHall/videos/4719370 { 'url': 'http://api.new.livestream.com/accounts/1570303/events/1585861/videos/4719370.smil', 'info_dict': { 'id': '4719370', 'ext': 'mp4', 'title': '571de1fd-47bc-48db-abf9-238872a58d1f', 'formats': 'mincount:3', }, 'params': { 'skip_download': True, }, }, # XSPF playlist from http://www.telegraaf.nl/tv/nieuws/binnenland/24353229/__Tikibad_ontruimd_wegens_brand__.html { 'url': 'http://www.telegraaf.nl/xml/playlist/2015/8/7/mZlp2ctYIUEB.xspf', 'info_dict': { 'id': 'mZlp2ctYIUEB', 'ext': 'mp4', 'title': 'Tikibad ontruimd wegens brand', 'description': 'md5:05ca046ff47b931f9b04855015e163a4', 'thumbnail': 're:^https?://.*\.jpg$', 'duration': 33, }, 'params': { 'skip_download': True, }, }, # MPD from http://dash-mse-test.appspot.com/media.html { 'url': 'http://yt-dash-mse-test.commondatastorage.googleapis.com/media/car-20120827-manifest.mpd', 'md5': '4b57baab2e30d6eb3a6a09f0ba57ef53', 'info_dict': { 'id': 'car-20120827-manifest', 'ext': 'mp4', 'title': 'car-20120827-manifest', 'formats': 'mincount:9', 'upload_date': '20130904', }, 'params': { 'format': 'bestvideo', }, }, # m3u8 served with Content-Type: audio/x-mpegURL; charset=utf-8 { 'url': 'http://once.unicornmedia.com/now/master/playlist/bb0b18ba-64f5-4b1b-a29f-0ac252f06b68/77a785f3-5188-4806-b788-0893a61634ed/93677179-2d99-4ef4-9e17-fe70d49abfbf/content.m3u8', 'info_dict': { 'id': 'content', 'ext': 'mp4', 'title': 'content', 'formats': 'mincount:8', }, 'params': { # m3u8 downloads 'skip_download': True, } }, # m3u8 served with Content-Type: text/plain { 'url': 'http://www.nacentapps.com/m3u8/index.m3u8', 'info_dict': { 'id': 'index', 'ext': 'mp4', 'title': 'index', 'upload_date': '20140720', 'formats': 'mincount:11', }, 'params': { # m3u8 downloads 'skip_download': True, } }, # google redirect { 'url': 'http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCUQtwIwAA&url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcmQHVoWB5FY&ei=F-sNU-LLCaXk4QT52ICQBQ&usg=AFQjCNEw4hL29zgOohLXvpJ-Bdh2bils1Q&bvm=bv.61965928,d.bGE', 'info_dict': { 'id': 'cmQHVoWB5FY', 'ext': 'mp4', 'upload_date': '20130224', 'uploader_id': 'TheVerge', 'description': 're:^Chris Ziegler takes a look at the\.*', 'uploader': 'The Verge', 'title': 'First Firefox OS phones side-by-side', }, 'params': { 'skip_download': False, } }, { # redirect in Refresh HTTP header 'url': 'https://www.facebook.com/l.php?u=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DpO8h3EaFRdo&h=TAQHsoToz&enc=AZN16h-b6o4Zq9pZkCCdOLNKMN96BbGMNtcFwHSaazus4JHT_MFYkAA-WARTX2kvsCIdlAIyHZjl6d33ILIJU7Jzwk_K3mcenAXoAzBNoZDI_Q7EXGDJnIhrGkLXo_LJ_pAa2Jzbx17UHMd3jAs--6j2zaeto5w9RTn8T_1kKg3fdC5WPX9Dbb18vzH7YFX0eSJmoa6SP114rvlkw6pkS1-T&s=1', 'info_dict': { 'id': 'pO8h3EaFRdo', 'ext': 'mp4', 'title': 'Tripeo Boiler Room x Dekmantel Festival DJ Set', 'description': 'md5:6294cc1af09c4049e0652b51a2df10d5', 'upload_date': '20150917', 'uploader_id': 'brtvofficial', 'uploader': 'Boiler Room', }, 'params': { 'skip_download': False, }, }, { 'url': 'http://www.hodiho.fr/2013/02/regis-plante-sa-jeep.html', 'md5': '85b90ccc9d73b4acd9138d3af4c27f89', 'info_dict': { 'id': '13601338388002', 'ext': 'mp4', 'uploader': 'www.hodiho.fr', 'title': 'R\u00e9gis plante sa Jeep', } }, # bandcamp page with custom domain { 'add_ie': ['Bandcamp'], 'url': 'http://bronyrock.com/track/the-pony-mash', 'info_dict': { 'id': '3235767654', 'ext': 'mp3', 'title': 'The Pony Mash', 'uploader': 'M_Pallante', }, 'skip': 'There is a limit of 200 free downloads / month for the test song', }, # embedded brightcove video # it also tests brightcove videos that need to set the 'Referer' in the # http requests { 'add_ie': ['BrightcoveLegacy'], 'url': 'http://www.bfmtv.com/video/bfmbusiness/cours-bourse/cours-bourse-l-analyse-technique-154522/', 'info_dict': { 'id': '2765128793001', 'ext': 'mp4', 'title': 'Le cours de bourse : l’analyse technique', 'description': 'md5:7e9ad046e968cb2d1114004aba466fd9', 'uploader': 'BFM BUSINESS', }, 'params': { 'skip_download': True, }, }, { # https://github.com/rg3/youtube-dl/issues/2253 'url': 'http://bcove.me/i6nfkrc3', 'md5': '0ba9446db037002366bab3b3eb30c88c', 'info_dict': { 'id': '3101154703001', 'ext': 'mp4', 'title': 'Still no power', 'uploader': 'thestar.com', 'description': 'Mississauga resident David Farmer is still out of power as a result of the ice storm a month ago. To keep the house warm, Farmer cuts wood from his property for a wood burning stove downstairs.', }, 'add_ie': ['BrightcoveLegacy'], }, { 'url': 'http://www.championat.com/video/football/v/87/87499.html', 'md5': 'fb973ecf6e4a78a67453647444222983', 'info_dict': { 'id': '3414141473001', 'ext': 'mp4', 'title': 'Видео. Удаление Дзагоева (ЦСКА)', 'description': 'Онлайн-трансляция матча ЦСКА - "Волга"', 'uploader': 'Championat', }, }, { # https://github.com/rg3/youtube-dl/issues/3541 'add_ie': ['BrightcoveLegacy'], 'url': 'http://www.kijk.nl/sbs6/leermijvrouwenkennen/videos/jqMiXKAYan2S/aflevering-1', 'info_dict': { 'id': '3866516442001', 'ext': 'mp4', 'title': 'Leer mij vrouwen kennen: Aflevering 1', 'description': 'Leer mij vrouwen kennen: Aflevering 1', 'uploader': 'SBS Broadcasting', }, 'skip': 'Restricted to Netherlands', 'params': { 'skip_download': True, # m3u8 download }, }, # ooyala video { 'url': 'http://www.rollingstone.com/music/videos/norwegian-dj-cashmere-cat-goes-spartan-on-with-me-premiere-20131219', 'md5': '166dd577b433b4d4ebfee10b0824d8ff', 'info_dict': { 'id': 'BwY2RxaTrTkslxOfcan0UCf0YqyvWysJ', 'ext': 'mp4', 'title': '2cc213299525360.mov', # that's what we get 'duration': 238.231, }, 'add_ie': ['Ooyala'], }, { # ooyala video embedded with http://player.ooyala.com/iframe.js 'url': 'http://www.macrumors.com/2015/07/24/steve-jobs-the-man-in-the-machine-first-trailer/', 'info_dict': { 'id': 'p0MGJndjoG5SOKqO_hZJuZFPB-Tr5VgB', 'ext': 'mp4', 'title': '"Steve Jobs: Man in the Machine" trailer', 'description': 'The first trailer for the Alex Gibney documentary "Steve Jobs: Man in the Machine."', 'duration': 135.427, }, 'params': { 'skip_download': True, }, }, # embed.ly video { 'url': 'http://www.tested.com/science/weird/460206-tested-grinding-coffee-2000-frames-second/', 'info_dict': { 'id': '9ODmcdjQcHQ', 'ext': 'mp4', 'title': 'Tested: Grinding Coffee at 2000 Frames Per Second', 'upload_date': '20140225', 'description': 'md5:06a40fbf30b220468f1e0957c0f558ff', 'uploader': 'Tested', 'uploader_id': 'testedcom', }, # No need to test YoutubeIE here 'params': { 'skip_download': True, }, }, # funnyordie embed { 'url': 'http://www.theguardian.com/world/2014/mar/11/obama-zach-galifianakis-between-two-ferns', 'info_dict': { 'id': '18e820ec3f', 'ext': 'mp4', 'title': 'Between Two Ferns with Zach Galifianakis: President Barack Obama', 'description': 'Episode 18: President Barack Obama sits down with Zach Galifianakis for his most memorable interview yet.', }, }, # RUTV embed { 'url': 'http://www.rg.ru/2014/03/15/reg-dfo/anklav-anons.html', 'info_dict': { 'id': '776940', 'ext': 'mp4', 'title': 'Охотское море стало целиком российским', 'description': 'md5:5ed62483b14663e2a95ebbe115eb8f43', }, 'params': { # m3u8 download 'skip_download': True, }, }, # TVC embed { 'url': 'http://sch1298sz.mskobr.ru/dou_edu/karamel_ki/filial_galleries/video/iframe_src_http_tvc_ru_video_iframe_id_55304_isplay_false_acc_video_id_channel_brand_id_11_show_episodes_episode_id_32307_frameb/', 'info_dict': { 'id': '55304', 'ext': 'mp4', 'title': 'Дошкольное воспитание', }, }, # SportBox embed { 'url': 'http://www.vestifinance.ru/articles/25753', 'info_dict': { 'id': '25753', 'title': 'Прямые трансляции с Форума-выставки "Госзаказ-2013"', }, 'playlist': [{ 'info_dict': { 'id': '370908', 'title': 'Госзаказ. День 3', 'ext': 'mp4', } }, { 'info_dict': { 'id': '370905', 'title': 'Госзаказ. День 2', 'ext': 'mp4', } }, { 'info_dict': { 'id': '370902', 'title': 'Госзаказ. День 1', 'ext': 'mp4', } }], 'params': { # m3u8 download 'skip_download': True, }, }, # Myvi.ru embed { 'url': 'http://www.kinomyvi.tv/news/detail/Pervij-dublirovannij-trejler--Uzhastikov-_nOw1', 'info_dict': { 'id': 'f4dafcad-ff21-423d-89b5-146cfd89fa1e', 'ext': 'mp4', 'title': 'Ужастики, русский трейлер (2015)', 'thumbnail': 're:^https?://.*\.jpg$', 'duration': 153, } }, # XHamster embed { 'url': 'http://www.numisc.com/forum/showthread.php?11696-FM15-which-pumiscer-was-this-%28-vid-%29-%28-alfa-as-fuck-srx-%29&s=711f5db534502e22260dec8c5e2d66d8', 'info_dict': { 'id': 'showthread', 'title': '[NSFL] [FM15] which pumiscer was this ( vid ) ( alfa as fuck srx )', }, 'playlist_mincount': 7, }, # Embedded TED video { 'url': 'http://en.support.wordpress.com/videos/ted-talks/', 'md5': '65fdff94098e4a607385a60c5177c638', 'info_dict': { 'id': '1969', 'ext': 'mp4', 'title': 'Hidden miracles of the natural world', 'uploader': 'Louie Schwartzberg', 'description': 'md5:8145d19d320ff3e52f28401f4c4283b9', } }, # Embedded Ustream video { 'url': 'http://www.american.edu/spa/pti/nsa-privacy-janus-2014.cfm', 'md5': '27b99cdb639c9b12a79bca876a073417', 'info_dict': { 'id': '45734260', 'ext': 'flv', 'uploader': 'AU SPA: The NSA and Privacy', 'title': 'NSA and Privacy Forum Debate featuring General Hayden and Barton Gellman' } }, # nowvideo embed hidden behind percent encoding { 'url': 'http://www.waoanime.tv/the-super-dimension-fortress-macross-episode-1/', 'md5': '2baf4ddd70f697d94b1c18cf796d5107', 'info_dict': { 'id': '06e53103ca9aa', 'ext': 'flv', 'title': 'Macross Episode 001 Watch Macross Episode 001 onl', 'description': 'No description', }, }, # arte embed { 'url': 'http://www.tv-replay.fr/redirection/20-03-14/x-enius-arte-10753389.html', 'md5': '7653032cbb25bf6c80d80f217055fa43', 'info_dict': { 'id': '048195-004_PLUS7-F', 'ext': 'flv', 'title': 'X:enius', 'description': 'md5:d5fdf32ef6613cdbfd516ae658abf168', 'upload_date': '20140320', }, 'params': { 'skip_download': 'Requires rtmpdump' } }, # francetv embed { 'url': 'http://www.tsprod.com/replay-du-concert-alcaline-de-calogero', 'info_dict': { 'id': 'EV_30231', 'ext': 'mp4', 'title': 'Alcaline, le concert avec Calogero', 'description': 'md5:61f08036dcc8f47e9cfc33aed08ffaff', 'upload_date': '20150226', 'timestamp': 1424989860, 'duration': 5400, }, 'params': { # m3u8 downloads 'skip_download': True, }, 'expected_warnings': [ 'Forbidden' ] }, # Condé Nast embed { 'url': 'http://www.wired.com/2014/04/honda-asimo/', 'md5': 'ba0dfe966fa007657bd1443ee672db0f', 'info_dict': { 'id': '53501be369702d3275860000', 'ext': 'mp4', 'title': 'Honda’s New Asimo Robot Is More Human Than Ever', } }, # Dailymotion embed { 'url': 'http://www.spi0n.com/zap-spi0n-com-n216/', 'md5': '441aeeb82eb72c422c7f14ec533999cd', 'info_dict': { 'id': 'k2mm4bCdJ6CQ2i7c8o2', 'ext': 'mp4', 'title': 'Le Zap de Spi0n n°216 - Zapping du Web', 'description': 'md5:faf028e48a461b8b7fad38f1e104b119', 'uploader': 'Spi0n', 'uploader_id': 'xgditw', 'upload_date': '20140425', 'timestamp': 1398441542, }, 'add_ie': ['Dailymotion'], }, # YouTube embed { 'url': 'http://www.badzine.de/ansicht/datum/2014/06/09/so-funktioniert-die-neue-englische-badminton-liga.html', 'info_dict': { 'id': 'FXRb4ykk4S0', 'ext': 'mp4', 'title': 'The NBL Auction 2014', 'uploader': 'BADMINTON England', 'uploader_id': 'BADMINTONEvents', 'upload_date': '20140603', 'description': 'md5:9ef128a69f1e262a700ed83edb163a73', }, 'add_ie': ['Youtube'], 'params': { 'skip_download': True, } }, # MTVSercices embed { 'url': 'http://www.vulture.com/2016/06/new-key-peele-sketches-released.html', 'md5': 'ca1aef97695ef2c1d6973256a57e5252', 'info_dict': { 'id': '769f7ec0-0692-4d62-9b45-0d88074bffc1', 'ext': 'mp4', 'title': 'Key and Peele|October 10, 2012|2|203|Liam Neesons - Uncensored', 'description': 'Two valets share their love for movie star Liam Neesons.', 'timestamp': 1349922600, 'upload_date': '20121011', }, }, # YouTube embed via <data-embed-url=""> { 'url': 'https://play.google.com/store/apps/details?id=com.gameloft.android.ANMP.GloftA8HM', 'info_dict': { 'id': '4vAffPZIT44', 'ext': 'mp4', 'title': 'Asphalt 8: Airborne - Update - Welcome to Dubai!', 'uploader': 'Gameloft', 'uploader_id': 'gameloft', 'upload_date': '20140828', 'description': 'md5:c80da9ed3d83ae6d1876c834de03e1c4', }, 'params': { 'skip_download': True, } }, # Camtasia studio { 'url': 'http://www.ll.mit.edu/workshops/education/videocourses/antennas/lecture1/video/', 'playlist': [{ 'md5': '0c5e352edabf715d762b0ad4e6d9ee67', 'info_dict': { 'id': 'Fenn-AA_PA_Radar_Course_Lecture_1c_Final', 'title': 'Fenn-AA_PA_Radar_Course_Lecture_1c_Final - video1', 'ext': 'flv', 'duration': 2235.90, } }, { 'md5': '10e4bb3aaca9fd630e273ff92d9f3c63', 'info_dict': { 'id': 'Fenn-AA_PA_Radar_Course_Lecture_1c_Final_PIP', 'title': 'Fenn-AA_PA_Radar_Course_Lecture_1c_Final - pip', 'ext': 'flv', 'duration': 2235.93, } }], 'info_dict': { 'title': 'Fenn-AA_PA_Radar_Course_Lecture_1c_Final', } }, # Flowplayer { 'url': 'http://www.handjobhub.com/video/busty-blonde-siri-tit-fuck-while-wank-6313.html', 'md5': '9d65602bf31c6e20014319c7d07fba27', 'info_dict': { 'id': '5123ea6d5e5a7', 'ext': 'mp4', 'age_limit': 18, 'uploader': 'www.handjobhub.com', 'title': 'Busty Blonde Siri Tit Fuck While Wank at HandjobHub.com', } }, # Multiple brightcove videos # https://github.com/rg3/youtube-dl/issues/2283 { 'url': 'http://www.newyorker.com/online/blogs/newsdesk/2014/01/always-never-nuclear-command-and-control.html', 'info_dict': { 'id': 'always-never', 'title': 'Always / Never - The New Yorker', }, 'playlist_count': 3, 'params': { 'extract_flat': False, 'skip_download': True, } }, # MLB embed { 'url': 'http://umpire-empire.com/index.php/topic/58125-laz-decides-no-thats-low/', 'md5': '96f09a37e44da40dd083e12d9a683327', 'info_dict': { 'id': '33322633', 'ext': 'mp4', 'title': 'Ump changes call to ball', 'description': 'md5:71c11215384298a172a6dcb4c2e20685', 'duration': 48, 'timestamp': 1401537900, 'upload_date': '20140531', 'thumbnail': 're:^https?://.*\.jpg$', }, }, # Wistia embed { 'url': 'http://study.com/academy/lesson/north-american-exploration-failed-colonies-of-spain-france-england.html#lesson', 'md5': '1953f3a698ab51cfc948ed3992a0b7ff', 'info_dict': { 'id': '6e2wtrbdaf', 'ext': 'mov', 'title': 'paywall_north-american-exploration-failed-colonies-of-spain-france-england', 'description': 'a Paywall Videos video from Remilon', 'duration': 644.072, 'uploader': 'study.com', 'timestamp': 1459678540, 'upload_date': '20160403', 'filesize': 24687186, }, }, { 'url': 'http://thoughtworks.wistia.com/medias/uxjb0lwrcz', 'md5': 'baf49c2baa8a7de5f3fc145a8506dcd4', 'info_dict': { 'id': 'uxjb0lwrcz', 'ext': 'mp4', 'title': 'Conversation about Hexagonal Rails Part 1', 'description': 'a Martin Fowler video from ThoughtWorks', 'duration': 1715.0, 'uploader': 'thoughtworks.wistia.com', 'timestamp': 1401832161, 'upload_date': '20140603', }, }, # Wistia standard embed (async) { 'url': 'https://www.getdrip.com/university/brennan-dunn-drip-workshop/', 'info_dict': { 'id': '807fafadvk', 'ext': 'mp4', 'title': 'Drip Brennan Dunn Workshop', 'description': 'a JV Webinars video from getdrip-1', 'duration': 4986.95, 'timestamp': 1463607249, 'upload_date': '20160518', }, 'params': { 'skip_download': True, } }, # Soundcloud embed { 'url': 'http://nakedsecurity.sophos.com/2014/10/29/sscc-171-are-you-sure-that-1234-is-a-bad-password-podcast/', 'info_dict': { 'id': '174391317', 'ext': 'mp3', 'description': 'md5:ff867d6b555488ad3c52572bb33d432c', 'uploader': 'Sophos Security', 'title': 'Chet Chat 171 - Oct 29, 2014', 'upload_date': '20141029', } }, # Soundcloud multiple embeds { 'url': 'http://www.guitarplayer.com/lessons/1014/legato-workout-one-hour-to-more-fluid-performance---tab/52809', 'info_dict': { 'id': '52809', 'title': 'Guitar Essentials: Legato Workout—One-Hour to Fluid Performance | TAB + AUDIO', }, 'playlist_mincount': 7, }, # Livestream embed { 'url': 'http://www.esa.int/Our_Activities/Space_Science/Rosetta/Philae_comet_touch-down_webcast', 'info_dict': { 'id': '67864563', 'ext': 'flv', 'upload_date': '20141112', 'title': 'Rosetta #CometLanding webcast HL 10', } }, # Another Livestream embed, without 'new.' in URL { 'url': 'https://www.freespeech.org/', 'info_dict': { 'id': '123537347', 'ext': 'mp4', 'title': 're:^FSTV [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', }, 'params': { # Live stream 'skip_download': True, }, }, # LazyYT { 'url': 'http://discourse.ubuntu.com/t/unity-8-desktop-mode-windows-on-mir/1986', 'info_dict': { 'id': '1986', 'title': 'Unity 8 desktop-mode windows on Mir! - Ubuntu Discourse', }, 'playlist_mincount': 2, }, # Cinchcast embed { 'url': 'http://undergroundwellness.com/podcasts/306-5-steps-to-permanent-gut-healing/', 'info_dict': { 'id': '7141703', 'ext': 'mp3', 'upload_date': '20141126', 'title': 'Jack Tips: 5 Steps to Permanent Gut Healing', } }, # Cinerama player { 'url': 'http://www.abc.net.au/7.30/content/2015/s4164797.htm', 'info_dict': { 'id': '730m_DandD_1901_512k', 'ext': 'mp4', 'uploader': 'www.abc.net.au', 'title': 'Game of Thrones with dice - Dungeons and Dragons fantasy role-playing game gets new life - 19/01/2015', } }, # embedded viddler video { 'url': 'http://deadspin.com/i-cant-stop-watching-john-wall-chop-the-nuggets-with-th-1681801597', 'info_dict': { 'id': '4d03aad9', 'ext': 'mp4', 'uploader': 'deadspin', 'title': 'WALL-TO-GORTAT', 'timestamp': 1422285291, 'upload_date': '20150126', }, 'add_ie': ['Viddler'], }, # Libsyn embed { 'url': 'http://thedailyshow.cc.com/podcast/episodetwelve', 'info_dict': { 'id': '3377616', 'ext': 'mp3', 'title': "The Daily Show Podcast without Jon Stewart - Episode 12: Bassem Youssef: Egypt's Jon Stewart", 'description': 'md5:601cb790edd05908957dae8aaa866465', 'upload_date': '20150220', }, 'skip': 'All The Daily Show URLs now redirect to http://www.cc.com/shows/', }, # jwplayer YouTube { 'url': 'http://media.nationalarchives.gov.uk/index.php/webinar-using-discovery-national-archives-online-catalogue/', 'info_dict': { 'id': 'Mrj4DVp2zeA', 'ext': 'mp4', 'upload_date': '20150212', 'uploader': 'The National Archives UK', 'description': 'md5:a236581cd2449dd2df4f93412f3f01c6', 'uploader_id': 'NationalArchives08', 'title': 'Webinar: Using Discovery, The National Archives’ online catalogue', }, }, # rtl.nl embed { 'url': 'http://www.rtlnieuws.nl/nieuws/buitenland/aanslagen-kopenhagen', 'playlist_mincount': 5, 'info_dict': { 'id': 'aanslagen-kopenhagen', 'title': 'Aanslagen Kopenhagen | RTL Nieuws', } }, # Zapiks embed { 'url': 'http://www.skipass.com/news/116090-bon-appetit-s5ep3-baqueira-mi-cor.html', 'info_dict': { 'id': '118046', 'ext': 'mp4', 'title': 'EP3S5 - Bon Appétit - Baqueira Mi Corazon !', } }, # Kaltura embed (different embed code) { 'url': 'http://www.premierchristianradio.com/Shows/Saturday/Unbelievable/Conference-Videos/Os-Guinness-Is-It-Fools-Talk-Unbelievable-Conference-2014', 'info_dict': { 'id': '1_a52wc67y', 'ext': 'flv', 'upload_date': '20150127', 'uploader_id': 'PremierMedia', 'timestamp': int, 'title': 'Os Guinness // Is It Fools Talk? // Unbelievable? Conference 2014', }, }, # Kaltura embed protected with referrer { 'url': 'http://www.disney.nl/disney-channel/filmpjes/achter-de-schermen#/videoId/violetta-achter-de-schermen-ruggero', 'info_dict': { 'id': '1_g4fbemnq', 'ext': 'mp4', 'title': 'Violetta - Achter De Schermen - Ruggero', 'description': 'Achter de schermen met Ruggero', 'timestamp': 1435133761, 'upload_date': '20150624', 'uploader_id': 'echojecka', }, }, # Kaltura embed with single quotes { 'url': 'http://fod.infobase.com/p_ViewPlaylist.aspx?AssignmentID=NUN8ZY', 'info_dict': { 'id': '0_izeg5utt', 'ext': 'mp4', 'title': '35871', 'timestamp': 1355743100, 'upload_date': '20121217', 'uploader_id': 'batchUser', }, 'add_ie': ['Kaltura'], }, { # Kaltura embedded via quoted entry_id 'url': 'https://www.oreilly.com/ideas/my-cloud-makes-pretty-pictures', 'info_dict': { 'id': '0_utuok90b', 'ext': 'mp4', 'title': '06_matthew_brender_raj_dutt', 'timestamp': 1466638791, 'upload_date': '20160622', }, 'add_ie': ['Kaltura'], 'expected_warnings': [ 'Could not send HEAD request' ], 'params': { 'skip_download': True, } }, # Eagle.Platform embed (generic URL) { 'url': 'http://lenta.ru/news/2015/03/06/navalny/', # Not checking MD5 as sometimes the direct HTTP link results in 404 and HLS is used 'info_dict': { 'id': '227304', 'ext': 'mp4', 'title': 'Навальный вышел на свободу', 'description': 'md5:d97861ac9ae77377f3f20eaf9d04b4f5', 'thumbnail': 're:^https?://.*\.jpg$', 'duration': 87, 'view_count': int, 'age_limit': 0, }, }, # ClipYou (Eagle.Platform) embed (custom URL) { 'url': 'http://muz-tv.ru/play/7129/', # Not checking MD5 as sometimes the direct HTTP link results in 404 and HLS is used 'info_dict': { 'id': '12820', 'ext': 'mp4', 'title': "'O Sole Mio", 'thumbnail': 're:^https?://.*\.jpg$', 'duration': 216, 'view_count': int, }, }, # Pladform embed { 'url': 'http://muz-tv.ru/kinozal/view/7400/', 'info_dict': { 'id': '100183293', 'ext': 'mp4', 'title': 'Тайны перевала Дятлова • 1 серия 2 часть', 'description': 'Документальный сериал-расследование одной из самых жутких тайн ХХ века', 'thumbnail': 're:^https?://.*\.jpg$', 'duration': 694, 'age_limit': 0, }, }, # Playwire embed { 'url': 'http://www.cinemablend.com/new/First-Joe-Dirt-2-Trailer-Teaser-Stupid-Greatness-70874.html', 'info_dict': { 'id': '3519514', 'ext': 'mp4', 'title': 'Joe Dirt 2 Beautiful Loser Teaser Trailer', 'thumbnail': 're:^https?://.*\.png$', 'duration': 45.115, }, }, # 5min embed { 'url': 'http://techcrunch.com/video/facebook-creates-on-this-day-crunch-report/518726732/', 'md5': '4c6f127a30736b59b3e2c19234ee2bf7', 'info_dict': { 'id': '518726732', 'ext': 'mp4', 'title': 'Facebook Creates "On This Day" | Crunch Report', }, }, # SVT embed { 'url': 'http://www.svt.se/sport/ishockey/jagr-tacklar-giroux-under-intervjun', 'info_dict': { 'id': '2900353', 'ext': 'flv', 'title': 'Här trycker Jagr till Giroux (under SVT-intervjun)', 'duration': 27, 'age_limit': 0, }, }, # Crooks and Liars embed { 'url': 'http://crooksandliars.com/2015/04/fox-friends-says-protecting-atheists', 'info_dict': { 'id': '8RUoRhRi', 'ext': 'mp4', 'title': "Fox & Friends Says Protecting Atheists From Discrimination Is Anti-Christian!", 'description': 'md5:e1a46ad1650e3a5ec7196d432799127f', 'timestamp': 1428207000, 'upload_date': '20150405', 'uploader': 'Heather', }, }, # Crooks and Liars external embed { 'url': 'http://theothermccain.com/2010/02/02/video-proves-that-bill-kristol-has-been-watching-glenn-beck/comment-page-1/', 'info_dict': { 'id': 'MTE3MjUtMzQ2MzA', 'ext': 'mp4', 'title': 'md5:5e3662a81a4014d24c250d76d41a08d5', 'description': 'md5:9b8e9542d6c3c5de42d6451b7d780cec', 'timestamp': 1265032391, 'upload_date': '20100201', 'uploader': 'Heather', }, }, # NBC Sports vplayer embed { 'url': 'http://www.riderfans.com/forum/showthread.php?121827-Freeman&s=e98fa1ea6dc08e886b1678d35212494a', 'info_dict': { 'id': 'ln7x1qSThw4k', 'ext': 'flv', 'title': "PFT Live: New leader in the 'new-look' defense", 'description': 'md5:65a19b4bbfb3b0c0c5768bed1dfad74e', 'uploader': 'NBCU-SPORTS', 'upload_date': '20140107', 'timestamp': 1389118457, }, }, # NBC News embed { 'url': 'http://www.vulture.com/2016/06/letterman-couldnt-care-less-about-late-night.html', 'md5': '1aa589c675898ae6d37a17913cf68d66', 'info_dict': { 'id': '701714499682', 'ext': 'mp4', 'title': 'PREVIEW: On Assignment: David Letterman', 'description': 'A preview of Tom Brokaw\'s interview with David Letterman as part of the On Assignment series powered by Dateline. Airs Sunday June 12 at 7/6c.', }, }, # UDN embed { 'url': 'https://video.udn.com/news/300346', 'md5': 'fd2060e988c326991037b9aff9df21a6', 'info_dict': { 'id': '300346', 'ext': 'mp4', 'title': '中一中男師變性 全校師生力挺', 'thumbnail': 're:^https?://.*\.jpg$', }, 'params': { # m3u8 download 'skip_download': True, }, }, # Ooyala embed { 'url': 'http://www.businessinsider.com/excel-index-match-vlookup-video-how-to-2015-2?IR=T', 'info_dict': { 'id': '50YnY4czr4ms1vJ7yz3xzq0excz_pUMs', 'ext': 'mp4', 'description': 'VIDEO: INDEX/MATCH versus VLOOKUP.', 'title': 'This is what separates the Excel masters from the wannabes', 'duration': 191.933, }, 'params': { # m3u8 downloads 'skip_download': True, } }, # Brightcove URL in single quotes { 'url': 'http://www.sportsnet.ca/baseball/mlb/sn-presents-russell-martin-world-citizen/', 'md5': '4ae374f1f8b91c889c4b9203c8c752af', 'info_dict': { 'id': '4255764656001', 'ext': 'mp4', 'title': 'SN Presents: Russell Martin, World Citizen', 'description': 'To understand why he was the Toronto Blue Jays’ top off-season priority is to appreciate his background and upbringing in Montreal, where he first developed his baseball skills. Written and narrated by Stephen Brunt.', 'uploader': 'Rogers Sportsnet', 'uploader_id': '1704050871', 'upload_date': '20150525', 'timestamp': 1432570283, }, }, # Dailymotion Cloud video { 'url': 'http://replay.publicsenat.fr/vod/le-debat/florent-kolandjian,dominique-cena,axel-decourtye,laurence-abeille,bruno-parmentier/175910', 'md5': 'dcaf23ad0c67a256f4278bce6e0bae38', 'info_dict': { 'id': 'x2uy8t3', 'ext': 'mp4', 'title': 'Sauvons les abeilles ! - Le débat', 'description': 'md5:d9082128b1c5277987825d684939ca26', 'thumbnail': 're:^https?://.*\.jpe?g$', 'timestamp': 1434970506, 'upload_date': '20150622', 'uploader': 'Public Sénat', 'uploader_id': 'xa9gza', } }, # OnionStudios embed { 'url': 'http://www.clickhole.com/video/dont-understand-bitcoin-man-will-mumble-explanatio-2537', 'info_dict': { 'id': '2855', 'ext': 'mp4', 'title': 'Don’t Understand Bitcoin? This Man Will Mumble An Explanation At You', 'thumbnail': 're:^https?://.*\.jpe?g$', 'uploader': 'ClickHole', 'uploader_id': 'clickhole', } }, # SnagFilms embed { 'url': 'http://whilewewatch.blogspot.ru/2012/06/whilewewatch-whilewewatch-gripping.html', 'info_dict': { 'id': '74849a00-85a9-11e1-9660-123139220831', 'ext': 'mp4', 'title': '#whilewewatch', } }, # AdobeTVVideo embed { 'url': 'https://helpx.adobe.com/acrobat/how-to/new-experience-acrobat-dc.html?set=acrobat--get-started--essential-beginners', 'md5': '43662b577c018ad707a63766462b1e87', 'info_dict': { 'id': '2456', 'ext': 'mp4', 'title': 'New experience with Acrobat DC', 'description': 'New experience with Acrobat DC', 'duration': 248.667, }, }, # ScreenwaveMedia embed { 'url': 'http://www.thecinemasnob.com/the-cinema-snob/a-nightmare-on-elm-street-2-freddys-revenge1', 'md5': '24ace5baba0d35d55c6810b51f34e9e0', 'info_dict': { 'id': 'cinemasnob-55d26273809dd', 'ext': 'mp4', 'title': 'cinemasnob', }, }, # BrightcoveInPageEmbed embed { 'url': 'http://www.geekandsundry.com/tabletop-bonus-wils-final-thoughts-on-dread/', 'info_dict': { 'id': '4238694884001', 'ext': 'flv', 'title': 'Tabletop: Dread, Last Thoughts', 'description': 'Tabletop: Dread, Last Thoughts', 'duration': 51690, }, }, # JWPlayer with M3U8 { 'url': 'http://ren.tv/novosti/2015-09-25/sluchaynyy-prohozhiy-poymal-avtougonshchika-v-murmanske-video', 'info_dict': { 'id': 'playlist', 'ext': 'mp4', 'title': 'Случайный прохожий поймал автоугонщика в Мурманске. ВИДЕО | РЕН ТВ', 'uploader': 'ren.tv', }, 'params': { # m3u8 downloads 'skip_download': True, } }, # Brightcove embed, with no valid 'renditions' but valid 'IOSRenditions' # This video can't be played in browsers if Flash disabled and UA set to iPhone, which is actually a false alarm { 'url': 'https://dl.dropboxusercontent.com/u/29092637/interview.html', 'info_dict': { 'id': '4785848093001', 'ext': 'mp4', 'title': 'The Cardinal Pell Interview', 'description': 'Sky News Contributor Andrew Bolt interviews George Pell in Rome, following the Cardinal\'s evidence before the Royal Commission into Child Abuse. ', 'uploader': 'GlobeCast Australia - GlobeStream', 'uploader_id': '2733773828001', 'upload_date': '20160304', 'timestamp': 1457083087, }, 'params': { # m3u8 downloads 'skip_download': True, }, }, # Another form of arte.tv embed { 'url': 'http://www.tv-replay.fr/redirection/09-04-16/arte-reportage-arte-11508975.html', 'md5': '850bfe45417ddf221288c88a0cffe2e2', 'info_dict': { 'id': '030273-562_PLUS7-F', 'ext': 'mp4', 'title': 'ARTE Reportage - Nulle part, en France', 'description': 'md5:e3a0e8868ed7303ed509b9e3af2b870d', 'upload_date': '20160409', }, }, # LiveLeak embed { 'url': 'http://www.wykop.pl/link/3088787/', 'md5': 'ace83b9ed19b21f68e1b50e844fdf95d', 'info_dict': { 'id': '874_1459135191', 'ext': 'mp4', 'title': 'Man shows poor quality of new apartment building', 'description': 'The wall is like a sand pile.', 'uploader': 'Lake8737', } }, # Duplicated embedded video URLs { 'url': 'http://www.hudl.com/athlete/2538180/highlights/149298443', 'info_dict': { 'id': '149298443_480_16c25b74_2', 'ext': 'mp4', 'title': 'vs. Blue Orange Spring Game', 'uploader': 'www.hudl.com', }, }, # twitter:player:stream embed { 'url': 'http://www.rtl.be/info/video/589263.aspx?CategoryID=288', 'info_dict': { 'id': 'master', 'ext': 'mp4', 'title': 'Une nouvelle espèce de dinosaure découverte en Argentine', 'uploader': 'www.rtl.be', }, 'params': { # m3u8 downloads 'skip_download': True, }, }, # twitter:player embed { 'url': 'http://www.theatlantic.com/video/index/484130/what-do-black-holes-sound-like/', 'md5': 'a3e0df96369831de324f0778e126653c', 'info_dict': { 'id': '4909620399001', 'ext': 'mp4', 'title': 'What Do Black Holes Sound Like?', 'description': 'what do black holes sound like', 'upload_date': '20160524', 'uploader_id': '29913724001', 'timestamp': 1464107587, 'uploader': 'TheAtlantic', }, 'add_ie': ['BrightcoveLegacy'], }, # Facebook <iframe> embed { 'url': 'https://www.hostblogger.de/blog/archives/6181-Auto-jagt-Betonmischer.html', 'md5': 'fbcde74f534176ecb015849146dd3aee', 'info_dict': { 'id': '599637780109885', 'ext': 'mp4', 'title': 'Facebook video #599637780109885', }, }, # Facebook API embed { 'url': 'http://www.lothype.com/blue-stars-2016-preview-standstill-full-show/', 'md5': 'a47372ee61b39a7b90287094d447d94e', 'info_dict': { 'id': '10153467542406923', 'ext': 'mp4', 'title': 'Facebook video #10153467542406923', }, }, # Wordpress "YouTube Video Importer" plugin { 'url': 'http://www.lothype.com/blue-devils-drumline-stanford-lot-2016/', 'md5': 'd16797741b560b485194eddda8121b48', 'info_dict': { 'id': 'HNTXWDXV9Is', 'ext': 'mp4', 'title': 'Blue Devils Drumline Stanford lot 2016', 'upload_date': '20160627', 'uploader_id': 'GENOCIDE8GENERAL10', 'uploader': 'cylus cyrus', }, }, { # video stored on custom kaltura server 'url': 'http://www.expansion.com/multimedia/videos.html?media=EQcM30NHIPv', 'md5': '537617d06e64dfed891fa1593c4b30cc', 'info_dict': { 'id': '0_1iotm5bh', 'ext': 'mp4', 'title': 'Elecciones británicas: 5 lecciones para Rajoy', 'description': 'md5:435a89d68b9760b92ce67ed227055f16', 'uploader_id': 'videos.expansion@el-mundo.net', 'upload_date': '20150429', 'timestamp': 1430303472, }, 'add_ie': ['Kaltura'], }, { # Non-standard Vimeo embed 'url': 'https://openclassrooms.com/courses/understanding-the-web', 'md5': '64d86f1c7d369afd9a78b38cbb88d80a', 'info_dict': { 'id': '148867247', 'ext': 'mp4', 'title': 'Understanding the web - Teaser', 'description': 'This is "Understanding the web - Teaser" by openclassrooms on Vimeo, the home for high quality videos and the people who love them.', 'upload_date': '20151214', 'uploader': 'OpenClassrooms', 'uploader_id': 'openclassrooms', }, 'add_ie': ['Vimeo'], }, { 'url': 'https://support.arkena.com/display/PLAY/Ways+to+embed+your+video', 'md5': 'b96f2f71b359a8ecd05ce4e1daa72365', 'info_dict': { 'id': 'b41dda37-d8e7-4d3f-b1b5-9a9db578bdfe', 'ext': 'mp4', 'title': 'Big Buck Bunny', 'description': 'Royalty free test video', 'timestamp': 1432816365, 'upload_date': '20150528', 'is_live': False, }, 'params': { 'skip_download': True, }, 'add_ie': [ArkenaIE.ie_key()], }, { 'url': 'http://nova.bg/news/view/2016/08/16/156543/%D0%BD%D0%B0-%D0%BA%D0%BE%D1%81%D1%8A%D0%BC-%D0%BE%D1%82-%D0%B2%D0%B7%D1%80%D0%B8%D0%B2-%D0%BE%D1%82%D1%86%D0%B5%D0%BF%D0%B8%D1%85%D0%B0-%D1%86%D1%8F%D0%BB-%D0%BA%D0%B2%D0%B0%D1%80%D1%82%D0%B0%D0%BB-%D0%B7%D0%B0%D1%80%D0%B0%D0%B4%D0%B8-%D0%B8%D0%B7%D1%82%D0%B8%D1%87%D0%B0%D0%BD%D0%B5-%D0%BD%D0%B0-%D0%B3%D0%B0%D0%B7-%D0%B2-%D0%BF%D0%BB%D0%BE%D0%B2%D0%B4%D0%B8%D0%B2/', 'info_dict': { 'id': '1c7141f46c', 'ext': 'mp4', 'title': 'НА КОСЪМ ОТ ВЗРИВ: Изтичане на газ на бензиностанция в Пловдив', }, 'params': { 'skip_download': True, }, 'add_ie': [Vbox7IE.ie_key()], }, # { # # TODO: find another test # # http://schema.org/VideoObject # 'url': 'https://flipagram.com/f/nyvTSJMKId', # 'md5': '888dcf08b7ea671381f00fab74692755', # 'info_dict': { # 'id': 'nyvTSJMKId', # 'ext': 'mp4', # 'title': 'Flipagram by sjuria101 featuring Midnight Memories by One Direction', # 'description': '#love for cats.', # 'timestamp': 1461244995, # 'upload_date': '20160421', # }, # 'params': { # 'force_generic_extractor': True, # }, # } ] def report_following_redirect(self, new_url): """Report information extraction.""" self._downloader.to_screen('[redirect] Following redirect to %s' % new_url) def _extract_rss(self, url, video_id, doc): playlist_title = doc.find('./channel/title').text playlist_desc_el = doc.find('./channel/description') playlist_desc = None if playlist_desc_el is None else playlist_desc_el.text entries = [] for it in doc.findall('./channel/item'): next_url = xpath_text(it, 'link', fatal=False) if not next_url: enclosure_nodes = it.findall('./enclosure') for e in enclosure_nodes: next_url = e.attrib.get('url') if next_url: break if not next_url: continue entries.append({ '_type': 'url', 'url': next_url, 'title': it.find('title').text, }) return { '_type': 'playlist', 'id': url, 'title': playlist_title, 'description': playlist_desc, 'entries': entries, } def _extract_camtasia(self, url, video_id, webpage): """ Returns None if no camtasia video can be found. """ camtasia_cfg = self._search_regex( r'fo\.addVariable\(\s*"csConfigFile",\s*"([^"]+)"\s*\);', webpage, 'camtasia configuration file', default=None) if camtasia_cfg is None: return None title = self._html_search_meta('DC.title', webpage, fatal=True) camtasia_url = compat_urlparse.urljoin(url, camtasia_cfg) camtasia_cfg = self._download_xml( camtasia_url, video_id, note='Downloading camtasia configuration', errnote='Failed to download camtasia configuration') fileset_node = camtasia_cfg.find('./playlist/array/fileset') entries = [] for n in fileset_node.getchildren(): url_n = n.find('./uri') if url_n is None: continue entries.append({ 'id': os.path.splitext(url_n.text.rpartition('/')[2])[0], 'title': '%s - %s' % (title, n.tag), 'url': compat_urlparse.urljoin(url, url_n.text), 'duration': float_or_none(n.find('./duration').text), }) return { '_type': 'playlist', 'entries': entries, 'title': title, } def _real_extract(self, url): if url.startswith('//'): return { '_type': 'url', 'url': self.http_scheme() + url, } parsed_url = compat_urlparse.urlparse(url) if not parsed_url.scheme: default_search = self._downloader.params.get('default_search') if default_search is None: default_search = 'fixup_error' if default_search in ('auto', 'auto_warning', 'fixup_error'): if '/' in url: self._downloader.report_warning('The url doesn\'t specify the protocol, trying with http') return self.url_result('http://' + url) elif default_search != 'fixup_error': if default_search == 'auto_warning': if re.match(r'^(?:url|URL)$', url): raise ExtractorError( 'Invalid URL: %r . Call youtube-dl like this: youtube-dl -v "https://www.youtube.com/watch?v=BaW_jenozKc" ' % url, expected=True) else: self._downloader.report_warning( 'Falling back to youtube search for %s . Set --default-search "auto" to suppress this warning.' % url) return self.url_result('ytsearch:' + url) if default_search in ('error', 'fixup_error'): raise ExtractorError( '%r is not a valid URL. ' 'Set --default-search "ytsearch" (or run youtube-dl "ytsearch:%s" ) to search YouTube' % (url, url), expected=True) else: if ':' not in default_search: default_search += ':' return self.url_result(default_search + url) url, smuggled_data = unsmuggle_url(url) force_videoid = None is_intentional = smuggled_data and smuggled_data.get('to_generic') if smuggled_data and 'force_videoid' in smuggled_data: force_videoid = smuggled_data['force_videoid'] video_id = force_videoid else: video_id = compat_urllib_parse_unquote(os.path.splitext(url.rstrip('/').split('/')[-1])[0]) self.to_screen('%s: Requesting header' % video_id) head_req = HEADRequest(url) head_response = self._request_webpage( head_req, video_id, note=False, errnote='Could not send HEAD request to %s' % url, fatal=False) if head_response is not False: # Check for redirect new_url = head_response.geturl() if url != new_url: self.report_following_redirect(new_url) if force_videoid: new_url = smuggle_url( new_url, {'force_videoid': force_videoid}) return self.url_result(new_url) full_response = None if head_response is False: request = sanitized_Request(url) request.add_header('Accept-Encoding', '*') full_response = self._request_webpage(request, video_id) head_response = full_response info_dict = { 'id': video_id, 'title': compat_urllib_parse_unquote(os.path.splitext(url_basename(url))[0]), 'upload_date': unified_strdate(head_response.headers.get('Last-Modified')) } # Check for direct link to a video content_type = head_response.headers.get('Content-Type', '').lower() m = re.match(r'^(?P<type>audio|video|application(?=/(?:ogg$|(?:vnd\.apple\.|x-)?mpegurl)))/(?P<format_id>[^;\s]+)', content_type) if m: format_id = m.group('format_id') if format_id.endswith('mpegurl'): formats = self._extract_m3u8_formats(url, video_id, 'mp4') elif format_id == 'f4m': formats = self._extract_f4m_formats(url, video_id) else: formats = [{ 'format_id': m.group('format_id'), 'url': url, 'vcodec': 'none' if m.group('type') == 'audio' else None }] info_dict['direct'] = True self._sort_formats(formats) info_dict['formats'] = formats return info_dict if not self._downloader.params.get('test', False) and not is_intentional: force = self._downloader.params.get('force_generic_extractor', False) self._downloader.report_warning( '%s on generic information extractor.' % ('Forcing' if force else 'Falling back')) if not full_response: request = sanitized_Request(url) # Some webservers may serve compressed content of rather big size (e.g. gzipped flac) # making it impossible to download only chunk of the file (yet we need only 512kB to # test whether it's HTML or not). According to youtube-dl default Accept-Encoding # that will always result in downloading the whole file that is not desirable. # Therefore for extraction pass we have to override Accept-Encoding to any in order # to accept raw bytes and being able to download only a chunk. # It may probably better to solve this by checking Content-Type for application/octet-stream # after HEAD request finishes, but not sure if we can rely on this. request.add_header('Accept-Encoding', '*') full_response = self._request_webpage(request, video_id) first_bytes = full_response.read(512) # Is it an M3U playlist? if first_bytes.startswith(b'#EXTM3U'): info_dict['formats'] = self._extract_m3u8_formats(url, video_id, 'mp4') self._sort_formats(info_dict['formats']) return info_dict # Maybe it's a direct link to a video? # Be careful not to download the whole thing! if not is_html(first_bytes): self._downloader.report_warning( 'URL could be a direct video link, returning it as such.') info_dict.update({ 'direct': True, 'url': url, }) return info_dict webpage = self._webpage_read_content( full_response, url, video_id, prefix=first_bytes) self.report_extraction(video_id) # Is it an RSS feed, a SMIL file, an XSPF playlist or a MPD manifest? try: doc = compat_etree_fromstring(webpage.encode('utf-8')) if doc.tag == 'rss': return self._extract_rss(url, video_id, doc) elif re.match(r'^(?:{[^}]+})?smil$', doc.tag): smil = self._parse_smil(doc, url, video_id) self._sort_formats(smil['formats']) return smil elif doc.tag == '{http://xspf.org/ns/0/}playlist': return self.playlist_result(self._parse_xspf(doc, video_id), video_id) elif re.match(r'(?i)^(?:{[^}]+})?MPD$', doc.tag): info_dict['formats'] = self._parse_mpd_formats( doc, video_id, mpd_base_url=url.rpartition('/')[0]) self._sort_formats(info_dict['formats']) return info_dict elif re.match(r'^{http://ns\.adobe\.com/f4m/[12]\.0}manifest$', doc.tag): info_dict['formats'] = self._parse_f4m_formats(doc, url, video_id) self._sort_formats(info_dict['formats']) return info_dict except compat_xml_parse_error: pass # Is it a Camtasia project? camtasia_res = self._extract_camtasia(url, video_id, webpage) if camtasia_res is not None: return camtasia_res # Sometimes embedded video player is hidden behind percent encoding # (e.g. https://github.com/rg3/youtube-dl/issues/2448) # Unescaping the whole page allows to handle those cases in a generic way webpage = compat_urllib_parse_unquote(webpage) # it's tempting to parse this further, but you would # have to take into account all the variations like # Video Title - Site Name # Site Name | Video Title # Video Title - Tagline | Site Name # and so on and so forth; it's just not practical video_title = self._og_search_title( webpage, default=None) or self._html_search_regex( r'(?s)<title>(.*?)</title>', webpage, 'video title', default='video') # Try to detect age limit automatically age_limit = self._rta_search(webpage) # And then there are the jokers who advertise that they use RTA, # but actually don't. AGE_LIMIT_MARKERS = [ r'Proudly Labeled <a href="http://www.rtalabel.org/" title="Restricted to Adults">RTA</a>', ] if any(re.search(marker, webpage) for marker in AGE_LIMIT_MARKERS): age_limit = 18 # video uploader is domain name video_uploader = self._search_regex( r'^(?:https?://)?([^/]*)/.*', url, 'video uploader') video_description = self._og_search_description(webpage, default=None) video_thumbnail = self._og_search_thumbnail(webpage, default=None) # Helper method def _playlist_from_matches(matches, getter=None, ie=None): urlrs = orderedSet( self.url_result(self._proto_relative_url(getter(m) if getter else m), ie) for m in matches) return self.playlist_result( urlrs, playlist_id=video_id, playlist_title=video_title) # Look for Brightcove Legacy Studio embeds bc_urls = BrightcoveLegacyIE._extract_brightcove_urls(webpage) if bc_urls: self.to_screen('Brightcove video detected.') entries = [{ '_type': 'url', 'url': smuggle_url(bc_url, {'Referer': url}), 'ie_key': 'BrightcoveLegacy' } for bc_url in bc_urls] return { '_type': 'playlist', 'title': video_title, 'id': video_id, 'entries': entries, } # Look for Brightcove New Studio embeds bc_urls = BrightcoveNewIE._extract_urls(webpage) if bc_urls: return _playlist_from_matches(bc_urls, ie='BrightcoveNew') # Look for ThePlatform embeds tp_urls = ThePlatformIE._extract_urls(webpage) if tp_urls: return _playlist_from_matches(tp_urls, ie='ThePlatform') # Look for Vessel embeds vessel_urls = VesselIE._extract_urls(webpage) if vessel_urls: return _playlist_from_matches(vessel_urls, ie=VesselIE.ie_key()) # Look for embedded rtl.nl player matches = re.findall( r'<iframe[^>]+?src="((?:https?:)?//(?:www\.)?rtl\.nl/system/videoplayer/[^"]+(?:video_)?embed[^"]+)"', webpage) if matches: return _playlist_from_matches(matches, ie='RtlNl') vimeo_url = VimeoIE._extract_vimeo_url(url, webpage) if vimeo_url is not None: return self.url_result(vimeo_url) vid_me_embed_url = self._search_regex( r'src=[\'"](https?://vid\.me/[^\'"]+)[\'"]', webpage, 'vid.me embed', default=None) if vid_me_embed_url is not None: return self.url_result(vid_me_embed_url, 'Vidme') # Look for embedded YouTube player matches = re.findall(r'''(?x) (?: <iframe[^>]+?src=| data-video-url=| <embed[^>]+?src=| embedSWF\(?:\s*| new\s+SWFObject\( ) (["\']) (?P<url>(?:https?:)?//(?:www\.)?youtube(?:-nocookie)?\.com/ (?:embed|v|p)/.+?) \1''', webpage) if matches: return _playlist_from_matches( matches, lambda m: unescapeHTML(m[1])) # Look for lazyYT YouTube embed matches = re.findall( r'class="lazyYT" data-youtube-id="([^"]+)"', webpage) if matches: return _playlist_from_matches(matches, lambda m: unescapeHTML(m)) # Look for Wordpress "YouTube Video Importer" plugin matches = re.findall(r'''(?x)<div[^>]+ class=(?P<q1>[\'"])[^\'"]*\byvii_single_video_player\b[^\'"]*(?P=q1)[^>]+ data-video_id=(?P<q2>[\'"])([^\'"]+)(?P=q2)''', webpage) if matches: return _playlist_from_matches(matches, lambda m: m[-1]) matches = DailymotionIE._extract_urls(webpage) if matches: return _playlist_from_matches(matches) # Look for embedded Dailymotion playlist player (#3822) m = re.search( r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?dailymotion\.[a-z]{2,3}/widget/jukebox\?.+?)\1', webpage) if m: playlists = re.findall( r'list\[\]=/playlist/([^/]+)/', unescapeHTML(m.group('url'))) if playlists: return _playlist_from_matches( playlists, lambda p: '//dailymotion.com/playlist/%s' % p) # Look for embedded Wistia player match = re.search( r'<(?:meta[^>]+?content|iframe[^>]+?src)=(["\'])(?P<url>(?:https?:)?//(?:fast\.)?wistia\.net/embed/iframe/.+?)\1', webpage) if match: embed_url = self._proto_relative_url( unescapeHTML(match.group('url'))) return { '_type': 'url_transparent', 'url': embed_url, 'ie_key': 'Wistia', 'uploader': video_uploader, } match = re.search(r'(?:id=["\']wistia_|data-wistia-?id=["\']|Wistia\.embed\(["\'])(?P<id>[^"\']+)', webpage) if match: return { '_type': 'url_transparent', 'url': 'wistia:%s' % match.group('id'), 'ie_key': 'Wistia', 'uploader': video_uploader, } match = re.search( r'''(?sx) <script[^>]+src=(["'])(?:https?:)?//fast\.wistia\.com/assets/external/E-v1\.js\1[^>]*>.*? <div[^>]+class=(["']).*?\bwistia_async_(?P<id>[a-z0-9]+)\b.*?\2 ''', webpage) if match: return self.url_result(self._proto_relative_url( 'wistia:%s' % match.group('id')), 'Wistia') # Look for SVT player svt_url = SVTIE._extract_url(webpage) if svt_url: return self.url_result(svt_url, 'SVT') # Look for embedded condenast player matches = re.findall( r'<iframe\s+(?:[a-zA-Z-]+="[^"]+"\s+)*?src="(https?://player\.cnevids\.com/embed/[^"]+")', webpage) if matches: return { '_type': 'playlist', 'entries': [{ '_type': 'url', 'ie_key': 'CondeNast', 'url': ma, } for ma in matches], 'title': video_title, 'id': video_id, } # Look for Bandcamp pages with custom domain mobj = re.search(r'<meta property="og:url"[^>]*?content="(.*?bandcamp\.com.*?)"', webpage) if mobj is not None: burl = unescapeHTML(mobj.group(1)) # Don't set the extractor because it can be a track url or an album return self.url_result(burl) # Look for embedded Vevo player mobj = re.search( r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:cache\.)?vevo\.com/.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url')) # Look for embedded Viddler player mobj = re.search( r'<(?:iframe[^>]+?src|param[^>]+?value)=(["\'])(?P<url>(?:https?:)?//(?:www\.)?viddler\.com/(?:embed|player)/.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url')) # Look for NYTimes player mobj = re.search( r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//graphics8\.nytimes\.com/bcvideo/[^/]+/iframe/embed\.html.+?)\1>', webpage) if mobj is not None: return self.url_result(mobj.group('url')) # Look for Libsyn player mobj = re.search( r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//html5-player\.libsyn\.com/embed/.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url')) # Look for Ooyala videos mobj = (re.search(r'player\.ooyala\.com/[^"?]+[?#][^"]*?(?:embedCode|ec)=(?P<ec>[^"&]+)', webpage) or re.search(r'OO\.Player\.create\([\'"].*?[\'"],\s*[\'"](?P<ec>.{32})[\'"]', webpage) or re.search(r'SBN\.VideoLinkset\.ooyala\([\'"](?P<ec>.{32})[\'"]\)', webpage) or re.search(r'data-ooyala-video-id\s*=\s*[\'"](?P<ec>.{32})[\'"]', webpage)) if mobj is not None: return OoyalaIE._build_url_result(smuggle_url(mobj.group('ec'), {'domain': url})) # Look for multiple Ooyala embeds on SBN network websites mobj = re.search(r'SBN\.VideoLinkset\.entryGroup\((\[.*?\])', webpage) if mobj is not None: embeds = self._parse_json(mobj.group(1), video_id, fatal=False) if embeds: return _playlist_from_matches( embeds, getter=lambda v: OoyalaIE._url_for_embed_code(smuggle_url(v['provider_video_id'], {'domain': url})), ie='Ooyala') # Look for Aparat videos mobj = re.search(r'<iframe .*?src="(http://www\.aparat\.com/video/[^"]+)"', webpage) if mobj is not None: return self.url_result(mobj.group(1), 'Aparat') # Look for MPORA videos mobj = re.search(r'<iframe .*?src="(http://mpora\.(?:com|de)/videos/[^"]+)"', webpage) if mobj is not None: return self.url_result(mobj.group(1), 'Mpora') # Look for embedded NovaMov-based player mobj = re.search( r'''(?x)<(?:pagespeed_)?iframe[^>]+?src=(["\']) (?P<url>http://(?:(?:embed|www)\.)? (?:novamov\.com| nowvideo\.(?:ch|sx|eu|at|ag|co)| videoweed\.(?:es|com)| movshare\.(?:net|sx|ag)| divxstage\.(?:eu|net|ch|co|at|ag)) /embed\.php.+?)\1''', webpage) if mobj is not None: return self.url_result(mobj.group('url')) # Look for embedded Facebook player facebook_url = FacebookIE._extract_url(webpage) if facebook_url is not None: return self.url_result(facebook_url, 'Facebook') # Look for embedded VK player mobj = re.search(r'<iframe[^>]+?src=(["\'])(?P<url>https?://vk\.com/video_ext\.php.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'VK') # Look for embedded Odnoklassniki player mobj = re.search(r'<iframe[^>]+?src=(["\'])(?P<url>https?://(?:odnoklassniki|ok)\.ru/videoembed/.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'Odnoklassniki') # Look for embedded ivi player mobj = re.search(r'<embed[^>]+?src=(["\'])(?P<url>https?://(?:www\.)?ivi\.ru/video/player.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'Ivi') # Look for embedded Huffington Post player mobj = re.search( r'<iframe[^>]+?src=(["\'])(?P<url>https?://embed\.live\.huffingtonpost\.com/.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'HuffPost') # Look for embed.ly mobj = re.search(r'class=["\']embedly-card["\'][^>]href=["\'](?P<url>[^"\']+)', webpage) if mobj is not None: return self.url_result(mobj.group('url')) mobj = re.search(r'class=["\']embedly-embed["\'][^>]src=["\'][^"\']*url=(?P<url>[^&]+)', webpage) if mobj is not None: return self.url_result(compat_urllib_parse_unquote(mobj.group('url'))) # Look for funnyordie embed matches = re.findall(r'<iframe[^>]+?src="(https?://(?:www\.)?funnyordie\.com/embed/[^"]+)"', webpage) if matches: return _playlist_from_matches( matches, getter=unescapeHTML, ie='FunnyOrDie') # Look for BBC iPlayer embed matches = re.findall(r'setPlaylist\("(https?://www\.bbc\.co\.uk/iplayer/[^/]+/[\da-z]{8})"\)', webpage) if matches: return _playlist_from_matches(matches, ie='BBCCoUk') # Look for embedded RUTV player rutv_url = RUTVIE._extract_url(webpage) if rutv_url: return self.url_result(rutv_url, 'RUTV') # Look for embedded TVC player tvc_url = TVCIE._extract_url(webpage) if tvc_url: return self.url_result(tvc_url, 'TVC') # Look for embedded SportBox player sportbox_urls = SportBoxEmbedIE._extract_urls(webpage) if sportbox_urls: return _playlist_from_matches(sportbox_urls, ie='SportBoxEmbed') # Look for embedded PornHub player pornhub_url = PornHubIE._extract_url(webpage) if pornhub_url: return self.url_result(pornhub_url, 'PornHub') # Look for embedded XHamster player xhamster_urls = XHamsterEmbedIE._extract_urls(webpage) if xhamster_urls: return _playlist_from_matches(xhamster_urls, ie='XHamsterEmbed') # Look for embedded TNAFlixNetwork player tnaflix_urls = TNAFlixNetworkEmbedIE._extract_urls(webpage) if tnaflix_urls: return _playlist_from_matches(tnaflix_urls, ie=TNAFlixNetworkEmbedIE.ie_key()) # Look for embedded Tvigle player mobj = re.search( r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//cloud\.tvigle\.ru/video/.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'Tvigle') # Look for embedded TED player mobj = re.search( r'<iframe[^>]+?src=(["\'])(?P<url>https?://embed(?:-ssl)?\.ted\.com/.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'TED') # Look for embedded Ustream videos mobj = re.search( r'<iframe[^>]+?src=(["\'])(?P<url>http://www\.ustream\.tv/embed/.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'Ustream') # Look for embedded arte.tv player mobj = re.search( r'<(?:script|iframe) [^>]*?src="(?P<url>http://www\.arte\.tv/(?:playerv2/embed|arte_vp/index)[^"]+)"', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'ArteTVEmbed') # Look for embedded francetv player mobj = re.search( r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?://)?embed\.francetv\.fr/\?ue=.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url')) # Look for embedded smotri.com player smotri_url = SmotriIE._extract_url(webpage) if smotri_url: return self.url_result(smotri_url, 'Smotri') # Look for embedded Myvi.ru player myvi_url = MyviIE._extract_url(webpage) if myvi_url: return self.url_result(myvi_url) # Look for embedded soundcloud player soundcloud_urls = SoundcloudIE._extract_urls(webpage) if soundcloud_urls: return _playlist_from_matches(soundcloud_urls, getter=unescapeHTML, ie=SoundcloudIE.ie_key()) # Look for embedded mtvservices player mtvservices_url = MTVServicesEmbeddedIE._extract_url(webpage) if mtvservices_url: return self.url_result(mtvservices_url, ie='MTVServicesEmbedded') # Look for embedded yahoo player mobj = re.search( r'<iframe[^>]+?src=(["\'])(?P<url>https?://(?:screen|movies)\.yahoo\.com/.+?\.html\?format=embed)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'Yahoo') # Look for embedded sbs.com.au player mobj = re.search( r'''(?x) (?: <meta\s+property="og:video"\s+content=| <iframe[^>]+?src= ) (["\'])(?P<url>https?://(?:www\.)?sbs\.com\.au/ondemand/video/.+?)\1''', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'SBS') # Look for embedded Cinchcast player mobj = re.search( r'<iframe[^>]+?src=(["\'])(?P<url>https?://player\.cinchcast\.com/.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'Cinchcast') mobj = re.search( r'<iframe[^>]+?src=(["\'])(?P<url>https?://m(?:lb)?\.mlb\.com/shared/video/embed/embed\.html\?.+?)\1', webpage) if not mobj: mobj = re.search( r'data-video-link=["\'](?P<url>http://m.mlb.com/video/[^"\']+)', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'MLB') mobj = re.search( r'<(?:iframe|script)[^>]+?src=(["\'])(?P<url>%s)\1' % CondeNastIE.EMBED_URL, webpage) if mobj is not None: return self.url_result(self._proto_relative_url(mobj.group('url'), scheme='http:'), 'CondeNast') mobj = re.search( r'<iframe[^>]+src="(?P<url>https?://(?:new\.)?livestream\.com/[^"]+/player[^"]+)"', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'Livestream') # Look for Zapiks embed mobj = re.search( r'<iframe[^>]+src="(?P<url>https?://(?:www\.)?zapiks\.fr/index\.php\?.+?)"', webpage) if mobj is not None: return self.url_result(mobj.group('url'), 'Zapiks') # Look for Kaltura embeds kaltura_url = KalturaIE._extract_url(webpage) if kaltura_url: return self.url_result(smuggle_url(kaltura_url, {'source_url': url}), KalturaIE.ie_key()) # Look for Eagle.Platform embeds eagleplatform_url = EaglePlatformIE._extract_url(webpage) if eagleplatform_url: return self.url_result(eagleplatform_url, EaglePlatformIE.ie_key()) # Look for ClipYou (uses Eagle.Platform) embeds mobj = re.search( r'<iframe[^>]+src="https?://(?P<host>media\.clipyou\.ru)/index/player\?.*\brecord_id=(?P<id>\d+).*"', webpage) if mobj is not None: return self.url_result('eagleplatform:%(host)s:%(id)s' % mobj.groupdict(), 'EaglePlatform') # Look for Pladform embeds pladform_url = PladformIE._extract_url(webpage) if pladform_url: return self.url_result(pladform_url) # Look for Videomore embeds videomore_url = VideomoreIE._extract_url(webpage) if videomore_url: return self.url_result(videomore_url) # Look for Playwire embeds mobj = re.search( r'<script[^>]+data-config=(["\'])(?P<url>(?:https?:)?//config\.playwire\.com/.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url')) # Look for 5min embeds mobj = re.search( r'<meta[^>]+property="og:video"[^>]+content="https?://embed\.5min\.com/(?P<id>[0-9]+)/?', webpage) if mobj is not None: return self.url_result('5min:%s' % mobj.group('id'), 'FiveMin') # Look for Crooks and Liars embeds mobj = re.search( r'<(?:iframe[^>]+src|param[^>]+value)=(["\'])(?P<url>(?:https?:)?//embed\.crooksandliars\.com/(?:embed|v)/.+?)\1', webpage) if mobj is not None: return self.url_result(mobj.group('url')) # Look for NBC Sports VPlayer embeds nbc_sports_url = NBCSportsVPlayerIE._extract_url(webpage) if nbc_sports_url: return self.url_result(nbc_sports_url, 'NBCSportsVPlayer') # Look for NBC News embeds nbc_news_embed_url = re.search( r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//www\.nbcnews\.com/widget/video-embed/[^"\']+)\1', webpage) if nbc_news_embed_url: return self.url_result(nbc_news_embed_url.group('url'), 'NBCNews') # Look for Google Drive embeds google_drive_url = GoogleDriveIE._extract_url(webpage) if google_drive_url: return self.url_result(google_drive_url, 'GoogleDrive') # Look for UDN embeds mobj = re.search( r'<iframe[^>]+src="(?P<url>%s)"' % UDNEmbedIE._PROTOCOL_RELATIVE_VALID_URL, webpage) if mobj is not None: return self.url_result( compat_urlparse.urljoin(url, mobj.group('url')), 'UDNEmbed') # Look for Senate ISVP iframe senate_isvp_url = SenateISVPIE._search_iframe_url(webpage) if senate_isvp_url: return self.url_result(senate_isvp_url, 'SenateISVP') # Look for Dailymotion Cloud videos dmcloud_url = DailymotionCloudIE._extract_dmcloud_url(webpage) if dmcloud_url: return self.url_result(dmcloud_url, 'DailymotionCloud') # Look for OnionStudios embeds onionstudios_url = OnionStudiosIE._extract_url(webpage) if onionstudios_url: return self.url_result(onionstudios_url) # Look for ViewLift embeds viewlift_url = ViewLiftEmbedIE._extract_url(webpage) if viewlift_url: return self.url_result(viewlift_url) # Look for JWPlatform embeds jwplatform_url = JWPlatformIE._extract_url(webpage) if jwplatform_url: return self.url_result(jwplatform_url, 'JWPlatform') # Look for ScreenwaveMedia embeds mobj = re.search(ScreenwaveMediaIE.EMBED_PATTERN, webpage) if mobj is not None: return self.url_result(unescapeHTML(mobj.group('url')), 'ScreenwaveMedia') # Look for Digiteka embeds digiteka_url = DigitekaIE._extract_url(webpage) if digiteka_url: return self.url_result(self._proto_relative_url(digiteka_url), DigitekaIE.ie_key()) # Look for Arkena embeds arkena_url = ArkenaIE._extract_url(webpage) if arkena_url: return self.url_result(arkena_url, ArkenaIE.ie_key()) # Look for Limelight embeds mobj = re.search(r'LimelightPlayer\.doLoad(Media|Channel|ChannelList)\(["\'](?P<id>[a-z0-9]{32})', webpage) if mobj: lm = { 'Media': 'media', 'Channel': 'channel', 'ChannelList': 'channel_list', } return self.url_result('limelight:%s:%s' % ( lm[mobj.group(1)], mobj.group(2)), 'Limelight%s' % mobj.group(1), mobj.group(2)) # Look for AdobeTVVideo embeds mobj = re.search( r'<iframe[^>]+src=[\'"]((?:https?:)?//video\.tv\.adobe\.com/v/\d+[^"]+)[\'"]', webpage) if mobj is not None: return self.url_result( self._proto_relative_url(unescapeHTML(mobj.group(1))), 'AdobeTVVideo') # Look for Vine embeds mobj = re.search( r'<iframe[^>]+src=[\'"]((?:https?:)?//(?:www\.)?vine\.co/v/[^/]+/embed/(?:simple|postcard))', webpage) if mobj is not None: return self.url_result( self._proto_relative_url(unescapeHTML(mobj.group(1))), 'Vine') # Look for VODPlatform embeds mobj = re.search( r'<iframe[^>]+src=[\'"]((?:https?:)?//(?:www\.)?vod-platform\.net/embed/[^/?#]+)', webpage) if mobj is not None: return self.url_result( self._proto_relative_url(unescapeHTML(mobj.group(1))), 'VODPlatform') # Look for Instagram embeds instagram_embed_url = InstagramIE._extract_embed_url(webpage) if instagram_embed_url is not None: return self.url_result( self._proto_relative_url(instagram_embed_url), InstagramIE.ie_key()) # Look for LiveLeak embeds liveleak_url = LiveLeakIE._extract_url(webpage) if liveleak_url: return self.url_result(liveleak_url, 'LiveLeak') # Look for 3Q SDN embeds threeqsdn_url = ThreeQSDNIE._extract_url(webpage) if threeqsdn_url: return { '_type': 'url_transparent', 'ie_key': ThreeQSDNIE.ie_key(), 'url': self._proto_relative_url(threeqsdn_url), 'title': video_title, 'description': video_description, 'thumbnail': video_thumbnail, 'uploader': video_uploader, } # Look for VBOX7 embeds vbox7_url = Vbox7IE._extract_url(webpage) if vbox7_url: return self.url_result(vbox7_url, Vbox7IE.ie_key()) # Looking for http://schema.org/VideoObject json_ld = self._search_json_ld( webpage, video_id, default={}, expected_type='VideoObject') if json_ld.get('url'): info_dict.update({ 'title': video_title or info_dict['title'], 'description': video_description, 'thumbnail': video_thumbnail, 'age_limit': age_limit }) info_dict.update(json_ld) return info_dict def check_video(vurl): if YoutubeIE.suitable(vurl): return True vpath = compat_urlparse.urlparse(vurl).path vext = determine_ext(vpath) return '.' in vpath and vext not in ('swf', 'png', 'jpg', 'srt', 'sbv', 'sub', 'vtt', 'ttml') def filter_video(urls): return list(filter(check_video, urls)) # Start with something easy: JW Player in SWFObject found = filter_video(re.findall(r'flashvars: [\'"](?:.*&)?file=(http[^\'"&]*)', webpage)) if not found: # Look for gorilla-vid style embedding found = filter_video(re.findall(r'''(?sx) (?: jw_plugins| JWPlayerOptions| jwplayer\s*\(\s*["'][^'"]+["']\s*\)\s*\.setup ) .*? ['"]?file['"]?\s*:\s*["\'](.*?)["\']''', webpage)) if not found: # Broaden the search a little bit found = filter_video(re.findall(r'[^A-Za-z0-9]?(?:file|source)=(http[^\'"&]*)', webpage)) if not found: # Broaden the findall a little bit: JWPlayer JS loader found = filter_video(re.findall( r'[^A-Za-z0-9]?(?:file|video_url)["\']?:\s*["\'](http(?![^\'"]+\.[0-9]+[\'"])[^\'"]+)["\']', webpage)) if not found: # Flow player found = filter_video(re.findall(r'''(?xs) flowplayer\("[^"]+",\s* \{[^}]+?\}\s*, \s*\{[^}]+? ["']?clip["']?\s*:\s*\{\s* ["']?url["']?\s*:\s*["']([^"']+)["'] ''', webpage)) if not found: # Cinerama player found = re.findall( r"cinerama\.embedPlayer\(\s*\'[^']+\',\s*'([^']+)'", webpage) if not found: # Try to find twitter cards info # twitter:player:stream should be checked before twitter:player since # it is expected to contain a raw stream (see # https://dev.twitter.com/cards/types/player#On_twitter.com_via_desktop_browser) found = filter_video(re.findall( r'<meta (?:property|name)="twitter:player:stream" (?:content|value)="(.+?)"', webpage)) if not found: # We look for Open Graph info: # We have to match any number spaces between elements, some sites try to align them (eg.: statigr.am) m_video_type = re.findall(r'<meta.*?property="og:video:type".*?content="video/(.*?)"', webpage) # We only look in og:video if the MIME type is a video, don't try if it's a Flash player: if m_video_type is not None: found = filter_video(re.findall(r'<meta.*?property="og:video".*?content="(.*?)"', webpage)) if not found: # HTML5 video found = re.findall(r'(?s)<(?:video|audio)[^<]*(?:>.*?<source[^>]*)?\s+src=["\'](.*?)["\']', webpage) if not found: REDIRECT_REGEX = r'[0-9]{,2};\s*(?:URL|url)=\'?([^\'"]+)' found = re.search( r'(?i)<meta\s+(?=(?:[a-z-]+="[^"]+"\s+)*http-equiv="refresh")' r'(?:[a-z-]+="[^"]+"\s+)*?content="%s' % REDIRECT_REGEX, webpage) if not found: # Look also in Refresh HTTP header refresh_header = head_response.headers.get('Refresh') if refresh_header: # In python 2 response HTTP headers are bytestrings if sys.version_info < (3, 0) and isinstance(refresh_header, str): refresh_header = refresh_header.decode('iso-8859-1') found = re.search(REDIRECT_REGEX, refresh_header) if found: new_url = compat_urlparse.urljoin(url, unescapeHTML(found.group(1))) self.report_following_redirect(new_url) return { '_type': 'url', 'url': new_url, } if not found: # twitter:player is a https URL to iframe player that may or may not # be supported by youtube-dl thus this is checked the very last (see # https://dev.twitter.com/cards/types/player#On_twitter.com_via_desktop_browser) embed_url = self._html_search_meta('twitter:player', webpage, default=None) if embed_url: return self.url_result(embed_url) if not found: raise UnsupportedError(url) entries = [] for video_url in orderedSet(found): video_url = unescapeHTML(video_url) video_url = video_url.replace('\\/', '/') video_url = compat_urlparse.urljoin(url, video_url) video_id = compat_urllib_parse_unquote(os.path.basename(video_url)) # Sometimes, jwplayer extraction will result in a YouTube URL if YoutubeIE.suitable(video_url): entries.append(self.url_result(video_url, 'Youtube')) continue # here's a fun little line of code for you: video_id = os.path.splitext(video_id)[0] entry_info_dict = { 'id': video_id, 'uploader': video_uploader, 'title': video_title, 'age_limit': age_limit, } ext = determine_ext(video_url) if ext == 'smil': entry_info_dict['formats'] = self._extract_smil_formats(video_url, video_id) elif ext == 'xspf': return self.playlist_result(self._extract_xspf_playlist(video_url, video_id), video_id) elif ext == 'm3u8': entry_info_dict['formats'] = self._extract_m3u8_formats(video_url, video_id, ext='mp4') elif ext == 'mpd': entry_info_dict['formats'] = self._extract_mpd_formats(video_url, video_id) elif ext == 'f4m': entry_info_dict['formats'] = self._extract_f4m_formats(video_url, video_id) else: entry_info_dict['url'] = video_url if entry_info_dict.get('formats'): self._sort_formats(entry_info_dict['formats']) entries.append(entry_info_dict) if len(entries) == 1: return entries[0] else: for num, e in enumerate(entries, start=1): # 'url' results don't have a title if e.get('title') is not None: e['title'] = '%s (%d)' % (e['title'], num) return { '_type': 'playlist', 'entries': entries, }
Rudloff/youtube-dl
youtube_dl/extractor/generic.py
Python
unlicense
99,048
0.002343
#!/usr/bin/env python """ @file rebuildSchemata.py @author Michael Behrisch @date 2011-07-11 @version $Id: rebuildSchemata.py 11671 2012-01-07 20:14:30Z behrisch $ Let all SUMO binarie write the schema for their config SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ Copyright (C) 2011-2012 DLR (http://www.dlr.de/) and contributors All rights reserved """ import os, sys, subprocess homeDir = os.environ.get("SUMO_HOME", os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) binDir = os.environ.get("SUMO_BINDIR", os.path.join(homeDir, "bin")) for exe in "activitygen dfrouter duarouter jtrrouter netconvert netgen od2trips polyconvert sumo".split(): subprocess.call([os.path.join(binDir, exe), "--save-schema", os.path.join(homeDir, "docs", "internet", "xsd" , exe+"Configuration.xsd")])
smendez-hi/SUMO-hib
tools/xml/rebuildSchemata.py
Python
gpl-3.0
848
0.005896
# -*- coding: utf-8 -*- # There are tests here with unicode string literals and # identifiers. There's a code in ast.c that was added because of a # failure with a non-ascii-only expression. So, I have tests for # that. There are workarounds that would let me run tests for that # code without unicode identifiers and strings, but just using them # directly seems like the easiest and therefore safest thing to do. # Unicode identifiers in tests is allowed by PEP 3131. import ast import types import decimal import unittest a_global = 'global variable' # You could argue that I'm too strict in looking for specific error # values with assertRaisesRegex, but without it it's way too easy to # make a syntax error in the test strings. Especially with all of the # triple quotes, raw strings, backslashes, etc. I think it's a # worthwhile tradeoff. When I switched to this method, I found many # examples where I wasn't testing what I thought I was. class TestCase(unittest.TestCase): def assertAllRaise(self, exception_type, regex, error_strings): for str in error_strings: with self.subTest(str=str): with self.assertRaisesRegex(exception_type, regex): eval(str) def test__format__lookup(self): # Make sure __format__ is looked up on the type, not the instance. class X: def __format__(self, spec): return 'class' x = X() # Add a bound __format__ method to the 'y' instance, but not # the 'x' instance. y = X() y.__format__ = types.MethodType(lambda self, spec: 'instance', y) self.assertEqual(f'{y}', format(y)) self.assertEqual(f'{y}', 'class') self.assertEqual(format(x), format(y)) # __format__ is not called this way, but still make sure it # returns what we expect (so we can make sure we're bypassing # it). self.assertEqual(x.__format__(''), 'class') self.assertEqual(y.__format__(''), 'instance') # This is how __format__ is actually called. self.assertEqual(type(x).__format__(x, ''), 'class') self.assertEqual(type(y).__format__(y, ''), 'class') def test_ast(self): # Inspired by http://bugs.python.org/issue24975 class X: def __init__(self): self.called = False def __call__(self): self.called = True return 4 x = X() expr = """ a = 10 f'{a * x()}'""" t = ast.parse(expr) c = compile(t, '', 'exec') # Make sure x was not called. self.assertFalse(x.called) # Actually run the code. exec(c) # Make sure x was called. self.assertTrue(x.called) def test_ast_line_numbers(self): expr = """ a = 10 f'{a * x()}'""" t = ast.parse(expr) self.assertEqual(type(t), ast.Module) self.assertEqual(len(t.body), 2) # check `a = 10` self.assertEqual(type(t.body[0]), ast.Assign) self.assertEqual(t.body[0].lineno, 2) # check `f'...'` self.assertEqual(type(t.body[1]), ast.Expr) self.assertEqual(type(t.body[1].value), ast.JoinedStr) self.assertEqual(len(t.body[1].value.values), 1) self.assertEqual(type(t.body[1].value.values[0]), ast.FormattedValue) self.assertEqual(t.body[1].lineno, 3) self.assertEqual(t.body[1].value.lineno, 3) self.assertEqual(t.body[1].value.values[0].lineno, 3) # check the binop location binop = t.body[1].value.values[0].value self.assertEqual(type(binop), ast.BinOp) self.assertEqual(type(binop.left), ast.Name) self.assertEqual(type(binop.op), ast.Mult) self.assertEqual(type(binop.right), ast.Call) self.assertEqual(binop.lineno, 3) self.assertEqual(binop.left.lineno, 3) self.assertEqual(binop.right.lineno, 3) self.assertEqual(binop.col_offset, 3) self.assertEqual(binop.left.col_offset, 3) self.assertEqual(binop.right.col_offset, 7) def test_ast_line_numbers_multiple_formattedvalues(self): expr = """ f'no formatted values' f'eggs {a * x()} spam {b + y()}'""" t = ast.parse(expr) self.assertEqual(type(t), ast.Module) self.assertEqual(len(t.body), 2) # check `f'no formatted value'` self.assertEqual(type(t.body[0]), ast.Expr) self.assertEqual(type(t.body[0].value), ast.JoinedStr) self.assertEqual(t.body[0].lineno, 2) # check `f'...'` self.assertEqual(type(t.body[1]), ast.Expr) self.assertEqual(type(t.body[1].value), ast.JoinedStr) self.assertEqual(len(t.body[1].value.values), 4) self.assertEqual(type(t.body[1].value.values[0]), ast.Constant) self.assertEqual(type(t.body[1].value.values[0].value), str) self.assertEqual(type(t.body[1].value.values[1]), ast.FormattedValue) self.assertEqual(type(t.body[1].value.values[2]), ast.Constant) self.assertEqual(type(t.body[1].value.values[2].value), str) self.assertEqual(type(t.body[1].value.values[3]), ast.FormattedValue) self.assertEqual(t.body[1].lineno, 3) self.assertEqual(t.body[1].value.lineno, 3) self.assertEqual(t.body[1].value.values[0].lineno, 3) self.assertEqual(t.body[1].value.values[1].lineno, 3) self.assertEqual(t.body[1].value.values[2].lineno, 3) self.assertEqual(t.body[1].value.values[3].lineno, 3) # check the first binop location binop1 = t.body[1].value.values[1].value self.assertEqual(type(binop1), ast.BinOp) self.assertEqual(type(binop1.left), ast.Name) self.assertEqual(type(binop1.op), ast.Mult) self.assertEqual(type(binop1.right), ast.Call) self.assertEqual(binop1.lineno, 3) self.assertEqual(binop1.left.lineno, 3) self.assertEqual(binop1.right.lineno, 3) self.assertEqual(binop1.col_offset, 8) self.assertEqual(binop1.left.col_offset, 8) self.assertEqual(binop1.right.col_offset, 12) # check the second binop location binop2 = t.body[1].value.values[3].value self.assertEqual(type(binop2), ast.BinOp) self.assertEqual(type(binop2.left), ast.Name) self.assertEqual(type(binop2.op), ast.Add) self.assertEqual(type(binop2.right), ast.Call) self.assertEqual(binop2.lineno, 3) self.assertEqual(binop2.left.lineno, 3) self.assertEqual(binop2.right.lineno, 3) self.assertEqual(binop2.col_offset, 23) self.assertEqual(binop2.left.col_offset, 23) self.assertEqual(binop2.right.col_offset, 27) def test_ast_line_numbers_nested(self): expr = """ a = 10 f'{a * f"-{x()}-"}'""" t = ast.parse(expr) self.assertEqual(type(t), ast.Module) self.assertEqual(len(t.body), 2) # check `a = 10` self.assertEqual(type(t.body[0]), ast.Assign) self.assertEqual(t.body[0].lineno, 2) # check `f'...'` self.assertEqual(type(t.body[1]), ast.Expr) self.assertEqual(type(t.body[1].value), ast.JoinedStr) self.assertEqual(len(t.body[1].value.values), 1) self.assertEqual(type(t.body[1].value.values[0]), ast.FormattedValue) self.assertEqual(t.body[1].lineno, 3) self.assertEqual(t.body[1].value.lineno, 3) self.assertEqual(t.body[1].value.values[0].lineno, 3) # check the binop location binop = t.body[1].value.values[0].value self.assertEqual(type(binop), ast.BinOp) self.assertEqual(type(binop.left), ast.Name) self.assertEqual(type(binop.op), ast.Mult) self.assertEqual(type(binop.right), ast.JoinedStr) self.assertEqual(binop.lineno, 3) self.assertEqual(binop.left.lineno, 3) self.assertEqual(binop.right.lineno, 3) self.assertEqual(binop.col_offset, 3) self.assertEqual(binop.left.col_offset, 3) self.assertEqual(binop.right.col_offset, 7) # check the nested call location self.assertEqual(len(binop.right.values), 3) self.assertEqual(type(binop.right.values[0]), ast.Constant) self.assertEqual(type(binop.right.values[0].value), str) self.assertEqual(type(binop.right.values[1]), ast.FormattedValue) self.assertEqual(type(binop.right.values[2]), ast.Constant) self.assertEqual(type(binop.right.values[2].value), str) self.assertEqual(binop.right.values[0].lineno, 3) self.assertEqual(binop.right.values[1].lineno, 3) self.assertEqual(binop.right.values[2].lineno, 3) call = binop.right.values[1].value self.assertEqual(type(call), ast.Call) self.assertEqual(call.lineno, 3) self.assertEqual(call.col_offset, 11) def test_ast_line_numbers_duplicate_expression(self): """Duplicate expression NOTE: this is currently broken, always sets location of the first expression. """ expr = """ a = 10 f'{a * x()} {a * x()} {a * x()}' """ t = ast.parse(expr) self.assertEqual(type(t), ast.Module) self.assertEqual(len(t.body), 2) # check `a = 10` self.assertEqual(type(t.body[0]), ast.Assign) self.assertEqual(t.body[0].lineno, 2) # check `f'...'` self.assertEqual(type(t.body[1]), ast.Expr) self.assertEqual(type(t.body[1].value), ast.JoinedStr) self.assertEqual(len(t.body[1].value.values), 5) self.assertEqual(type(t.body[1].value.values[0]), ast.FormattedValue) self.assertEqual(type(t.body[1].value.values[1]), ast.Constant) self.assertEqual(type(t.body[1].value.values[1].value), str) self.assertEqual(type(t.body[1].value.values[2]), ast.FormattedValue) self.assertEqual(type(t.body[1].value.values[3]), ast.Constant) self.assertEqual(type(t.body[1].value.values[3].value), str) self.assertEqual(type(t.body[1].value.values[4]), ast.FormattedValue) self.assertEqual(t.body[1].lineno, 3) self.assertEqual(t.body[1].value.lineno, 3) self.assertEqual(t.body[1].value.values[0].lineno, 3) self.assertEqual(t.body[1].value.values[1].lineno, 3) self.assertEqual(t.body[1].value.values[2].lineno, 3) self.assertEqual(t.body[1].value.values[3].lineno, 3) self.assertEqual(t.body[1].value.values[4].lineno, 3) # check the first binop location binop = t.body[1].value.values[0].value self.assertEqual(type(binop), ast.BinOp) self.assertEqual(type(binop.left), ast.Name) self.assertEqual(type(binop.op), ast.Mult) self.assertEqual(type(binop.right), ast.Call) self.assertEqual(binop.lineno, 3) self.assertEqual(binop.left.lineno, 3) self.assertEqual(binop.right.lineno, 3) self.assertEqual(binop.col_offset, 3) self.assertEqual(binop.left.col_offset, 3) self.assertEqual(binop.right.col_offset, 7) # check the second binop location binop = t.body[1].value.values[2].value self.assertEqual(type(binop), ast.BinOp) self.assertEqual(type(binop.left), ast.Name) self.assertEqual(type(binop.op), ast.Mult) self.assertEqual(type(binop.right), ast.Call) self.assertEqual(binop.lineno, 3) self.assertEqual(binop.left.lineno, 3) self.assertEqual(binop.right.lineno, 3) self.assertEqual(binop.col_offset, 3) # FIXME: this is wrong self.assertEqual(binop.left.col_offset, 3) # FIXME: this is wrong self.assertEqual(binop.right.col_offset, 7) # FIXME: this is wrong # check the third binop location binop = t.body[1].value.values[4].value self.assertEqual(type(binop), ast.BinOp) self.assertEqual(type(binop.left), ast.Name) self.assertEqual(type(binop.op), ast.Mult) self.assertEqual(type(binop.right), ast.Call) self.assertEqual(binop.lineno, 3) self.assertEqual(binop.left.lineno, 3) self.assertEqual(binop.right.lineno, 3) self.assertEqual(binop.col_offset, 3) # FIXME: this is wrong self.assertEqual(binop.left.col_offset, 3) # FIXME: this is wrong self.assertEqual(binop.right.col_offset, 7) # FIXME: this is wrong def test_ast_line_numbers_multiline_fstring(self): # See bpo-30465 for details. expr = """ a = 10 f''' {a * x()} non-important content ''' """ t = ast.parse(expr) self.assertEqual(type(t), ast.Module) self.assertEqual(len(t.body), 2) # check `a = 10` self.assertEqual(type(t.body[0]), ast.Assign) self.assertEqual(t.body[0].lineno, 2) # check `f'...'` self.assertEqual(type(t.body[1]), ast.Expr) self.assertEqual(type(t.body[1].value), ast.JoinedStr) self.assertEqual(len(t.body[1].value.values), 3) self.assertEqual(type(t.body[1].value.values[0]), ast.Constant) self.assertEqual(type(t.body[1].value.values[0].value), str) self.assertEqual(type(t.body[1].value.values[1]), ast.FormattedValue) self.assertEqual(type(t.body[1].value.values[2]), ast.Constant) self.assertEqual(type(t.body[1].value.values[2].value), str) self.assertEqual(t.body[1].lineno, 3) self.assertEqual(t.body[1].value.lineno, 3) self.assertEqual(t.body[1].value.values[0].lineno, 3) self.assertEqual(t.body[1].value.values[1].lineno, 3) self.assertEqual(t.body[1].value.values[2].lineno, 3) self.assertEqual(t.body[1].col_offset, 0) self.assertEqual(t.body[1].value.col_offset, 0) self.assertEqual(t.body[1].value.values[0].col_offset, 0) self.assertEqual(t.body[1].value.values[1].col_offset, 0) self.assertEqual(t.body[1].value.values[2].col_offset, 0) # NOTE: the following lineno information and col_offset is correct for # expressions within FormattedValues. binop = t.body[1].value.values[1].value self.assertEqual(type(binop), ast.BinOp) self.assertEqual(type(binop.left), ast.Name) self.assertEqual(type(binop.op), ast.Mult) self.assertEqual(type(binop.right), ast.Call) self.assertEqual(binop.lineno, 4) self.assertEqual(binop.left.lineno, 4) self.assertEqual(binop.right.lineno, 6) self.assertEqual(binop.col_offset, 4) self.assertEqual(binop.left.col_offset, 4) self.assertEqual(binop.right.col_offset, 7) def test_docstring(self): def f(): f'''Not a docstring''' self.assertIsNone(f.__doc__) def g(): '''Not a docstring''' \ f'' self.assertIsNone(g.__doc__) def test_literal_eval(self): with self.assertRaisesRegex(ValueError, 'malformed node or string'): ast.literal_eval("f'x'") def test_ast_compile_time_concat(self): x = [''] expr = """x[0] = 'foo' f'{3}'""" t = ast.parse(expr) c = compile(t, '', 'exec') exec(c) self.assertEqual(x[0], 'foo3') def test_compile_time_concat_errors(self): self.assertAllRaise(SyntaxError, 'cannot mix bytes and nonbytes literals', [r"""f'' b''""", r"""b'' f''""", ]) def test_literal(self): self.assertEqual(f'', '') self.assertEqual(f'a', 'a') self.assertEqual(f' ', ' ') def test_unterminated_string(self): self.assertAllRaise(SyntaxError, 'f-string: unterminated string', [r"""f'{"x'""", r"""f'{"x}'""", r"""f'{("x'""", r"""f'{("x}'""", ]) def test_mismatched_parens(self): self.assertAllRaise(SyntaxError, r"f-string: closing parenthesis '\}' " r"does not match opening parenthesis '\('", ["f'{((}'", ]) self.assertAllRaise(SyntaxError, r"f-string: closing parenthesis '\)' " r"does not match opening parenthesis '\['", ["f'{a[4)}'", ]) self.assertAllRaise(SyntaxError, r"f-string: closing parenthesis '\]' " r"does not match opening parenthesis '\('", ["f'{a(4]}'", ]) self.assertAllRaise(SyntaxError, r"f-string: closing parenthesis '\}' " r"does not match opening parenthesis '\['", ["f'{a[4}'", ]) self.assertAllRaise(SyntaxError, r"f-string: closing parenthesis '\}' " r"does not match opening parenthesis '\('", ["f'{a(4}'", ]) self.assertRaises(SyntaxError, eval, "f'{" + "("*500 + "}'") def test_double_braces(self): self.assertEqual(f'{{', '{') self.assertEqual(f'a{{', 'a{') self.assertEqual(f'{{b', '{b') self.assertEqual(f'a{{b', 'a{b') self.assertEqual(f'}}', '}') self.assertEqual(f'a}}', 'a}') self.assertEqual(f'}}b', '}b') self.assertEqual(f'a}}b', 'a}b') self.assertEqual(f'{{}}', '{}') self.assertEqual(f'a{{}}', 'a{}') self.assertEqual(f'{{b}}', '{b}') self.assertEqual(f'{{}}c', '{}c') self.assertEqual(f'a{{b}}', 'a{b}') self.assertEqual(f'a{{}}c', 'a{}c') self.assertEqual(f'{{b}}c', '{b}c') self.assertEqual(f'a{{b}}c', 'a{b}c') self.assertEqual(f'{{{10}', '{10') self.assertEqual(f'}}{10}', '}10') self.assertEqual(f'}}{{{10}', '}{10') self.assertEqual(f'}}a{{{10}', '}a{10') self.assertEqual(f'{10}{{', '10{') self.assertEqual(f'{10}}}', '10}') self.assertEqual(f'{10}}}{{', '10}{') self.assertEqual(f'{10}}}a{{' '}', '10}a{}') # Inside of strings, don't interpret doubled brackets. self.assertEqual(f'{"{{}}"}', '{{}}') self.assertAllRaise(TypeError, 'unhashable type', ["f'{ {{}} }'", # dict in a set ]) def test_compile_time_concat(self): x = 'def' self.assertEqual('abc' f'## {x}ghi', 'abc## defghi') self.assertEqual('abc' f'{x}' 'ghi', 'abcdefghi') self.assertEqual('abc' f'{x}' 'gh' f'i{x:4}', 'abcdefghidef ') self.assertEqual('{x}' f'{x}', '{x}def') self.assertEqual('{x' f'{x}', '{xdef') self.assertEqual('{x}' f'{x}', '{x}def') self.assertEqual('{{x}}' f'{x}', '{{x}}def') self.assertEqual('{{x' f'{x}', '{{xdef') self.assertEqual('x}}' f'{x}', 'x}}def') self.assertEqual(f'{x}' 'x}}', 'defx}}') self.assertEqual(f'{x}' '', 'def') self.assertEqual('' f'{x}' '', 'def') self.assertEqual('' f'{x}', 'def') self.assertEqual(f'{x}' '2', 'def2') self.assertEqual('1' f'{x}' '2', '1def2') self.assertEqual('1' f'{x}', '1def') self.assertEqual(f'{x}' f'-{x}', 'def-def') self.assertEqual('' f'', '') self.assertEqual('' f'' '', '') self.assertEqual('' f'' '' f'', '') self.assertEqual(f'', '') self.assertEqual(f'' '', '') self.assertEqual(f'' '' f'', '') self.assertEqual(f'' '' f'' '', '') self.assertAllRaise(SyntaxError, "f-string: expecting '}'", ["f'{3' f'}'", # can't concat to get a valid f-string ]) def test_comments(self): # These aren't comments, since they're in strings. d = {'#': 'hash'} self.assertEqual(f'{"#"}', '#') self.assertEqual(f'{d["#"]}', 'hash') self.assertAllRaise(SyntaxError, "f-string expression part cannot include '#'", ["f'{1#}'", # error because the expression becomes "(1#)" "f'{3(#)}'", "f'{#}'", ]) self.assertAllRaise(SyntaxError, r"f-string: unmatched '\)'", ["f'{)#}'", # When wrapped in parens, this becomes # '()#)'. Make sure that doesn't compile. ]) def test_many_expressions(self): # Create a string with many expressions in it. Note that # because we have a space in here as a literal, we're actually # going to use twice as many ast nodes: one for each literal # plus one for each expression. def build_fstr(n, extra=''): return "f'" + ('{x} ' * n) + extra + "'" x = 'X' width = 1 # Test around 256. for i in range(250, 260): self.assertEqual(eval(build_fstr(i)), (x+' ')*i) # Test concatenating 2 largs fstrings. self.assertEqual(eval(build_fstr(255)*256), (x+' ')*(255*256)) s = build_fstr(253, '{x:{width}} ') self.assertEqual(eval(s), (x+' ')*254) # Test lots of expressions and constants, concatenated. s = "f'{1}' 'x' 'y'" * 1024 self.assertEqual(eval(s), '1xy' * 1024) def test_format_specifier_expressions(self): width = 10 precision = 4 value = decimal.Decimal('12.34567') self.assertEqual(f'result: {value:{width}.{precision}}', 'result: 12.35') self.assertEqual(f'result: {value:{width!r}.{precision}}', 'result: 12.35') self.assertEqual(f'result: {value:{width:0}.{precision:1}}', 'result: 12.35') self.assertEqual(f'result: {value:{1}{0:0}.{precision:1}}', 'result: 12.35') self.assertEqual(f'result: {value:{ 1}{ 0:0}.{ precision:1}}', 'result: 12.35') self.assertEqual(f'{10:#{1}0x}', ' 0xa') self.assertEqual(f'{10:{"#"}1{0}{"x"}}', ' 0xa') self.assertEqual(f'{-10:-{"#"}1{0}x}', ' -0xa') self.assertEqual(f'{-10:{"-"}#{1}0{"x"}}', ' -0xa') self.assertEqual(f'{10:#{3 != {4:5} and width}x}', ' 0xa') self.assertAllRaise(SyntaxError, "f-string: expecting '}'", ["""f'{"s"!r{":10"}}'""", # This looks like a nested format spec. ]) self.assertAllRaise(SyntaxError, "invalid syntax", [# Invalid syntax inside a nested spec. "f'{4:{/5}}'", ]) self.assertAllRaise(SyntaxError, "f-string: expressions nested too deeply", [# Can't nest format specifiers. "f'result: {value:{width:{0}}.{precision:1}}'", ]) self.assertAllRaise(SyntaxError, 'f-string: invalid conversion character', [# No expansion inside conversion or for # the : or ! itself. """f'{"s"!{"r"}}'""", ]) def test_side_effect_order(self): class X: def __init__(self): self.i = 0 def __format__(self, spec): self.i += 1 return str(self.i) x = X() self.assertEqual(f'{x} {x}', '1 2') def test_missing_expression(self): self.assertAllRaise(SyntaxError, 'f-string: empty expression not allowed', ["f'{}'", "f'{ }'" "f' {} '", "f'{!r}'", "f'{ !r}'", "f'{10:{ }}'", "f' { } '", # The Python parser ignores also the following # whitespace characters in additional to a space. "f'''{\t\f\r\n}'''", # Catch the empty expression before the # invalid conversion. "f'{!x}'", "f'{ !xr}'", "f'{!x:}'", "f'{!x:a}'", "f'{ !xr:}'", "f'{ !xr:a}'", "f'{!}'", "f'{:}'", # We find the empty expression before the # missing closing brace. "f'{!'", "f'{!s:'", "f'{:'", "f'{:x'", ]) # Different error message is raised for other whitespace characters. self.assertAllRaise(SyntaxError, 'invalid character in identifier', ["f'''{\xa0}'''", "\xa0", ]) def test_parens_in_expressions(self): self.assertEqual(f'{3,}', '(3,)') # Add these because when an expression is evaluated, parens # are added around it. But we shouldn't go from an invalid # expression to a valid one. The added parens are just # supposed to allow whitespace (including newlines). self.assertAllRaise(SyntaxError, 'invalid syntax', ["f'{,}'", "f'{,}'", # this is (,), which is an error ]) self.assertAllRaise(SyntaxError, r"f-string: unmatched '\)'", ["f'{3)+(4}'", ]) self.assertAllRaise(SyntaxError, 'EOL while scanning string literal', ["f'{\n}'", ]) def test_backslashes_in_string_part(self): self.assertEqual(f'\t', '\t') self.assertEqual(r'\t', '\\t') self.assertEqual(rf'\t', '\\t') self.assertEqual(f'{2}\t', '2\t') self.assertEqual(f'{2}\t{3}', '2\t3') self.assertEqual(f'\t{3}', '\t3') self.assertEqual(f'\u0394', '\u0394') self.assertEqual(r'\u0394', '\\u0394') self.assertEqual(rf'\u0394', '\\u0394') self.assertEqual(f'{2}\u0394', '2\u0394') self.assertEqual(f'{2}\u0394{3}', '2\u03943') self.assertEqual(f'\u0394{3}', '\u03943') self.assertEqual(f'\U00000394', '\u0394') self.assertEqual(r'\U00000394', '\\U00000394') self.assertEqual(rf'\U00000394', '\\U00000394') self.assertEqual(f'{2}\U00000394', '2\u0394') self.assertEqual(f'{2}\U00000394{3}', '2\u03943') self.assertEqual(f'\U00000394{3}', '\u03943') self.assertEqual(f'\N{GREEK CAPITAL LETTER DELTA}', '\u0394') self.assertEqual(f'{2}\N{GREEK CAPITAL LETTER DELTA}', '2\u0394') self.assertEqual(f'{2}\N{GREEK CAPITAL LETTER DELTA}{3}', '2\u03943') self.assertEqual(f'\N{GREEK CAPITAL LETTER DELTA}{3}', '\u03943') self.assertEqual(f'2\N{GREEK CAPITAL LETTER DELTA}', '2\u0394') self.assertEqual(f'2\N{GREEK CAPITAL LETTER DELTA}3', '2\u03943') self.assertEqual(f'\N{GREEK CAPITAL LETTER DELTA}3', '\u03943') self.assertEqual(f'\x20', ' ') self.assertEqual(r'\x20', '\\x20') self.assertEqual(rf'\x20', '\\x20') self.assertEqual(f'{2}\x20', '2 ') self.assertEqual(f'{2}\x20{3}', '2 3') self.assertEqual(f'\x20{3}', ' 3') self.assertEqual(f'2\x20', '2 ') self.assertEqual(f'2\x203', '2 3') self.assertEqual(f'\x203', ' 3') with self.assertWarns(DeprecationWarning): # invalid escape sequence value = eval(r"f'\{6*7}'") self.assertEqual(value, '\\42') self.assertEqual(f'\\{6*7}', '\\42') self.assertEqual(fr'\{6*7}', '\\42') AMPERSAND = 'spam' # Get the right unicode character (&), or pick up local variable # depending on the number of backslashes. self.assertEqual(f'\N{AMPERSAND}', '&') self.assertEqual(f'\\N{AMPERSAND}', '\\Nspam') self.assertEqual(fr'\N{AMPERSAND}', '\\Nspam') self.assertEqual(f'\\\N{AMPERSAND}', '\\&') def test_misformed_unicode_character_name(self): # These test are needed because unicode names are parsed # differently inside f-strings. self.assertAllRaise(SyntaxError, r"\(unicode error\) 'unicodeescape' codec can't decode bytes in position .*: malformed \\N character escape", [r"f'\N'", r"f'\N{'", r"f'\N{GREEK CAPITAL LETTER DELTA'", # Here are the non-f-string versions, # which should give the same errors. r"'\N'", r"'\N{'", r"'\N{GREEK CAPITAL LETTER DELTA'", ]) def test_no_backslashes_in_expression_part(self): self.assertAllRaise(SyntaxError, 'f-string expression part cannot include a backslash', [r"f'{\'a\'}'", r"f'{\t3}'", r"f'{\}'", r"rf'{\'a\'}'", r"rf'{\t3}'", r"rf'{\}'", r"""rf'{"\N{LEFT CURLY BRACKET}"}'""", r"f'{\n}'", ]) def test_no_escapes_for_braces(self): """ Only literal curly braces begin an expression. """ # \x7b is '{'. self.assertEqual(f'\x7b1+1}}', '{1+1}') self.assertEqual(f'\x7b1+1', '{1+1') self.assertEqual(f'\u007b1+1', '{1+1') self.assertEqual(f'\N{LEFT CURLY BRACKET}1+1\N{RIGHT CURLY BRACKET}', '{1+1}') def test_newlines_in_expressions(self): self.assertEqual(f'{0}', '0') self.assertEqual(rf'''{3+ 4}''', '7') def test_lambda(self): x = 5 self.assertEqual(f'{(lambda y:x*y)("8")!r}', "'88888'") self.assertEqual(f'{(lambda y:x*y)("8")!r:10}', "'88888' ") self.assertEqual(f'{(lambda y:x*y)("8"):10}', "88888 ") # lambda doesn't work without parens, because the colon # makes the parser think it's a format_spec self.assertAllRaise(SyntaxError, 'unexpected EOF while parsing', ["f'{lambda x:x}'", ]) def test_yield(self): # Not terribly useful, but make sure the yield turns # a function into a generator def fn(y): f'y:{yield y*2}' g = fn(4) self.assertEqual(next(g), 8) def test_yield_send(self): def fn(x): yield f'x:{yield (lambda i: x * i)}' g = fn(10) the_lambda = next(g) self.assertEqual(the_lambda(4), 40) self.assertEqual(g.send('string'), 'x:string') def test_expressions_with_triple_quoted_strings(self): self.assertEqual(f"{'''x'''}", 'x') self.assertEqual(f"{'''eric's'''}", "eric's") # Test concatenation within an expression self.assertEqual(f'{"x" """eric"s""" "y"}', 'xeric"sy') self.assertEqual(f'{"x" """eric"s"""}', 'xeric"s') self.assertEqual(f'{"""eric"s""" "y"}', 'eric"sy') self.assertEqual(f'{"""x""" """eric"s""" "y"}', 'xeric"sy') self.assertEqual(f'{"""x""" """eric"s""" """y"""}', 'xeric"sy') self.assertEqual(f'{r"""x""" """eric"s""" """y"""}', 'xeric"sy') def test_multiple_vars(self): x = 98 y = 'abc' self.assertEqual(f'{x}{y}', '98abc') self.assertEqual(f'X{x}{y}', 'X98abc') self.assertEqual(f'{x}X{y}', '98Xabc') self.assertEqual(f'{x}{y}X', '98abcX') self.assertEqual(f'X{x}Y{y}', 'X98Yabc') self.assertEqual(f'X{x}{y}Y', 'X98abcY') self.assertEqual(f'{x}X{y}Y', '98XabcY') self.assertEqual(f'X{x}Y{y}Z', 'X98YabcZ') def test_closure(self): def outer(x): def inner(): return f'x:{x}' return inner self.assertEqual(outer('987')(), 'x:987') self.assertEqual(outer(7)(), 'x:7') def test_arguments(self): y = 2 def f(x, width): return f'x={x*y:{width}}' self.assertEqual(f('foo', 10), 'x=foofoo ') x = 'bar' self.assertEqual(f(10, 10), 'x= 20') def test_locals(self): value = 123 self.assertEqual(f'v:{value}', 'v:123') def test_missing_variable(self): with self.assertRaises(NameError): f'v:{value}' def test_missing_format_spec(self): class O: def __format__(self, spec): if not spec: return '*' return spec self.assertEqual(f'{O():x}', 'x') self.assertEqual(f'{O()}', '*') self.assertEqual(f'{O():}', '*') self.assertEqual(f'{3:}', '3') self.assertEqual(f'{3!s:}', '3') def test_global(self): self.assertEqual(f'g:{a_global}', 'g:global variable') self.assertEqual(f'g:{a_global!r}', "g:'global variable'") a_local = 'local variable' self.assertEqual(f'g:{a_global} l:{a_local}', 'g:global variable l:local variable') self.assertEqual(f'g:{a_global!r}', "g:'global variable'") self.assertEqual(f'g:{a_global} l:{a_local!r}', "g:global variable l:'local variable'") self.assertIn("module 'unittest' from", f'{unittest}') def test_shadowed_global(self): a_global = 'really a local' self.assertEqual(f'g:{a_global}', 'g:really a local') self.assertEqual(f'g:{a_global!r}', "g:'really a local'") a_local = 'local variable' self.assertEqual(f'g:{a_global} l:{a_local}', 'g:really a local l:local variable') self.assertEqual(f'g:{a_global!r}', "g:'really a local'") self.assertEqual(f'g:{a_global} l:{a_local!r}', "g:really a local l:'local variable'") def test_call(self): def foo(x): return 'x=' + str(x) self.assertEqual(f'{foo(10)}', 'x=10') def test_nested_fstrings(self): y = 5 self.assertEqual(f'{f"{0}"*3}', '000') self.assertEqual(f'{f"{y}"*3}', '555') def test_invalid_string_prefixes(self): self.assertAllRaise(SyntaxError, 'unexpected EOF while parsing', ["fu''", "uf''", "Fu''", "fU''", "Uf''", "uF''", "ufr''", "urf''", "fur''", "fru''", "rfu''", "ruf''", "FUR''", "Fur''", "fb''", "fB''", "Fb''", "FB''", "bf''", "bF''", "Bf''", "BF''", ]) def test_leading_trailing_spaces(self): self.assertEqual(f'{ 3}', '3') self.assertEqual(f'{ 3}', '3') self.assertEqual(f'{3 }', '3') self.assertEqual(f'{3 }', '3') self.assertEqual(f'expr={ {x: y for x, y in [(1, 2), ]}}', 'expr={1: 2}') self.assertEqual(f'expr={ {x: y for x, y in [(1, 2), ]} }', 'expr={1: 2}') def test_not_equal(self): # There's a special test for this because there's a special # case in the f-string parser to look for != as not ending an # expression. Normally it would, while looking for !s or !r. self.assertEqual(f'{3!=4}', 'True') self.assertEqual(f'{3!=4:}', 'True') self.assertEqual(f'{3!=4!s}', 'True') self.assertEqual(f'{3!=4!s:.3}', 'Tru') def test_equal_equal(self): # Because an expression ending in = has special meaning, # there's a special test for ==. Make sure it works. self.assertEqual(f'{0==1}', 'False') def test_conversions(self): self.assertEqual(f'{3.14:10.10}', ' 3.14') self.assertEqual(f'{3.14!s:10.10}', '3.14 ') self.assertEqual(f'{3.14!r:10.10}', '3.14 ') self.assertEqual(f'{3.14!a:10.10}', '3.14 ') self.assertEqual(f'{"a"}', 'a') self.assertEqual(f'{"a"!r}', "'a'") self.assertEqual(f'{"a"!a}', "'a'") # Not a conversion. self.assertEqual(f'{"a!r"}', "a!r") # Not a conversion, but show that ! is allowed in a format spec. self.assertEqual(f'{3.14:!<10.10}', '3.14!!!!!!') self.assertAllRaise(SyntaxError, 'f-string: invalid conversion character', ["f'{3!g}'", "f'{3!A}'", "f'{3!3}'", "f'{3!G}'", "f'{3!!}'", "f'{3!:}'", "f'{3! s}'", # no space before conversion char ]) self.assertAllRaise(SyntaxError, "f-string: expecting '}'", ["f'{x!s{y}}'", "f'{3!ss}'", "f'{3!ss:}'", "f'{3!ss:s}'", ]) def test_assignment(self): self.assertAllRaise(SyntaxError, 'invalid syntax', ["f'' = 3", "f'{0}' = x", "f'{x}' = x", ]) def test_del(self): self.assertAllRaise(SyntaxError, 'invalid syntax', ["del f''", "del '' f''", ]) def test_mismatched_braces(self): self.assertAllRaise(SyntaxError, "f-string: single '}' is not allowed", ["f'{{}'", "f'{{}}}'", "f'}'", "f'x}'", "f'x}x'", r"f'\u007b}'", # Can't have { or } in a format spec. "f'{3:}>10}'", "f'{3:}}>10}'", ]) self.assertAllRaise(SyntaxError, "f-string: expecting '}'", ["f'{3:{{>10}'", "f'{3'", "f'{3!'", "f'{3:'", "f'{3!s'", "f'{3!s:'", "f'{3!s:3'", "f'x{'", "f'x{x'", "f'{x'", "f'{3:s'", "f'{{{'", "f'{{}}{'", "f'{'", ]) # But these are just normal strings. self.assertEqual(f'{"{"}', '{') self.assertEqual(f'{"}"}', '}') self.assertEqual(f'{3:{"}"}>10}', '}}}}}}}}}3') self.assertEqual(f'{2:{"{"}>10}', '{{{{{{{{{2') def test_if_conditional(self): # There's special logic in compile.c to test if the # conditional for an if (and while) are constants. Exercise # that code. def test_fstring(x, expected): flag = 0 if f'{x}': flag = 1 else: flag = 2 self.assertEqual(flag, expected) def test_concat_empty(x, expected): flag = 0 if '' f'{x}': flag = 1 else: flag = 2 self.assertEqual(flag, expected) def test_concat_non_empty(x, expected): flag = 0 if ' ' f'{x}': flag = 1 else: flag = 2 self.assertEqual(flag, expected) test_fstring('', 2) test_fstring(' ', 1) test_concat_empty('', 2) test_concat_empty(' ', 1) test_concat_non_empty('', 1) test_concat_non_empty(' ', 1) def test_empty_format_specifier(self): x = 'test' self.assertEqual(f'{x}', 'test') self.assertEqual(f'{x:}', 'test') self.assertEqual(f'{x!s:}', 'test') self.assertEqual(f'{x!r:}', "'test'") def test_str_format_differences(self): d = {'a': 'string', 0: 'integer', } a = 0 self.assertEqual(f'{d[0]}', 'integer') self.assertEqual(f'{d["a"]}', 'string') self.assertEqual(f'{d[a]}', 'integer') self.assertEqual('{d[a]}'.format(d=d), 'string') self.assertEqual('{d[0]}'.format(d=d), 'integer') def test_errors(self): # see issue 26287 self.assertAllRaise(TypeError, 'unsupported', [r"f'{(lambda: 0):x}'", r"f'{(0,):x}'", ]) self.assertAllRaise(ValueError, 'Unknown format code', [r"f'{1000:j}'", r"f'{1000:j}'", ]) def test_loop(self): for i in range(1000): self.assertEqual(f'i:{i}', 'i:' + str(i)) def test_dict(self): d = {'"': 'dquote', "'": 'squote', 'foo': 'bar', } self.assertEqual(f'''{d["'"]}''', 'squote') self.assertEqual(f"""{d['"']}""", 'dquote') self.assertEqual(f'{d["foo"]}', 'bar') self.assertEqual(f"{d['foo']}", 'bar') def test_backslash_char(self): # Check eval of a backslash followed by a control char. # See bpo-30682: this used to raise an assert in pydebug mode. self.assertEqual(eval('f"\\\n"'), '') self.assertEqual(eval('f"\\\r"'), '') def test_debug_conversion(self): x = 'A string' self.assertEqual(f'{x=}', 'x=' + repr(x)) self.assertEqual(f'{x =}', 'x =' + repr(x)) self.assertEqual(f'{x=!s}', 'x=' + str(x)) self.assertEqual(f'{x=!r}', 'x=' + repr(x)) self.assertEqual(f'{x=!a}', 'x=' + ascii(x)) x = 2.71828 self.assertEqual(f'{x=:.2f}', 'x=' + format(x, '.2f')) self.assertEqual(f'{x=:}', 'x=' + format(x, '')) self.assertEqual(f'{x=!r:^20}', 'x=' + format(repr(x), '^20')) self.assertEqual(f'{x=!s:^20}', 'x=' + format(str(x), '^20')) self.assertEqual(f'{x=!a:^20}', 'x=' + format(ascii(x), '^20')) x = 9 self.assertEqual(f'{3*x+15=}', '3*x+15=42') # There is code in ast.c that deals with non-ascii expression values. So, # use a unicode identifier to trigger that. tenπ = 31.4 self.assertEqual(f'{tenπ=:.2f}', 'tenπ=31.40') # Also test with Unicode in non-identifiers. self.assertEqual(f'{"Σ"=}', '"Σ"=\'Σ\'') # Make sure nested fstrings still work. self.assertEqual(f'{f"{3.1415=:.1f}":*^20}', '*****3.1415=3.1*****') # Make sure text before and after an expression with = works # correctly. pi = 'π' self.assertEqual(f'alpha α {pi=} ω omega', "alpha α pi='π' ω omega") # Check multi-line expressions. self.assertEqual(f'''{ 3 =}''', '\n3\n=3') # Since = is handled specially, make sure all existing uses of # it still work. self.assertEqual(f'{0==1}', 'False') self.assertEqual(f'{0!=1}', 'True') self.assertEqual(f'{0<=1}', 'True') self.assertEqual(f'{0>=1}', 'False') self.assertEqual(f'{(x:="5")}', '5') self.assertEqual(x, '5') self.assertEqual(f'{(x:=5)}', '5') self.assertEqual(x, 5) self.assertEqual(f'{"="}', '=') x = 20 # This isn't an assignment expression, it's 'x', with a format # spec of '=10'. See test_walrus: you need to use parens. self.assertEqual(f'{x:=10}', ' 20') # Test named function parameters, to make sure '=' parsing works # there. def f(a): nonlocal x oldx = x x = a return oldx x = 0 self.assertEqual(f'{f(a="3=")}', '0') self.assertEqual(x, '3=') self.assertEqual(f'{f(a=4)}', '3=') self.assertEqual(x, 4) # Make sure __format__ is being called. class C: def __format__(self, s): return f'FORMAT-{s}' def __repr__(self): return 'REPR' self.assertEqual(f'{C()=}', 'C()=REPR') self.assertEqual(f'{C()=!r}', 'C()=REPR') self.assertEqual(f'{C()=:}', 'C()=FORMAT-') self.assertEqual(f'{C()=: }', 'C()=FORMAT- ') self.assertEqual(f'{C()=:x}', 'C()=FORMAT-x') self.assertEqual(f'{C()=!r:*^20}', 'C()=********REPR********') self.assertRaises(SyntaxError, eval, "f'{C=]'") # Make sure leading and following text works. x = 'foo' self.assertEqual(f'X{x=}Y', 'Xx='+repr(x)+'Y') # Make sure whitespace around the = works. self.assertEqual(f'X{x =}Y', 'Xx ='+repr(x)+'Y') self.assertEqual(f'X{x= }Y', 'Xx= '+repr(x)+'Y') self.assertEqual(f'X{x = }Y', 'Xx = '+repr(x)+'Y') # These next lines contains tabs. Backslash escapes don't # work in f-strings. # patchcheck doesn't like these tabs. So the only way to test # this will be to dynamically created and exec the f-strings. But # that's such a hassle I'll save it for another day. For now, convert # the tabs to spaces just to shut up patchcheck. #self.assertEqual(f'X{x =}Y', 'Xx\t='+repr(x)+'Y') #self.assertEqual(f'X{x = }Y', 'Xx\t=\t'+repr(x)+'Y') def test_walrus(self): x = 20 # This isn't an assignment expression, it's 'x', with a format # spec of '=10'. self.assertEqual(f'{x:=10}', ' 20') # This is an assignment expression, which requires parens. self.assertEqual(f'{(x:=10)}', '10') self.assertEqual(x, 10) if __name__ == '__main__': unittest.main()
batermj/algorithm-challenger
code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/test/test_fstring.py
Python
apache-2.0
47,266
0.000783
''' BSD Licence Copyright (c) 2012, Science & Technology Facilities Council (STFC) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Science & Technology Facilities Council (STFC) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Created on 29 Jun 2012 @author: mnagni ''' from xml.etree.ElementTree import _ElementInterface, Element def createMarkup(tagName, tagPrefix, tagNamespace, root = None): ''' Returns an ElementTree.Element instance @param tagName: the tag name @param tagPrefix: the prefix to use for this tag @param tagNamespace: the tag's namespace @param root: the root Element of the document containing this element @return: a new instance ''' #attach gml namespace to the document root element _tag = tagName if root is not None: if isinstance(root, _ElementInterface): if root.get('xmlns') == tagNamespace: _tag = tagName else: root.set("xmlns:%s" % (tagPrefix), tagNamespace) if tagName is not None and tagPrefix is not None: _tag = "%s:%s" % (tagPrefix, tagName) markup = Element(_tag) if root is None: markup.set("xmlns", tagNamespace) return markup def createSimpleMarkup(text, root, tagName, ns, prefix): """ Returns a new markup filling only its 'text' attribute """ markup = createMarkup(tagName, prefix, ns, root) markup.text = text return markup
kusamau/cedaMarkup
ceda_markup/markup.py
Python
bsd-3-clause
2,962
0.009453
# https://djangosnippets.org/snippets/2566/ from django import template from django.template import resolve_variable, NodeList from django.contrib.auth.models import Group register = template.Library() @register.tag() def ifusergroup(parser, token): """ Check to see if the currently logged in user belongs to a specific group. Requires the Django authentication contrib app and middleware. Usage: {% ifusergroup Admins %} ... {% endifusergroup %}, or {% ifusergroup Admins|Group1|"Group 2" %} ... {% endifusergroup %}, or {% ifusergroup Admins %} ... {% else %} ... {% endifusergroup %} """ try: _, group = token.split_contents() except ValueError: raise template.TemplateSyntaxError("Tag 'ifusergroup' requires 1 argument.") nodelist_true = parser.parse(('else', 'endifusergroup')) token = parser.next_token() if token.contents == 'else': nodelist_false = parser.parse(('endifusergroup',)) parser.delete_first_token() else: nodelist_false = NodeList() return GroupCheckNode(group, nodelist_true, nodelist_false) class GroupCheckNode(template.Node): def __init__(self, group, nodelist_true, nodelist_false): self.group = group self.nodelist_true = nodelist_true self.nodelist_false = nodelist_false def render(self, context): user = resolve_variable('user', context) if not user.is_authenticated(): return self.nodelist_false.render(context) for group in self.group.split("|"): group = group[1:-1] if group.startswith('"') and group.endswith('"') else group try: if Group.objects.get(name=group) in user.groups.all(): return self.nodelist_true.render(context) except Group.DoesNotExist: pass return self.nodelist_false.render(context)
mupi/tecsaladeaula
core/templatetags/usergroup.py
Python
agpl-3.0
1,920
0.001563
# Generated by Django 1.11.7 on 2018-05-21 09:16 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('waldur_jira', '0017_project_action'), ] operations = [ migrations.AddField( model_name='project', name='runtime_state', field=models.CharField( blank=True, max_length=150, verbose_name='runtime state' ), ), ]
opennode/nodeconductor-assembly-waldur
src/waldur_jira/migrations/0018_project_runtime_state.py
Python
mit
465
0
import json import enum from urllib.parse import urlencode from urllib.request import urlopen from urllib import request class APINonSingle: def __init__(self, api_key, agent = "webnews-python", webnews_base = "https://webnews.csh.rit.edu/"): self.agent = agent self.api_key = api_key self.webnews_base = webnews_base class Actions(enum.Enum): user = "user" unread_counts = "unread_counts" newsgroups = "newsgroups" search = "search" compose = "compose" def POST(self, action, args={}): if type(action) == API.Actions: action = action.value args['api_key'] = self.api_key args['api_agent'] = self.agent args = urlencode(args).encode('utf-8') req = request.Request(self.webnews_base+ action) req.add_header('Accept', 'application/json') resp = urlopen(req, args).read().decode('utf-8') return json.loads(resp) def GET(self, action, args={}): if type(action) == API.Actions: action = action.value args['api_key'] = self.api_key args['api_agent'] = self.agent args = urlencode(args) req = request.Request(self.webnews_base + action + '?' + args) req.add_header('Accept', 'application/json') resp = urlopen(req).read().decode('utf-8') return json.loads(resp) def user(self): return self.GET(API.Actions.user) def unread_counts(self): return self.GET(API.Actions.unread_counts) def newsgroups(self): return self.GET(API.Actions.newsgroups) def newsgroups_search(self, newsgroup): return self.GET("newsgroups/" + newsgroup) def newsgroup_posts(self, newsgroup, params={}): return self.GET(newsgroup + '/index', params) def search(self, params = {}): return self.GET(API.Actions.search, params) def post_specifics(self, newsgroup, index, params={}): return self.GET(str(newsgroup)+"/"+str(index), params) def compose(self, newsgroup, subject, body, params={}): params['subject'] = subject params['body'] = body params['newsgroup'] = newsgroup return self.POST(API.Actions.compose, params) """ Wrap the APINonSingle object so that only a single object for each key will exist. Optimization for object implementation """ class API(APINonSingle): _instance = {} def __new__(cls, *args, **kwargs): if not args[0] in cls._instance: cls._instance[args[0]] = APINonSingle(*args, **kwargs) return cls._instance[args[0]]
AndrewHanes/Python-Webnews
webnews/api.py
Python
mit
2,609
0.004983
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from pants.backend.docgen.targets.doc import Page, Wiki, WikiArtifact from pants.backend.docgen.tasks.generate_pants_reference import GeneratePantsReference from pants.backend.docgen.tasks.markdown_to_html import MarkdownToHtml from pants.build_graph.build_file_aliases import BuildFileAliases from pants.goal.task_registrar import TaskRegistrar as task def build_file_aliases(): return BuildFileAliases( targets={ 'page': Page, }, objects={ 'wiki_artifact': WikiArtifact, # TODO: Why is this capitalized? 'Wiki': Wiki, }, ) def register_goals(): task(name='markdown', action=MarkdownToHtml).install(), task(name='reference', action=GeneratePantsReference).install()
UnrememberMe/pants
src/python/pants/backend/docgen/register.py
Python
apache-2.0
1,019
0.004907
def main(): print("Hello!")
BobbyJacobs/cs3240-demo
hello.py
Python
mit
30
0.033333
# Copyright 2021 The Meson development team # SPDX-license-identifier: Apache-2.0 from __future__ import annotations import re import os import typing as T from ...mesonlib import version_compare from ...interpreterbase import ( ObjectHolder, MesonOperator, FeatureNew, typed_operator, noArgsFlattening, noKwargs, noPosargs, typed_pos_args, InvalidArguments, ) if T.TYPE_CHECKING: # Object holders need the actual interpreter from ...interpreter import Interpreter from ...interpreterbase import TYPE_var, TYPE_kwargs class StringHolder(ObjectHolder[str]): def __init__(self, obj: str, interpreter: 'Interpreter') -> None: super().__init__(obj, interpreter) self.methods.update({ 'contains': self.contains_method, 'startswith': self.startswith_method, 'endswith': self.endswith_method, 'format': self.format_method, 'join': self.join_method, 'replace': self.replace_method, 'split': self.split_method, 'strip': self.strip_method, 'substring': self.substring_method, 'to_int': self.to_int_method, 'to_lower': self.to_lower_method, 'to_upper': self.to_upper_method, 'underscorify': self.underscorify_method, 'version_compare': self.version_compare_method, }) self.trivial_operators.update({ # Arithmetic MesonOperator.PLUS: (str, lambda x: self.held_object + x), # Comparison MesonOperator.EQUALS: (str, lambda x: self.held_object == x), MesonOperator.NOT_EQUALS: (str, lambda x: self.held_object != x), MesonOperator.GREATER: (str, lambda x: self.held_object > x), MesonOperator.LESS: (str, lambda x: self.held_object < x), MesonOperator.GREATER_EQUALS: (str, lambda x: self.held_object >= x), MesonOperator.LESS_EQUALS: (str, lambda x: self.held_object <= x), }) # Use actual methods for functions that require additional checks self.operators.update({ MesonOperator.DIV: self.op_div, MesonOperator.INDEX: self.op_index, }) def display_name(self) -> str: return 'str' @noKwargs @typed_pos_args('str.contains', str) def contains_method(self, args: T.Tuple[str], kwargs: TYPE_kwargs) -> bool: return self.held_object.find(args[0]) >= 0 @noKwargs @typed_pos_args('str.startswith', str) def startswith_method(self, args: T.Tuple[str], kwargs: TYPE_kwargs) -> bool: return self.held_object.startswith(args[0]) @noKwargs @typed_pos_args('str.endswith', str) def endswith_method(self, args: T.Tuple[str], kwargs: TYPE_kwargs) -> bool: return self.held_object.endswith(args[0]) @noArgsFlattening @noKwargs @typed_pos_args('str.format', varargs=object) def format_method(self, args: T.Tuple[T.List[object]], kwargs: TYPE_kwargs) -> str: arg_strings: T.List[str] = [] for arg in args[0]: if isinstance(arg, bool): # Python boolean is upper case. arg = str(arg).lower() arg_strings.append(str(arg)) def arg_replace(match: T.Match[str]) -> str: idx = int(match.group(1)) if idx >= len(arg_strings): raise InvalidArguments(f'Format placeholder @{idx}@ out of range.') return arg_strings[idx] return re.sub(r'@(\d+)@', arg_replace, self.held_object) @noKwargs @typed_pos_args('str.join', varargs=str) def join_method(self, args: T.Tuple[T.List[str]], kwargs: TYPE_kwargs) -> str: return self.held_object.join(args[0]) @noKwargs @typed_pos_args('str.replace', str, str) def replace_method(self, args: T.Tuple[str, str], kwargs: TYPE_kwargs) -> str: return self.held_object.replace(args[0], args[1]) @noKwargs @typed_pos_args('str.split', optargs=[str]) def split_method(self, args: T.Tuple[T.Optional[str]], kwargs: TYPE_kwargs) -> T.List[str]: return self.held_object.split(args[0]) @noKwargs @typed_pos_args('str.strip', optargs=[str]) def strip_method(self, args: T.Tuple[T.Optional[str]], kwargs: TYPE_kwargs) -> str: return self.held_object.strip(args[0]) @noKwargs @typed_pos_args('str.substring', optargs=[int, int]) def substring_method(self, args: T.Tuple[T.Optional[int], T.Optional[int]], kwargs: TYPE_kwargs) -> str: start = args[0] if args[0] is not None else 0 end = args[1] if args[1] is not None else len(self.held_object) return self.held_object[start:end] @noKwargs @noPosargs def to_int_method(self, args: T.List[TYPE_var], kwargs: TYPE_kwargs) -> int: try: return int(self.held_object) except ValueError: raise InvalidArguments(f'String {self.held_object!r} cannot be converted to int') @noKwargs @noPosargs def to_lower_method(self, args: T.List[TYPE_var], kwargs: TYPE_kwargs) -> str: return self.held_object.lower() @noKwargs @noPosargs def to_upper_method(self, args: T.List[TYPE_var], kwargs: TYPE_kwargs) -> str: return self.held_object.upper() @noKwargs @noPosargs def underscorify_method(self, args: T.List[TYPE_var], kwargs: TYPE_kwargs) -> str: return re.sub(r'[^a-zA-Z0-9]', '_', self.held_object) @noKwargs @typed_pos_args('str.version_compare', str) def version_compare_method(self, args: T.Tuple[str], kwargs: TYPE_kwargs) -> bool: return version_compare(self.held_object, args[0]) @FeatureNew('/ with string arguments', '0.49.0') @typed_operator(MesonOperator.DIV, str) def op_div(self, other: str) -> str: return os.path.join(self.held_object, other).replace('\\', '/') @typed_operator(MesonOperator.INDEX, int) def op_index(self, other: int) -> str: try: return self.held_object[other] except IndexError: raise InvalidArguments(f'Index {other} out of bounds of string of size {len(self.held_object)}.') class MesonVersionString(str): pass class MesonVersionStringHolder(StringHolder): @noKwargs @typed_pos_args('str.version_compare', str) def version_compare_method(self, args: T.Tuple[str], kwargs: TYPE_kwargs) -> bool: self.interpreter.tmp_meson_version = args[0] return version_compare(self.held_object, args[0])
mesonbuild/meson
mesonbuild/interpreter/primitives/string.py
Python
apache-2.0
6,549
0.003207
def flatten(dictionary): stack = [((), dictionary)] result = {} while stack: path, current = stack.pop() for k, v in current.items(): if isinstance(v, dict) and bool(v): stack.append((path + (k,), v)) else: whatadd = "" if isinstance (v, dict) else v result["/".join((path + (k,)))] = whatadd return result if __name__ == '__main__': assert flatten({"key": "value"}) == {"key": "value"}, "Simple" assert flatten( {"key": {"deeper": {"more": {"enough": "value"}}}} ) == {"key/deeper/more/enough": "value"}, "Nested" assert flatten({"empty": {}}) == {"empty": ""}, "Empty value" assert flatten({"name": { "first": "One", "last": "Drone"}, "job": "scout", "recent": {}, "additional": { "place": { "zone": "1", "cell": "2"}}} ) == {"name/first": "One", "name/last": "Drone", "job": "scout", "recent": "", "additional/place/zone": "1", "additional/place/cell": "2"}
nesterione/problem-solving-and-algorithms
problems/Checkio/TheFlatDictionary.py
Python
apache-2.0
1,262
0.003962