body_hash
stringlengths 64
64
| body
stringlengths 23
109k
| docstring
stringlengths 1
57k
| path
stringlengths 4
198
| name
stringlengths 1
115
| repository_name
stringlengths 7
111
| repository_stars
float64 0
191k
| lang
stringclasses 1
value | body_without_docstring
stringlengths 14
108k
| unified
stringlengths 45
133k
|
---|---|---|---|---|---|---|---|---|---|
05446ab8c39ac298fb49537b1db7fd79b46ccacfc3901b0ebb214a72c1199b33
|
def update_aps_command(client: MsClient, args: dict):
'Updating Analytics Platform System\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
setting_name = args.get('setting_name')
auto_provision = args.get('auto_provision')
setting = client.update_aps(setting_name, auto_provision)
outputs = [{'Name': setting.get('name'), 'AutoProvision': (setting['properties']['auto_provision'] if (setting.get('properties') and setting.get('properties').get('auto_provision')) else None), 'ID': setting.get('id')}]
md = tableToMarkdown('Azure Security Center - Update Auto Provisioning Setting', outputs, ['Name', 'AutoProvision', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.AutoProvisioningSetting(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, setting)
|
Updating Analytics Platform System
Args:
client:
args (dict): usually demisto.args()
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
update_aps_command
|
jon-athon/content
| 799 |
python
|
def update_aps_command(client: MsClient, args: dict):
'Updating Analytics Platform System\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
setting_name = args.get('setting_name')
auto_provision = args.get('auto_provision')
setting = client.update_aps(setting_name, auto_provision)
outputs = [{'Name': setting.get('name'), 'AutoProvision': (setting['properties']['auto_provision'] if (setting.get('properties') and setting.get('properties').get('auto_provision')) else None), 'ID': setting.get('id')}]
md = tableToMarkdown('Azure Security Center - Update Auto Provisioning Setting', outputs, ['Name', 'AutoProvision', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.AutoProvisioningSetting(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, setting)
|
def update_aps_command(client: MsClient, args: dict):
'Updating Analytics Platform System\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
setting_name = args.get('setting_name')
auto_provision = args.get('auto_provision')
setting = client.update_aps(setting_name, auto_provision)
outputs = [{'Name': setting.get('name'), 'AutoProvision': (setting['properties']['auto_provision'] if (setting.get('properties') and setting.get('properties').get('auto_provision')) else None), 'ID': setting.get('id')}]
md = tableToMarkdown('Azure Security Center - Update Auto Provisioning Setting', outputs, ['Name', 'AutoProvision', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.AutoProvisioningSetting(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, setting)<|docstring|>Updating Analytics Platform System
Args:
client:
args (dict): usually demisto.args()<|endoftext|>
|
111fdac04f066f652dcf91bce284b5315e0aaf1bc3bf9c87cf565b2024bfd005
|
def list_aps_command(client: MsClient):
'List all Analytics Platform System\n\n '
settings = client.list_aps().get('value')
outputs = []
for setting in settings:
outputs.append({'Name': setting.get('name'), 'AutoProvision': (setting.get('properties').get('autoProvision') if (setting.get('properties') and setting.get('properties').get('autoProvision')) else None), 'ID': setting.get('id')})
md = tableToMarkdown('Azure Security Center - List Auto Provisioning Settings', outputs, ['Name', 'AutoProvision', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.AutoProvisioningSetting(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, settings)
|
List all Analytics Platform System
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
list_aps_command
|
jon-athon/content
| 799 |
python
|
def list_aps_command(client: MsClient):
'\n\n '
settings = client.list_aps().get('value')
outputs = []
for setting in settings:
outputs.append({'Name': setting.get('name'), 'AutoProvision': (setting.get('properties').get('autoProvision') if (setting.get('properties') and setting.get('properties').get('autoProvision')) else None), 'ID': setting.get('id')})
md = tableToMarkdown('Azure Security Center - List Auto Provisioning Settings', outputs, ['Name', 'AutoProvision', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.AutoProvisioningSetting(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, settings)
|
def list_aps_command(client: MsClient):
'\n\n '
settings = client.list_aps().get('value')
outputs = []
for setting in settings:
outputs.append({'Name': setting.get('name'), 'AutoProvision': (setting.get('properties').get('autoProvision') if (setting.get('properties') and setting.get('properties').get('autoProvision')) else None), 'ID': setting.get('id')})
md = tableToMarkdown('Azure Security Center - List Auto Provisioning Settings', outputs, ['Name', 'AutoProvision', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.AutoProvisioningSetting(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, settings)<|docstring|>List all Analytics Platform System<|endoftext|>
|
4e34428813b7a3ca2de28a153b99b4cf154af627539d85675a04571a8ca850c5
|
def get_aps_command(client: MsClient, args: dict):
'Get given Analytics Platform System setting\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
setting_name = args.get('setting_name')
setting = client.get_aps(setting_name)
outputs = [{'Name': setting.get('name'), 'AutoProvision': (setting.get('properties').get('autoProvision') if (setting.get('properties') and setting.get('properties').get('autoProvision')) else None), 'ID': setting['id']}]
md = tableToMarkdown('Azure Security Center - Get Auto Provisioning Setting', outputs, ['Name', 'AutoProvision', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.AutoProvisioningSetting(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, setting)
|
Get given Analytics Platform System setting
Args:
client:
args (dict): usually demisto.args()
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
get_aps_command
|
jon-athon/content
| 799 |
python
|
def get_aps_command(client: MsClient, args: dict):
'Get given Analytics Platform System setting\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
setting_name = args.get('setting_name')
setting = client.get_aps(setting_name)
outputs = [{'Name': setting.get('name'), 'AutoProvision': (setting.get('properties').get('autoProvision') if (setting.get('properties') and setting.get('properties').get('autoProvision')) else None), 'ID': setting['id']}]
md = tableToMarkdown('Azure Security Center - Get Auto Provisioning Setting', outputs, ['Name', 'AutoProvision', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.AutoProvisioningSetting(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, setting)
|
def get_aps_command(client: MsClient, args: dict):
'Get given Analytics Platform System setting\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
setting_name = args.get('setting_name')
setting = client.get_aps(setting_name)
outputs = [{'Name': setting.get('name'), 'AutoProvision': (setting.get('properties').get('autoProvision') if (setting.get('properties') and setting.get('properties').get('autoProvision')) else None), 'ID': setting['id']}]
md = tableToMarkdown('Azure Security Center - Get Auto Provisioning Setting', outputs, ['Name', 'AutoProvision', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.AutoProvisioningSetting(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, setting)<|docstring|>Get given Analytics Platform System setting
Args:
client:
args (dict): usually demisto.args()<|endoftext|>
|
46f3de8b1a3d0f390cade2b2d58b2180efba7f04094a5bb53bad0e019c27fc41
|
def list_ipp_command(client: MsClient, args: dict):
'Listing all Internet Presence Provider\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
management_group = args.get('management_group')
policies = client.list_ipp(management_group).get('value')
outputs = list()
if policies:
for policy in policies:
if (policy.get('properties') and policy.get('properties').get('labels')):
label_names = ', '.join([label.get('displayName') for label in policy['properties']['labels'].values()])
information_type_names = ', '.join([it['displayName'] for it in policy['properties']['informationTypes'].values()])
else:
(label_names, information_type_names) = ('', '')
outputs.append({'Name': policy.get('name'), 'Labels': label_names, 'InformationTypeNames': information_type_names, 'InformationTypes': (policy.get('properties').get('informationTypes') if (policy.get('properties') and policy.get('properties').get('informationTypes')) else None), 'ID': policy['id']})
md = tableToMarkdown('Azure Security Center - List Information Protection Policies', outputs, ['Name', 'Labels', 'InformationTypeNames', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.InformationProtectionPolicy(val.ID && val.ID === obj.ID)': outputs}
entry = {'Type': entryTypes['note'], 'Contents': policies, 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md, 'EntryContext': ec}
demisto.results(entry)
else:
demisto.results('No policies found')
|
Listing all Internet Presence Provider
Args:
client:
args (dict): usually demisto.args()
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
list_ipp_command
|
jon-athon/content
| 799 |
python
|
def list_ipp_command(client: MsClient, args: dict):
'Listing all Internet Presence Provider\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
management_group = args.get('management_group')
policies = client.list_ipp(management_group).get('value')
outputs = list()
if policies:
for policy in policies:
if (policy.get('properties') and policy.get('properties').get('labels')):
label_names = ', '.join([label.get('displayName') for label in policy['properties']['labels'].values()])
information_type_names = ', '.join([it['displayName'] for it in policy['properties']['informationTypes'].values()])
else:
(label_names, information_type_names) = (, )
outputs.append({'Name': policy.get('name'), 'Labels': label_names, 'InformationTypeNames': information_type_names, 'InformationTypes': (policy.get('properties').get('informationTypes') if (policy.get('properties') and policy.get('properties').get('informationTypes')) else None), 'ID': policy['id']})
md = tableToMarkdown('Azure Security Center - List Information Protection Policies', outputs, ['Name', 'Labels', 'InformationTypeNames', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.InformationProtectionPolicy(val.ID && val.ID === obj.ID)': outputs}
entry = {'Type': entryTypes['note'], 'Contents': policies, 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md, 'EntryContext': ec}
demisto.results(entry)
else:
demisto.results('No policies found')
|
def list_ipp_command(client: MsClient, args: dict):
'Listing all Internet Presence Provider\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
management_group = args.get('management_group')
policies = client.list_ipp(management_group).get('value')
outputs = list()
if policies:
for policy in policies:
if (policy.get('properties') and policy.get('properties').get('labels')):
label_names = ', '.join([label.get('displayName') for label in policy['properties']['labels'].values()])
information_type_names = ', '.join([it['displayName'] for it in policy['properties']['informationTypes'].values()])
else:
(label_names, information_type_names) = (, )
outputs.append({'Name': policy.get('name'), 'Labels': label_names, 'InformationTypeNames': information_type_names, 'InformationTypes': (policy.get('properties').get('informationTypes') if (policy.get('properties') and policy.get('properties').get('informationTypes')) else None), 'ID': policy['id']})
md = tableToMarkdown('Azure Security Center - List Information Protection Policies', outputs, ['Name', 'Labels', 'InformationTypeNames', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.InformationProtectionPolicy(val.ID && val.ID === obj.ID)': outputs}
entry = {'Type': entryTypes['note'], 'Contents': policies, 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md, 'EntryContext': ec}
demisto.results(entry)
else:
demisto.results('No policies found')<|docstring|>Listing all Internet Presence Provider
Args:
client:
args (dict): usually demisto.args()<|endoftext|>
|
0ae0ad0b69fdb2e67978babfbc6a4ea3735a9cf2381546bc92c5402b7611f5f7
|
def get_ipp_command(client: MsClient, args: dict):
'Getting Internet Presence Provider information\n Args:\n client:\n args (dict): usually demisto.args()\n '
policy_name = args.get('policy_name')
management_group = args.get('management_group')
policy = client.get_ipp(policy_name, management_group)
properties = policy.get('properties')
labels = properties.get('labels')
if (properties and isinstance(labels, dict)):
labels = ', '.join([(str(label.get('displayName')) + str(label.get('enabled'))) for label in labels.values()])
basic_table_output = [{'Name': policy.get('name'), 'Labels': labels, 'ID': policy.get('id')}]
md = tableToMarkdown('Azure Security Center - Get Information Protection Policy - Basic Property', basic_table_output, ['Name', 'Labels', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.InformationProtectionPolicy(val.ID && val.ID === obj.ID)': basic_table_output}
basic_table_entry = {'Type': entryTypes['note'], 'Contents': policy, 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md, 'EntryContext': ec}
info_type_table_output = list()
for information_type_data in properties.get('informationTypes').values():
keywords = ', '.join([((str(keyword.get('displayName')) + str(keyword.get('custom'))) + str(keyword.get('canBeNumeric'))) for keyword in information_type_data.get('keywords', [])])
info_type_table_output.append({'DisplayName': information_type_data.get('displayname'), 'Enabled': information_type_data('enabled'), 'Custom': information_type_data('custom'), 'Keywords': keywords, 'RecommendedLabelID': information_type_data('recommendedLabelId')})
md = tableToMarkdown('Azure Security Center - Get Information Protection Policy - Information Types', info_type_table_output, ['DisplayName', 'Enabled', 'Custom', 'Keywords', 'RecommendedLabelID'], removeNull=True)
info_type_table_entry = {'Type': entryTypes['note'], 'Contents': properties.get('informationTypes'), 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md}
demisto.results([basic_table_entry, info_type_table_entry])
else:
demisto.results('No properties found in {}'.format(management_group))
|
Getting Internet Presence Provider information
Args:
client:
args (dict): usually demisto.args()
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
get_ipp_command
|
jon-athon/content
| 799 |
python
|
def get_ipp_command(client: MsClient, args: dict):
'Getting Internet Presence Provider information\n Args:\n client:\n args (dict): usually demisto.args()\n '
policy_name = args.get('policy_name')
management_group = args.get('management_group')
policy = client.get_ipp(policy_name, management_group)
properties = policy.get('properties')
labels = properties.get('labels')
if (properties and isinstance(labels, dict)):
labels = ', '.join([(str(label.get('displayName')) + str(label.get('enabled'))) for label in labels.values()])
basic_table_output = [{'Name': policy.get('name'), 'Labels': labels, 'ID': policy.get('id')}]
md = tableToMarkdown('Azure Security Center - Get Information Protection Policy - Basic Property', basic_table_output, ['Name', 'Labels', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.InformationProtectionPolicy(val.ID && val.ID === obj.ID)': basic_table_output}
basic_table_entry = {'Type': entryTypes['note'], 'Contents': policy, 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md, 'EntryContext': ec}
info_type_table_output = list()
for information_type_data in properties.get('informationTypes').values():
keywords = ', '.join([((str(keyword.get('displayName')) + str(keyword.get('custom'))) + str(keyword.get('canBeNumeric'))) for keyword in information_type_data.get('keywords', [])])
info_type_table_output.append({'DisplayName': information_type_data.get('displayname'), 'Enabled': information_type_data('enabled'), 'Custom': information_type_data('custom'), 'Keywords': keywords, 'RecommendedLabelID': information_type_data('recommendedLabelId')})
md = tableToMarkdown('Azure Security Center - Get Information Protection Policy - Information Types', info_type_table_output, ['DisplayName', 'Enabled', 'Custom', 'Keywords', 'RecommendedLabelID'], removeNull=True)
info_type_table_entry = {'Type': entryTypes['note'], 'Contents': properties.get('informationTypes'), 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md}
demisto.results([basic_table_entry, info_type_table_entry])
else:
demisto.results('No properties found in {}'.format(management_group))
|
def get_ipp_command(client: MsClient, args: dict):
'Getting Internet Presence Provider information\n Args:\n client:\n args (dict): usually demisto.args()\n '
policy_name = args.get('policy_name')
management_group = args.get('management_group')
policy = client.get_ipp(policy_name, management_group)
properties = policy.get('properties')
labels = properties.get('labels')
if (properties and isinstance(labels, dict)):
labels = ', '.join([(str(label.get('displayName')) + str(label.get('enabled'))) for label in labels.values()])
basic_table_output = [{'Name': policy.get('name'), 'Labels': labels, 'ID': policy.get('id')}]
md = tableToMarkdown('Azure Security Center - Get Information Protection Policy - Basic Property', basic_table_output, ['Name', 'Labels', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.InformationProtectionPolicy(val.ID && val.ID === obj.ID)': basic_table_output}
basic_table_entry = {'Type': entryTypes['note'], 'Contents': policy, 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md, 'EntryContext': ec}
info_type_table_output = list()
for information_type_data in properties.get('informationTypes').values():
keywords = ', '.join([((str(keyword.get('displayName')) + str(keyword.get('custom'))) + str(keyword.get('canBeNumeric'))) for keyword in information_type_data.get('keywords', [])])
info_type_table_output.append({'DisplayName': information_type_data.get('displayname'), 'Enabled': information_type_data('enabled'), 'Custom': information_type_data('custom'), 'Keywords': keywords, 'RecommendedLabelID': information_type_data('recommendedLabelId')})
md = tableToMarkdown('Azure Security Center - Get Information Protection Policy - Information Types', info_type_table_output, ['DisplayName', 'Enabled', 'Custom', 'Keywords', 'RecommendedLabelID'], removeNull=True)
info_type_table_entry = {'Type': entryTypes['note'], 'Contents': properties.get('informationTypes'), 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md}
demisto.results([basic_table_entry, info_type_table_entry])
else:
demisto.results('No properties found in {}'.format(management_group))<|docstring|>Getting Internet Presence Provider information
Args:
client:
args (dict): usually demisto.args()<|endoftext|>
|
7302bad45ef2162e69df8921ae5b37414318208c830d4026a0a8f3da4534cd18
|
def list_jit_command(client: MsClient, args: dict):
'Lists all Just-in-time Virtual Machines\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
asc_location = args.get('asc_location')
resource_group_name = args.get('resource_group_name')
policies = client.list_jit(asc_location, resource_group_name)['value']
outputs = []
for policy in policies:
if (policy.get('properties') and policy.get('properties').get('virtualMachines')):
rules_data = policy['properties']['virtualMachines']
rules_summary_array = []
for rule in rules_data:
ID = rule.get('id')
if isinstance(ID, str):
vm_name = ID.split('/')[(- 1)]
else:
vm_name = None
vm_ports = [str(port.get('number')) for port in rule.get('ports')]
rules_summary_array.append('({}: {})'.format(vm_name, ', '.join(vm_ports)))
rules = ', '.join(rules_summary_array)
outputs.append({'Name': policy.get('name'), 'Rules': rules, 'Location': policy.get('location'), 'Kind': policy.get('kind'), 'ID': policy.get('id')})
md = tableToMarkdown('Azure Security Center - List JIT Access Policies', outputs, ['Name', 'Rules', 'Location', 'Kind'], removeNull=True)
ec = {'AzureSecurityCenter.JITPolicy(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, policies)
|
Lists all Just-in-time Virtual Machines
Args:
client:
args (dict): usually demisto.args()
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
list_jit_command
|
jon-athon/content
| 799 |
python
|
def list_jit_command(client: MsClient, args: dict):
'Lists all Just-in-time Virtual Machines\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
asc_location = args.get('asc_location')
resource_group_name = args.get('resource_group_name')
policies = client.list_jit(asc_location, resource_group_name)['value']
outputs = []
for policy in policies:
if (policy.get('properties') and policy.get('properties').get('virtualMachines')):
rules_data = policy['properties']['virtualMachines']
rules_summary_array = []
for rule in rules_data:
ID = rule.get('id')
if isinstance(ID, str):
vm_name = ID.split('/')[(- 1)]
else:
vm_name = None
vm_ports = [str(port.get('number')) for port in rule.get('ports')]
rules_summary_array.append('({}: {})'.format(vm_name, ', '.join(vm_ports)))
rules = ', '.join(rules_summary_array)
outputs.append({'Name': policy.get('name'), 'Rules': rules, 'Location': policy.get('location'), 'Kind': policy.get('kind'), 'ID': policy.get('id')})
md = tableToMarkdown('Azure Security Center - List JIT Access Policies', outputs, ['Name', 'Rules', 'Location', 'Kind'], removeNull=True)
ec = {'AzureSecurityCenter.JITPolicy(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, policies)
|
def list_jit_command(client: MsClient, args: dict):
'Lists all Just-in-time Virtual Machines\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
asc_location = args.get('asc_location')
resource_group_name = args.get('resource_group_name')
policies = client.list_jit(asc_location, resource_group_name)['value']
outputs = []
for policy in policies:
if (policy.get('properties') and policy.get('properties').get('virtualMachines')):
rules_data = policy['properties']['virtualMachines']
rules_summary_array = []
for rule in rules_data:
ID = rule.get('id')
if isinstance(ID, str):
vm_name = ID.split('/')[(- 1)]
else:
vm_name = None
vm_ports = [str(port.get('number')) for port in rule.get('ports')]
rules_summary_array.append('({}: {})'.format(vm_name, ', '.join(vm_ports)))
rules = ', '.join(rules_summary_array)
outputs.append({'Name': policy.get('name'), 'Rules': rules, 'Location': policy.get('location'), 'Kind': policy.get('kind'), 'ID': policy.get('id')})
md = tableToMarkdown('Azure Security Center - List JIT Access Policies', outputs, ['Name', 'Rules', 'Location', 'Kind'], removeNull=True)
ec = {'AzureSecurityCenter.JITPolicy(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, policies)<|docstring|>Lists all Just-in-time Virtual Machines
Args:
client:
args (dict): usually demisto.args()<|endoftext|>
|
c1e9d5c358d86ddd4174e2e771c31cf1b60442e9cfa0d58ff35ecb619c42639d
|
def get_jit_command(client: MsClient, args: dict):
'Getting given Just-in-time machine\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
policy_name = args.get('policy_name')
asc_location = args.get('asc_location')
resource_group_name = args.get('resource_group_name')
policy = client.get_jit(policy_name, asc_location, resource_group_name)
property_table_output = [{'Name': policy.get('name'), 'Kind': policy.get('kind'), 'ProvisioningState': (policy.get('properties').get('provisioningState') if (policy.get('properties') and policy.get('properties', {}).get('provisioningState')) else None), 'Location': policy.get('location'), 'Rules': (policy.get('properties').get('virtualMachines') if (policy.get('properties') and policy.get('properties', {}).get('virtualMachines')) else None), 'Requests': (policy.get('properties').get('requests') if (policy.get('properties') and policy.get('properties', {}).get('requests')) else None), 'ID': policy.get('id')}]
md = tableToMarkdown('Azure Security Center - Get JIT Access Policy - Properties', property_table_output, ['Name', 'Kind', 'ProvisioningState', 'Location', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.JITPolicy(val.ID && val.ID === obj.ID)': property_table_output}
property_table_entry = {'Type': entryTypes['note'], 'Contents': policy, 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md, 'EntryContext': ec}
rules_table_output = list()
properties = policy.get('properties')
virtual_machines = properties.get('virtualMachines')
if (isinstance(properties, dict) and virtual_machines):
for rule in virtual_machines:
rules_table_output.append({'VmID': rule.get('id'), 'Ports': format_jit_port_rule(rule.get('ports'))})
md = tableToMarkdown('Azure Security Center - Get JIT Access Policy - Rules', rules_table_output, ['VmID', 'Ports'], removeNull=True)
rules_table_entry = {'Type': entryTypes['note'], 'Contents': properties.get('virtualMachines'), 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md}
requests_table_output = list()
for requestData in properties.get('requests', []):
vms = list()
for vm in requestData.get('virtualMachines'):
vm_name = vm['id'].split('/')[(- 1)]
vm_ports = format_jit_port_request(vm.get('ports'))
vms.append('[{}: {}]'.format(vm_name, vm_ports))
requests_table_output.append({'VirtualMachines': ', '.join(vms), 'Requestor': (requestData.get('requestor') if requestData.get('requestor') else 'service-account'), 'StartTimeUtc': requestData.get('startTimeUtc')})
md = tableToMarkdown('Azure Security Center - Get JIT Access Policy - Requests', requests_table_output, ['VirtualMachines', 'Requestor', 'StartTimeUtc'], removeNull=True)
requests_table_entry = {'Type': entryTypes['note'], 'Contents': properties.get('requests'), 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md}
demisto.results([property_table_entry, rules_table_entry, requests_table_entry])
|
Getting given Just-in-time machine
Args:
client:
args (dict): usually demisto.args()
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
get_jit_command
|
jon-athon/content
| 799 |
python
|
def get_jit_command(client: MsClient, args: dict):
'Getting given Just-in-time machine\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
policy_name = args.get('policy_name')
asc_location = args.get('asc_location')
resource_group_name = args.get('resource_group_name')
policy = client.get_jit(policy_name, asc_location, resource_group_name)
property_table_output = [{'Name': policy.get('name'), 'Kind': policy.get('kind'), 'ProvisioningState': (policy.get('properties').get('provisioningState') if (policy.get('properties') and policy.get('properties', {}).get('provisioningState')) else None), 'Location': policy.get('location'), 'Rules': (policy.get('properties').get('virtualMachines') if (policy.get('properties') and policy.get('properties', {}).get('virtualMachines')) else None), 'Requests': (policy.get('properties').get('requests') if (policy.get('properties') and policy.get('properties', {}).get('requests')) else None), 'ID': policy.get('id')}]
md = tableToMarkdown('Azure Security Center - Get JIT Access Policy - Properties', property_table_output, ['Name', 'Kind', 'ProvisioningState', 'Location', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.JITPolicy(val.ID && val.ID === obj.ID)': property_table_output}
property_table_entry = {'Type': entryTypes['note'], 'Contents': policy, 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md, 'EntryContext': ec}
rules_table_output = list()
properties = policy.get('properties')
virtual_machines = properties.get('virtualMachines')
if (isinstance(properties, dict) and virtual_machines):
for rule in virtual_machines:
rules_table_output.append({'VmID': rule.get('id'), 'Ports': format_jit_port_rule(rule.get('ports'))})
md = tableToMarkdown('Azure Security Center - Get JIT Access Policy - Rules', rules_table_output, ['VmID', 'Ports'], removeNull=True)
rules_table_entry = {'Type': entryTypes['note'], 'Contents': properties.get('virtualMachines'), 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md}
requests_table_output = list()
for requestData in properties.get('requests', []):
vms = list()
for vm in requestData.get('virtualMachines'):
vm_name = vm['id'].split('/')[(- 1)]
vm_ports = format_jit_port_request(vm.get('ports'))
vms.append('[{}: {}]'.format(vm_name, vm_ports))
requests_table_output.append({'VirtualMachines': ', '.join(vms), 'Requestor': (requestData.get('requestor') if requestData.get('requestor') else 'service-account'), 'StartTimeUtc': requestData.get('startTimeUtc')})
md = tableToMarkdown('Azure Security Center - Get JIT Access Policy - Requests', requests_table_output, ['VirtualMachines', 'Requestor', 'StartTimeUtc'], removeNull=True)
requests_table_entry = {'Type': entryTypes['note'], 'Contents': properties.get('requests'), 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md}
demisto.results([property_table_entry, rules_table_entry, requests_table_entry])
|
def get_jit_command(client: MsClient, args: dict):
'Getting given Just-in-time machine\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
policy_name = args.get('policy_name')
asc_location = args.get('asc_location')
resource_group_name = args.get('resource_group_name')
policy = client.get_jit(policy_name, asc_location, resource_group_name)
property_table_output = [{'Name': policy.get('name'), 'Kind': policy.get('kind'), 'ProvisioningState': (policy.get('properties').get('provisioningState') if (policy.get('properties') and policy.get('properties', {}).get('provisioningState')) else None), 'Location': policy.get('location'), 'Rules': (policy.get('properties').get('virtualMachines') if (policy.get('properties') and policy.get('properties', {}).get('virtualMachines')) else None), 'Requests': (policy.get('properties').get('requests') if (policy.get('properties') and policy.get('properties', {}).get('requests')) else None), 'ID': policy.get('id')}]
md = tableToMarkdown('Azure Security Center - Get JIT Access Policy - Properties', property_table_output, ['Name', 'Kind', 'ProvisioningState', 'Location', 'ID'], removeNull=True)
ec = {'AzureSecurityCenter.JITPolicy(val.ID && val.ID === obj.ID)': property_table_output}
property_table_entry = {'Type': entryTypes['note'], 'Contents': policy, 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md, 'EntryContext': ec}
rules_table_output = list()
properties = policy.get('properties')
virtual_machines = properties.get('virtualMachines')
if (isinstance(properties, dict) and virtual_machines):
for rule in virtual_machines:
rules_table_output.append({'VmID': rule.get('id'), 'Ports': format_jit_port_rule(rule.get('ports'))})
md = tableToMarkdown('Azure Security Center - Get JIT Access Policy - Rules', rules_table_output, ['VmID', 'Ports'], removeNull=True)
rules_table_entry = {'Type': entryTypes['note'], 'Contents': properties.get('virtualMachines'), 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md}
requests_table_output = list()
for requestData in properties.get('requests', []):
vms = list()
for vm in requestData.get('virtualMachines'):
vm_name = vm['id'].split('/')[(- 1)]
vm_ports = format_jit_port_request(vm.get('ports'))
vms.append('[{}: {}]'.format(vm_name, vm_ports))
requests_table_output.append({'VirtualMachines': ', '.join(vms), 'Requestor': (requestData.get('requestor') if requestData.get('requestor') else 'service-account'), 'StartTimeUtc': requestData.get('startTimeUtc')})
md = tableToMarkdown('Azure Security Center - Get JIT Access Policy - Requests', requests_table_output, ['VirtualMachines', 'Requestor', 'StartTimeUtc'], removeNull=True)
requests_table_entry = {'Type': entryTypes['note'], 'Contents': properties.get('requests'), 'ContentsFormat': formats['json'], 'ReadableContentsFormat': formats['markdown'], 'HumanReadable': md}
demisto.results([property_table_entry, rules_table_entry, requests_table_entry])<|docstring|>Getting given Just-in-time machine
Args:
client:
args (dict): usually demisto.args()<|endoftext|>
|
d42c804f136b1b441f5a52aa9a92b280fee191e9c1e94a0b6f2d1aac6cda2425
|
def delete_jit_command(client: MsClient, args: dict):
'Deletes a Just-in-time machine\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
asc_location = args.get('asc_location')
resource_group_name = args.get('resource_group_name')
policy_name = args.get('policy_name')
client.delete_jit(asc_location, resource_group_name, policy_name)
policy_id = f'/subscriptions/{client.subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Security/locations/{asc_location}/jitNetworkAccessPolicies/{policy_name}'
outputs = {'ID': policy_id, 'Action': 'deleted'}
ec = {'AzureSecurityCenter.JITPolicy(val.ID && val.ID === obj.ID)': outputs}
demisto.results({'Type': entryTypes['note'], 'Contents': 'Policy - {} has been deleted sucessfully.'.format(policy_name), 'ContentsFormat': formats['text'], 'EntryContext': ec})
|
Deletes a Just-in-time machine
Args:
client:
args (dict): usually demisto.args()
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
delete_jit_command
|
jon-athon/content
| 799 |
python
|
def delete_jit_command(client: MsClient, args: dict):
'Deletes a Just-in-time machine\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
asc_location = args.get('asc_location')
resource_group_name = args.get('resource_group_name')
policy_name = args.get('policy_name')
client.delete_jit(asc_location, resource_group_name, policy_name)
policy_id = f'/subscriptions/{client.subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Security/locations/{asc_location}/jitNetworkAccessPolicies/{policy_name}'
outputs = {'ID': policy_id, 'Action': 'deleted'}
ec = {'AzureSecurityCenter.JITPolicy(val.ID && val.ID === obj.ID)': outputs}
demisto.results({'Type': entryTypes['note'], 'Contents': 'Policy - {} has been deleted sucessfully.'.format(policy_name), 'ContentsFormat': formats['text'], 'EntryContext': ec})
|
def delete_jit_command(client: MsClient, args: dict):
'Deletes a Just-in-time machine\n\n Args:\n client:\n args (dict): usually demisto.args()\n '
asc_location = args.get('asc_location')
resource_group_name = args.get('resource_group_name')
policy_name = args.get('policy_name')
client.delete_jit(asc_location, resource_group_name, policy_name)
policy_id = f'/subscriptions/{client.subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Security/locations/{asc_location}/jitNetworkAccessPolicies/{policy_name}'
outputs = {'ID': policy_id, 'Action': 'deleted'}
ec = {'AzureSecurityCenter.JITPolicy(val.ID && val.ID === obj.ID)': outputs}
demisto.results({'Type': entryTypes['note'], 'Contents': 'Policy - {} has been deleted sucessfully.'.format(policy_name), 'ContentsFormat': formats['text'], 'EntryContext': ec})<|docstring|>Deletes a Just-in-time machine
Args:
client:
args (dict): usually demisto.args()<|endoftext|>
|
faf5fb56c4b2f5414e939ee292f7eb6d172d5ea90303655a707d10d9f1ec01c5
|
def list_sc_storage_command(client: MsClient):
'Listing all Security Center Storages\n\n '
accounts = client.list_sc_storage().get('value')
outputs = list()
for account in accounts:
account_id_array = account.get('id', str()).split('/')
resource_group_name = account_id_array[(account_id_array.index('resourceGroups') + 1)]
outputs.append({'Name': account.get('name'), 'ResourceGroupName': resource_group_name, 'Location': account.get('location'), 'ID': account.get('id')})
md = tableToMarkdown('Azure Security Center - List Storage Accounts', outputs, ['Name', 'ResourceGroupName', 'Location'], removeNull=True)
ec = {'AzureSecurityCenter.Storage(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, accounts)
|
Listing all Security Center Storages
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
list_sc_storage_command
|
jon-athon/content
| 799 |
python
|
def list_sc_storage_command(client: MsClient):
'\n\n '
accounts = client.list_sc_storage().get('value')
outputs = list()
for account in accounts:
account_id_array = account.get('id', str()).split('/')
resource_group_name = account_id_array[(account_id_array.index('resourceGroups') + 1)]
outputs.append({'Name': account.get('name'), 'ResourceGroupName': resource_group_name, 'Location': account.get('location'), 'ID': account.get('id')})
md = tableToMarkdown('Azure Security Center - List Storage Accounts', outputs, ['Name', 'ResourceGroupName', 'Location'], removeNull=True)
ec = {'AzureSecurityCenter.Storage(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, accounts)
|
def list_sc_storage_command(client: MsClient):
'\n\n '
accounts = client.list_sc_storage().get('value')
outputs = list()
for account in accounts:
account_id_array = account.get('id', str()).split('/')
resource_group_name = account_id_array[(account_id_array.index('resourceGroups') + 1)]
outputs.append({'Name': account.get('name'), 'ResourceGroupName': resource_group_name, 'Location': account.get('location'), 'ID': account.get('id')})
md = tableToMarkdown('Azure Security Center - List Storage Accounts', outputs, ['Name', 'ResourceGroupName', 'Location'], removeNull=True)
ec = {'AzureSecurityCenter.Storage(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, accounts)<|docstring|>Listing all Security Center Storages<|endoftext|>
|
5a9e0821a1a3f35b97642d15cd6423f78b81026638515eda00164f749b6eb374
|
def list_sc_subscriptions_command(client: MsClient):
'Listing Subscriptions for this application\n\n '
subscriptions = client.list_sc_subscriptions().get('value')
outputs = list()
for sub in subscriptions:
outputs.append({'Name': sub.get('displayName'), 'State': sub.get('state'), 'ID': sub.get('id')})
md = tableToMarkdown('Azure Security Center - Subscriptions', outputs, ['ID', 'Name', 'State'], removeNull=True)
ec = {'Azure.Subscription(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, subscriptions)
|
Listing Subscriptions for this application
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
list_sc_subscriptions_command
|
jon-athon/content
| 799 |
python
|
def list_sc_subscriptions_command(client: MsClient):
'\n\n '
subscriptions = client.list_sc_subscriptions().get('value')
outputs = list()
for sub in subscriptions:
outputs.append({'Name': sub.get('displayName'), 'State': sub.get('state'), 'ID': sub.get('id')})
md = tableToMarkdown('Azure Security Center - Subscriptions', outputs, ['ID', 'Name', 'State'], removeNull=True)
ec = {'Azure.Subscription(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, subscriptions)
|
def list_sc_subscriptions_command(client: MsClient):
'\n\n '
subscriptions = client.list_sc_subscriptions().get('value')
outputs = list()
for sub in subscriptions:
outputs.append({'Name': sub.get('displayName'), 'State': sub.get('state'), 'ID': sub.get('id')})
md = tableToMarkdown('Azure Security Center - Subscriptions', outputs, ['ID', 'Name', 'State'], removeNull=True)
ec = {'Azure.Subscription(val.ID && val.ID === obj.ID)': outputs}
return (md, ec, subscriptions)<|docstring|>Listing Subscriptions for this application<|endoftext|>
|
bdbf76a6b7daec7409f9a11abc14050a2dc8e5e80fb2ab9ff7472a31ff7ba596
|
def test_module(client: MsClient):
'\n Performs basic GET request to check if the API is reachable and authentication is successful.\n Returns ok if successful.\n '
if client.subscription_id:
client.list_locations()
else:
client.list_sc_subscriptions()
demisto.results('ok')
|
Performs basic GET request to check if the API is reachable and authentication is successful.
Returns ok if successful.
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
test_module
|
jon-athon/content
| 799 |
python
|
def test_module(client: MsClient):
'\n Performs basic GET request to check if the API is reachable and authentication is successful.\n Returns ok if successful.\n '
if client.subscription_id:
client.list_locations()
else:
client.list_sc_subscriptions()
demisto.results('ok')
|
def test_module(client: MsClient):
'\n Performs basic GET request to check if the API is reachable and authentication is successful.\n Returns ok if successful.\n '
if client.subscription_id:
client.list_locations()
else:
client.list_sc_subscriptions()
demisto.results('ok')<|docstring|>Performs basic GET request to check if the API is reachable and authentication is successful.
Returns ok if successful.<|endoftext|>
|
db5205f05b3861eef4308b8ea26c8f9c8b89014b3c2b920ec1ac101a7fc66ca2
|
def get_alert(self, resource_group_name, asc_location, alert_id):
'\n Args:\n resource_group_name (str): ResourceGroupName\n asc_location (str): Azure Security Center location\n alert_id (str): Alert ID\n\n Returns:\n response body (dict)\n\n '
cmd_url = (f'/resourceGroups/{resource_group_name}' if resource_group_name else '')
cmd_url += f'/providers/Microsoft.Security/locations/{asc_location}/alerts/{alert_id}'
params = {'api-version': ALERT_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
Args:
resource_group_name (str): ResourceGroupName
asc_location (str): Azure Security Center location
alert_id (str): Alert ID
Returns:
response body (dict)
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
get_alert
|
jon-athon/content
| 799 |
python
|
def get_alert(self, resource_group_name, asc_location, alert_id):
'\n Args:\n resource_group_name (str): ResourceGroupName\n asc_location (str): Azure Security Center location\n alert_id (str): Alert ID\n\n Returns:\n response body (dict)\n\n '
cmd_url = (f'/resourceGroups/{resource_group_name}' if resource_group_name else )
cmd_url += f'/providers/Microsoft.Security/locations/{asc_location}/alerts/{alert_id}'
params = {'api-version': ALERT_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
def get_alert(self, resource_group_name, asc_location, alert_id):
'\n Args:\n resource_group_name (str): ResourceGroupName\n asc_location (str): Azure Security Center location\n alert_id (str): Alert ID\n\n Returns:\n response body (dict)\n\n '
cmd_url = (f'/resourceGroups/{resource_group_name}' if resource_group_name else )
cmd_url += f'/providers/Microsoft.Security/locations/{asc_location}/alerts/{alert_id}'
params = {'api-version': ALERT_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)<|docstring|>Args:
resource_group_name (str): ResourceGroupName
asc_location (str): Azure Security Center location
alert_id (str): Alert ID
Returns:
response body (dict)<|endoftext|>
|
972e7dd535a129d69f6539587a11a8dbd713937d6ff6c4b37ae3f4220d8a516e
|
def list_alerts(self, resource_group_name, asc_location, filter_query, select_query, expand_query):
'Listing alerts\n\n Args:\n resource_group_name (str): ResourceGroupName\n asc_location (str): Azure Security Center location\n filter_query (str): what to filter\n select_query (str): what to select\n expand_query (str): what to expand\n\n Returns:\n dict: contains response body\n '
if resource_group_name:
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Security'
if asc_location:
cmd_url += f'/locations/{asc_location}'
cmd_url += '/alerts'
else:
cmd_url = '/providers/Microsoft.Security/alerts'
params = {'api-version': ALERT_API_VERSION}
if filter_query:
params['$filter'] = filter_query
if select_query:
params['$select'] = select_query
if expand_query:
params['$expand'] = expand_query
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
Listing alerts
Args:
resource_group_name (str): ResourceGroupName
asc_location (str): Azure Security Center location
filter_query (str): what to filter
select_query (str): what to select
expand_query (str): what to expand
Returns:
dict: contains response body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
list_alerts
|
jon-athon/content
| 799 |
python
|
def list_alerts(self, resource_group_name, asc_location, filter_query, select_query, expand_query):
'Listing alerts\n\n Args:\n resource_group_name (str): ResourceGroupName\n asc_location (str): Azure Security Center location\n filter_query (str): what to filter\n select_query (str): what to select\n expand_query (str): what to expand\n\n Returns:\n dict: contains response body\n '
if resource_group_name:
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Security'
if asc_location:
cmd_url += f'/locations/{asc_location}'
cmd_url += '/alerts'
else:
cmd_url = '/providers/Microsoft.Security/alerts'
params = {'api-version': ALERT_API_VERSION}
if filter_query:
params['$filter'] = filter_query
if select_query:
params['$select'] = select_query
if expand_query:
params['$expand'] = expand_query
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
def list_alerts(self, resource_group_name, asc_location, filter_query, select_query, expand_query):
'Listing alerts\n\n Args:\n resource_group_name (str): ResourceGroupName\n asc_location (str): Azure Security Center location\n filter_query (str): what to filter\n select_query (str): what to select\n expand_query (str): what to expand\n\n Returns:\n dict: contains response body\n '
if resource_group_name:
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Security'
if asc_location:
cmd_url += f'/locations/{asc_location}'
cmd_url += '/alerts'
else:
cmd_url = '/providers/Microsoft.Security/alerts'
params = {'api-version': ALERT_API_VERSION}
if filter_query:
params['$filter'] = filter_query
if select_query:
params['$select'] = select_query
if expand_query:
params['$expand'] = expand_query
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)<|docstring|>Listing alerts
Args:
resource_group_name (str): ResourceGroupName
asc_location (str): Azure Security Center location
filter_query (str): what to filter
select_query (str): what to select
expand_query (str): what to expand
Returns:
dict: contains response body<|endoftext|>
|
3cef72acaac214e1e17ec6ad48e348e8368613cfaf59ec2a1c1af0c27750e8a9
|
def update_alert(self, resource_group_name, asc_location, alert_id, alert_update_action_type):
'\n Args:\n resource_group_name (str): Resource Name Group\n asc_location (str): Azure Security Center Location\n alert_id (str): Alert ID\n alert_update_action_type (str): What update type need to update\n\n Returns:\n dict: response body\n '
cmd_url = (f'/resourceGroups/{resource_group_name}' if resource_group_name else '')
cmd_url += f'/providers/Microsoft.Security/locations/{asc_location}/alerts/{alert_id}/{alert_update_action_type}'
params = {'api-version': ALERT_API_VERSION}
self.ms_client.http_request(method='POST', url_suffix=cmd_url, params=params, resp_type='response')
|
Args:
resource_group_name (str): Resource Name Group
asc_location (str): Azure Security Center Location
alert_id (str): Alert ID
alert_update_action_type (str): What update type need to update
Returns:
dict: response body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
update_alert
|
jon-athon/content
| 799 |
python
|
def update_alert(self, resource_group_name, asc_location, alert_id, alert_update_action_type):
'\n Args:\n resource_group_name (str): Resource Name Group\n asc_location (str): Azure Security Center Location\n alert_id (str): Alert ID\n alert_update_action_type (str): What update type need to update\n\n Returns:\n dict: response body\n '
cmd_url = (f'/resourceGroups/{resource_group_name}' if resource_group_name else )
cmd_url += f'/providers/Microsoft.Security/locations/{asc_location}/alerts/{alert_id}/{alert_update_action_type}'
params = {'api-version': ALERT_API_VERSION}
self.ms_client.http_request(method='POST', url_suffix=cmd_url, params=params, resp_type='response')
|
def update_alert(self, resource_group_name, asc_location, alert_id, alert_update_action_type):
'\n Args:\n resource_group_name (str): Resource Name Group\n asc_location (str): Azure Security Center Location\n alert_id (str): Alert ID\n alert_update_action_type (str): What update type need to update\n\n Returns:\n dict: response body\n '
cmd_url = (f'/resourceGroups/{resource_group_name}' if resource_group_name else )
cmd_url += f'/providers/Microsoft.Security/locations/{asc_location}/alerts/{alert_id}/{alert_update_action_type}'
params = {'api-version': ALERT_API_VERSION}
self.ms_client.http_request(method='POST', url_suffix=cmd_url, params=params, resp_type='response')<|docstring|>Args:
resource_group_name (str): Resource Name Group
asc_location (str): Azure Security Center Location
alert_id (str): Alert ID
alert_update_action_type (str): What update type need to update
Returns:
dict: response body<|endoftext|>
|
b4a549df9f531f8ab9c7c7b4d34d671ad0868b3d6ef04780249a1eb356d37296
|
def list_locations(self):
'\n Returns:\n dict: response body\n '
cmd_url = '/providers/Microsoft.Security/locations'
params = {'api-version': LOCATION_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
Returns:
dict: response body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
list_locations
|
jon-athon/content
| 799 |
python
|
def list_locations(self):
'\n Returns:\n dict: response body\n '
cmd_url = '/providers/Microsoft.Security/locations'
params = {'api-version': LOCATION_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
def list_locations(self):
'\n Returns:\n dict: response body\n '
cmd_url = '/providers/Microsoft.Security/locations'
params = {'api-version': LOCATION_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)<|docstring|>Returns:
dict: response body<|endoftext|>
|
e8be491aa475e42a62c0cd5db1efcb11f708d6a48195e2533f4d4a14799dfe71
|
def update_atp(self, resource_group_name, storage_account, setting_name, is_enabled):
'\n Args:\n resource_group_name (str): Resource Group Name\n storage_account (str): Storange Account\n setting_name (str): Setting Name\n is_enabled (str): true/false\n\n Returns:\n dict: respones body\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Storage/storageAccounts/{storage_account}/providers/Microsoft.Security/advancedThreatProtectionSettings/{setting_name}'
params = {'api-version': ATP_API_VERSION}
data = {'id': f'/subscriptions/{self.subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Storage/storageAccounts/{storage_account}/providers/Microsoft.Security/advancedThreatProtectionSettings/{setting_name}', 'name': setting_name, 'type': 'Microsoft.Security/advancedThreatProtectionSettings', 'properties': {'isEnabled': is_enabled}}
return self.ms_client.http_request(method='PUT', url_suffix=cmd_url, json_data=data, params=params)
|
Args:
resource_group_name (str): Resource Group Name
storage_account (str): Storange Account
setting_name (str): Setting Name
is_enabled (str): true/false
Returns:
dict: respones body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
update_atp
|
jon-athon/content
| 799 |
python
|
def update_atp(self, resource_group_name, storage_account, setting_name, is_enabled):
'\n Args:\n resource_group_name (str): Resource Group Name\n storage_account (str): Storange Account\n setting_name (str): Setting Name\n is_enabled (str): true/false\n\n Returns:\n dict: respones body\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Storage/storageAccounts/{storage_account}/providers/Microsoft.Security/advancedThreatProtectionSettings/{setting_name}'
params = {'api-version': ATP_API_VERSION}
data = {'id': f'/subscriptions/{self.subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Storage/storageAccounts/{storage_account}/providers/Microsoft.Security/advancedThreatProtectionSettings/{setting_name}', 'name': setting_name, 'type': 'Microsoft.Security/advancedThreatProtectionSettings', 'properties': {'isEnabled': is_enabled}}
return self.ms_client.http_request(method='PUT', url_suffix=cmd_url, json_data=data, params=params)
|
def update_atp(self, resource_group_name, storage_account, setting_name, is_enabled):
'\n Args:\n resource_group_name (str): Resource Group Name\n storage_account (str): Storange Account\n setting_name (str): Setting Name\n is_enabled (str): true/false\n\n Returns:\n dict: respones body\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Storage/storageAccounts/{storage_account}/providers/Microsoft.Security/advancedThreatProtectionSettings/{setting_name}'
params = {'api-version': ATP_API_VERSION}
data = {'id': f'/subscriptions/{self.subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Storage/storageAccounts/{storage_account}/providers/Microsoft.Security/advancedThreatProtectionSettings/{setting_name}', 'name': setting_name, 'type': 'Microsoft.Security/advancedThreatProtectionSettings', 'properties': {'isEnabled': is_enabled}}
return self.ms_client.http_request(method='PUT', url_suffix=cmd_url, json_data=data, params=params)<|docstring|>Args:
resource_group_name (str): Resource Group Name
storage_account (str): Storange Account
setting_name (str): Setting Name
is_enabled (str): true/false
Returns:
dict: respones body<|endoftext|>
|
65652fe841fb55f40ece6f4ce3480964d2178397f89782bc9f3a05c2da6605cb
|
def get_atp(self, resource_group_name, storage_account, setting_name):
'\n Args:\n resource_group_name (str): Resource Group Name\n storage_account (str): Storange Account\n setting_name (str): Setting Name\n\n Returns:\n\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Storage/storageAccounts/{storage_account}/providers/Microsoft.Security/advancedThreatProtectionSettings/{setting_name}'
params = {'api-version': ATP_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
Args:
resource_group_name (str): Resource Group Name
storage_account (str): Storange Account
setting_name (str): Setting Name
Returns:
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
get_atp
|
jon-athon/content
| 799 |
python
|
def get_atp(self, resource_group_name, storage_account, setting_name):
'\n Args:\n resource_group_name (str): Resource Group Name\n storage_account (str): Storange Account\n setting_name (str): Setting Name\n\n Returns:\n\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Storage/storageAccounts/{storage_account}/providers/Microsoft.Security/advancedThreatProtectionSettings/{setting_name}'
params = {'api-version': ATP_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
def get_atp(self, resource_group_name, storage_account, setting_name):
'\n Args:\n resource_group_name (str): Resource Group Name\n storage_account (str): Storange Account\n setting_name (str): Setting Name\n\n Returns:\n\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Storage/storageAccounts/{storage_account}/providers/Microsoft.Security/advancedThreatProtectionSettings/{setting_name}'
params = {'api-version': ATP_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)<|docstring|>Args:
resource_group_name (str): Resource Group Name
storage_account (str): Storange Account
setting_name (str): Setting Name
Returns:<|endoftext|>
|
2613da096a521f737f8e9e0b543c50301acd736877eb9af2697042f37177022b
|
def update_aps(self, setting_name, auto_provision):
'\n Args:\n setting_name (str): Setting name\n auto_provision (str): Auto provision setting (On/Off)\n\n Returns:\n dict: response body\n '
cmd_url = f'/providers/Microsoft.Security/autoProvisioningSettings/{setting_name}'
params = {'api-version': APS_API_VERSION}
data = {'properties': {'autoProvision': auto_provision}}
return self.ms_client.http_request(method='PUT', url_suffix=cmd_url, json_data=data, params=params)
|
Args:
setting_name (str): Setting name
auto_provision (str): Auto provision setting (On/Off)
Returns:
dict: response body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
update_aps
|
jon-athon/content
| 799 |
python
|
def update_aps(self, setting_name, auto_provision):
'\n Args:\n setting_name (str): Setting name\n auto_provision (str): Auto provision setting (On/Off)\n\n Returns:\n dict: response body\n '
cmd_url = f'/providers/Microsoft.Security/autoProvisioningSettings/{setting_name}'
params = {'api-version': APS_API_VERSION}
data = {'properties': {'autoProvision': auto_provision}}
return self.ms_client.http_request(method='PUT', url_suffix=cmd_url, json_data=data, params=params)
|
def update_aps(self, setting_name, auto_provision):
'\n Args:\n setting_name (str): Setting name\n auto_provision (str): Auto provision setting (On/Off)\n\n Returns:\n dict: response body\n '
cmd_url = f'/providers/Microsoft.Security/autoProvisioningSettings/{setting_name}'
params = {'api-version': APS_API_VERSION}
data = {'properties': {'autoProvision': auto_provision}}
return self.ms_client.http_request(method='PUT', url_suffix=cmd_url, json_data=data, params=params)<|docstring|>Args:
setting_name (str): Setting name
auto_provision (str): Auto provision setting (On/Off)
Returns:
dict: response body<|endoftext|>
|
df86078c75e199804266bfab2ed7b39c321d9bf14c09e440b09a7e3867389266
|
def list_aps(self):
'\n Returns:\n dict: response body\n '
cmd_url = '/providers/Microsoft.Security/autoProvisioningSettings'
params = {'api-version': APS_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
Returns:
dict: response body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
list_aps
|
jon-athon/content
| 799 |
python
|
def list_aps(self):
'\n Returns:\n dict: response body\n '
cmd_url = '/providers/Microsoft.Security/autoProvisioningSettings'
params = {'api-version': APS_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
def list_aps(self):
'\n Returns:\n dict: response body\n '
cmd_url = '/providers/Microsoft.Security/autoProvisioningSettings'
params = {'api-version': APS_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)<|docstring|>Returns:
dict: response body<|endoftext|>
|
efe009ab7299d797a14c741b679167bed51324c6b160e58d98bd0deaf38f3615
|
def get_aps(self, setting_name):
'\n Args:\n setting_name: Setting name\n\n Returns:\n dict: response body\n '
cmd_url = f'/providers/Microsoft.Security/autoProvisioningSettings/{setting_name}'
params = {'api-version': APS_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
Args:
setting_name: Setting name
Returns:
dict: response body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
get_aps
|
jon-athon/content
| 799 |
python
|
def get_aps(self, setting_name):
'\n Args:\n setting_name: Setting name\n\n Returns:\n dict: response body\n '
cmd_url = f'/providers/Microsoft.Security/autoProvisioningSettings/{setting_name}'
params = {'api-version': APS_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
def get_aps(self, setting_name):
'\n Args:\n setting_name: Setting name\n\n Returns:\n dict: response body\n '
cmd_url = f'/providers/Microsoft.Security/autoProvisioningSettings/{setting_name}'
params = {'api-version': APS_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)<|docstring|>Args:
setting_name: Setting name
Returns:
dict: response body<|endoftext|>
|
f58c649b9c147f58527eb16dbab1efe6fd73cbc1bffd4a08f64567ba7185bb20
|
def list_ipp(self, management_group=None):
'\n Args:\n management_group: Managment group to pull (if needed)\n\n Returns:\n dict: response body\n\n '
params = {'api-version': IPP_API_VERSION}
cmd_url = '/providers/Microsoft.Security/informationProtectionPolicies'
if management_group:
full_url = f'{self.server}/providers/Microsoft.Management/managementGroups/{management_group}'
full_url += cmd_url
return self.ms_client.http_request(method='GET', full_url=full_url, url_suffix='', params=params)
if (not self.subscription_id):
raise DemistoException('A subscription ID must be provided.')
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
Args:
management_group: Managment group to pull (if needed)
Returns:
dict: response body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
list_ipp
|
jon-athon/content
| 799 |
python
|
def list_ipp(self, management_group=None):
'\n Args:\n management_group: Managment group to pull (if needed)\n\n Returns:\n dict: response body\n\n '
params = {'api-version': IPP_API_VERSION}
cmd_url = '/providers/Microsoft.Security/informationProtectionPolicies'
if management_group:
full_url = f'{self.server}/providers/Microsoft.Management/managementGroups/{management_group}'
full_url += cmd_url
return self.ms_client.http_request(method='GET', full_url=full_url, url_suffix=, params=params)
if (not self.subscription_id):
raise DemistoException('A subscription ID must be provided.')
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
def list_ipp(self, management_group=None):
'\n Args:\n management_group: Managment group to pull (if needed)\n\n Returns:\n dict: response body\n\n '
params = {'api-version': IPP_API_VERSION}
cmd_url = '/providers/Microsoft.Security/informationProtectionPolicies'
if management_group:
full_url = f'{self.server}/providers/Microsoft.Management/managementGroups/{management_group}'
full_url += cmd_url
return self.ms_client.http_request(method='GET', full_url=full_url, url_suffix=, params=params)
if (not self.subscription_id):
raise DemistoException('A subscription ID must be provided.')
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)<|docstring|>Args:
management_group: Managment group to pull (if needed)
Returns:
dict: response body<|endoftext|>
|
528d92be823fb9018c777fbc169dba90aa161fd0373f7f2f1043b9cf5b1a20b9
|
def get_ipp(self, policy_name, management_group):
'\n Args:\n policy_name (str): Policy name\n management_group (str): Managment group\n\n Returns:\n dict: respone body\n '
params = {'api-version': IPP_API_VERSION}
cmd_url = f'/providers/Microsoft.Security/informationProtectionPolicies/{policy_name}'
if management_group:
full_url = f'{self.server}/providers/Microsoft.Management/managementGroups/{management_group}'
full_url += cmd_url
return self.ms_client.http_request(method='GET', full_url=full_url, url_suffix='', params=params)
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
Args:
policy_name (str): Policy name
management_group (str): Managment group
Returns:
dict: respone body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
get_ipp
|
jon-athon/content
| 799 |
python
|
def get_ipp(self, policy_name, management_group):
'\n Args:\n policy_name (str): Policy name\n management_group (str): Managment group\n\n Returns:\n dict: respone body\n '
params = {'api-version': IPP_API_VERSION}
cmd_url = f'/providers/Microsoft.Security/informationProtectionPolicies/{policy_name}'
if management_group:
full_url = f'{self.server}/providers/Microsoft.Management/managementGroups/{management_group}'
full_url += cmd_url
return self.ms_client.http_request(method='GET', full_url=full_url, url_suffix=, params=params)
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
def get_ipp(self, policy_name, management_group):
'\n Args:\n policy_name (str): Policy name\n management_group (str): Managment group\n\n Returns:\n dict: respone body\n '
params = {'api-version': IPP_API_VERSION}
cmd_url = f'/providers/Microsoft.Security/informationProtectionPolicies/{policy_name}'
if management_group:
full_url = f'{self.server}/providers/Microsoft.Management/managementGroups/{management_group}'
full_url += cmd_url
return self.ms_client.http_request(method='GET', full_url=full_url, url_suffix=, params=params)
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)<|docstring|>Args:
policy_name (str): Policy name
management_group (str): Managment group
Returns:
dict: respone body<|endoftext|>
|
cab8ca5a5043f0dbd040a3c144f2be14bcc5803ef99dd875fe207f0a7df5626c
|
def list_jit(self, asc_location, resource_group_name):
'\n Args:\n asc_location: Machine location\n resource_group_name: Resource group name\n\n Returns:\n dict: response body\n '
params = {'api-version': JIT_API_VERSION}
cmd_url = (f'/resourceGroups/{resource_group_name}' if resource_group_name else '')
cmd_url += (f'/providers/Microsoft.Security/locations/{asc_location}' if asc_location else '')
cmd_url += '/providers/Microsoft.Security/jitNetworkAccessPolicies'
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
Args:
asc_location: Machine location
resource_group_name: Resource group name
Returns:
dict: response body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
list_jit
|
jon-athon/content
| 799 |
python
|
def list_jit(self, asc_location, resource_group_name):
'\n Args:\n asc_location: Machine location\n resource_group_name: Resource group name\n\n Returns:\n dict: response body\n '
params = {'api-version': JIT_API_VERSION}
cmd_url = (f'/resourceGroups/{resource_group_name}' if resource_group_name else )
cmd_url += (f'/providers/Microsoft.Security/locations/{asc_location}' if asc_location else )
cmd_url += '/providers/Microsoft.Security/jitNetworkAccessPolicies'
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
def list_jit(self, asc_location, resource_group_name):
'\n Args:\n asc_location: Machine location\n resource_group_name: Resource group name\n\n Returns:\n dict: response body\n '
params = {'api-version': JIT_API_VERSION}
cmd_url = (f'/resourceGroups/{resource_group_name}' if resource_group_name else )
cmd_url += (f'/providers/Microsoft.Security/locations/{asc_location}' if asc_location else )
cmd_url += '/providers/Microsoft.Security/jitNetworkAccessPolicies'
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)<|docstring|>Args:
asc_location: Machine location
resource_group_name: Resource group name
Returns:
dict: response body<|endoftext|>
|
025dec5eca7465daba44115f82010111981f6cdac0566181c2c8d921cf7ba2d5
|
def get_jit(self, policy_name, asc_location, resource_group_name):
'\n Args:\n policy_name: Policy name\n asc_location: Machine location\n resource_group_name: Resource name group\n\n Returns:\n dict: response body\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Security/locations/{asc_location}/jitNetworkAccessPolicies/{policy_name}'
params = {'api-version': JIT_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
Args:
policy_name: Policy name
asc_location: Machine location
resource_group_name: Resource name group
Returns:
dict: response body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
get_jit
|
jon-athon/content
| 799 |
python
|
def get_jit(self, policy_name, asc_location, resource_group_name):
'\n Args:\n policy_name: Policy name\n asc_location: Machine location\n resource_group_name: Resource name group\n\n Returns:\n dict: response body\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Security/locations/{asc_location}/jitNetworkAccessPolicies/{policy_name}'
params = {'api-version': JIT_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
def get_jit(self, policy_name, asc_location, resource_group_name):
'\n Args:\n policy_name: Policy name\n asc_location: Machine location\n resource_group_name: Resource name group\n\n Returns:\n dict: response body\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Security/locations/{asc_location}/jitNetworkAccessPolicies/{policy_name}'
params = {'api-version': JIT_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)<|docstring|>Args:
policy_name: Policy name
asc_location: Machine location
resource_group_name: Resource name group
Returns:
dict: response body<|endoftext|>
|
cdb2f699e04fc11f9a0ea2f25a7a3be5273f9b5097dffda0aa3e580de5f63f2b
|
def initiate_jit(self, resource_group_name, asc_location, policy_name, vm_id, port, source_address, duration):
'Starting new Just-in-time machine\n\n Args:\n resource_group_name: Resource group name\n asc_location: Machine location\n policy_name: Policy name\n vm_id: Virtual Machine ID\n port: ports to be used\n source_address: Source address\n duration: Time in\n\n Returns:\n dict: response body\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Security/locations/{asc_location}/jitNetworkAccessPolicies/{policy_name}/initiate'
params = {'api-version': JIT_API_VERSION}
data = {'virtualMachines': [{'ID': vm_id, 'ports': [{'number': port, 'duration': duration, 'allowedSourceAddressPrefix': source_address}]}]}
return self.ms_client.http_request(method='POST', url_suffix=cmd_url, json_data=data, params=params, resp_type='response')
|
Starting new Just-in-time machine
Args:
resource_group_name: Resource group name
asc_location: Machine location
policy_name: Policy name
vm_id: Virtual Machine ID
port: ports to be used
source_address: Source address
duration: Time in
Returns:
dict: response body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
initiate_jit
|
jon-athon/content
| 799 |
python
|
def initiate_jit(self, resource_group_name, asc_location, policy_name, vm_id, port, source_address, duration):
'Starting new Just-in-time machine\n\n Args:\n resource_group_name: Resource group name\n asc_location: Machine location\n policy_name: Policy name\n vm_id: Virtual Machine ID\n port: ports to be used\n source_address: Source address\n duration: Time in\n\n Returns:\n dict: response body\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Security/locations/{asc_location}/jitNetworkAccessPolicies/{policy_name}/initiate'
params = {'api-version': JIT_API_VERSION}
data = {'virtualMachines': [{'ID': vm_id, 'ports': [{'number': port, 'duration': duration, 'allowedSourceAddressPrefix': source_address}]}]}
return self.ms_client.http_request(method='POST', url_suffix=cmd_url, json_data=data, params=params, resp_type='response')
|
def initiate_jit(self, resource_group_name, asc_location, policy_name, vm_id, port, source_address, duration):
'Starting new Just-in-time machine\n\n Args:\n resource_group_name: Resource group name\n asc_location: Machine location\n policy_name: Policy name\n vm_id: Virtual Machine ID\n port: ports to be used\n source_address: Source address\n duration: Time in\n\n Returns:\n dict: response body\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Security/locations/{asc_location}/jitNetworkAccessPolicies/{policy_name}/initiate'
params = {'api-version': JIT_API_VERSION}
data = {'virtualMachines': [{'ID': vm_id, 'ports': [{'number': port, 'duration': duration, 'allowedSourceAddressPrefix': source_address}]}]}
return self.ms_client.http_request(method='POST', url_suffix=cmd_url, json_data=data, params=params, resp_type='response')<|docstring|>Starting new Just-in-time machine
Args:
resource_group_name: Resource group name
asc_location: Machine location
policy_name: Policy name
vm_id: Virtual Machine ID
port: ports to be used
source_address: Source address
duration: Time in
Returns:
dict: response body<|endoftext|>
|
e0e2c7c7562cdc72cfc46890e26245577b1de1a97e734cdee9a4e99ba0ab0214
|
def delete_jit(self, asc_location, resource_group_name, policy_name):
'\n Args:\n asc_location: Machine location\n resource_group_name: Resource group name\n policy_name: Policy name\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Security/locations/{asc_location}/jitNetworkAccessPolicies/{policy_name}'
params = {'api-version': JIT_API_VERSION}
self.ms_client.http_request(method='DELETE', url_suffix=cmd_url, params=params, resp_type='text')
|
Args:
asc_location: Machine location
resource_group_name: Resource group name
policy_name: Policy name
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
delete_jit
|
jon-athon/content
| 799 |
python
|
def delete_jit(self, asc_location, resource_group_name, policy_name):
'\n Args:\n asc_location: Machine location\n resource_group_name: Resource group name\n policy_name: Policy name\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Security/locations/{asc_location}/jitNetworkAccessPolicies/{policy_name}'
params = {'api-version': JIT_API_VERSION}
self.ms_client.http_request(method='DELETE', url_suffix=cmd_url, params=params, resp_type='text')
|
def delete_jit(self, asc_location, resource_group_name, policy_name):
'\n Args:\n asc_location: Machine location\n resource_group_name: Resource group name\n policy_name: Policy name\n '
cmd_url = f'/resourceGroups/{resource_group_name}/providers/Microsoft.Security/locations/{asc_location}/jitNetworkAccessPolicies/{policy_name}'
params = {'api-version': JIT_API_VERSION}
self.ms_client.http_request(method='DELETE', url_suffix=cmd_url, params=params, resp_type='text')<|docstring|>Args:
asc_location: Machine location
resource_group_name: Resource group name
policy_name: Policy name<|endoftext|>
|
e793f492b96a9a841985f58495d94d120b7ddf19adcbe66542b3728790321eb6
|
def list_sc_storage(self):
'\n Returns:\n dict: response body\n\n '
cmd_url = '/providers/Microsoft.Storage/storageAccounts'
params = {'api-version': STORAGE_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
Returns:
dict: response body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
list_sc_storage
|
jon-athon/content
| 799 |
python
|
def list_sc_storage(self):
'\n Returns:\n dict: response body\n\n '
cmd_url = '/providers/Microsoft.Storage/storageAccounts'
params = {'api-version': STORAGE_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
def list_sc_storage(self):
'\n Returns:\n dict: response body\n\n '
cmd_url = '/providers/Microsoft.Storage/storageAccounts'
params = {'api-version': STORAGE_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)<|docstring|>Returns:
dict: response body<|endoftext|>
|
0ecf14d992ec4fc16fb83342968d8774623fb13d0e3164337911768850c09e35
|
def list_sc_subscriptions(self):
'\n Returns:\n dict: response body\n\n '
full_url = f'{self.server}/subscriptions'
params = {'api-version': SUBSCRIPTION_API_VERSION}
return self.ms_client.http_request(method='GET', full_url=full_url, url_suffix='', params=params)
|
Returns:
dict: response body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
list_sc_subscriptions
|
jon-athon/content
| 799 |
python
|
def list_sc_subscriptions(self):
'\n Returns:\n dict: response body\n\n '
full_url = f'{self.server}/subscriptions'
params = {'api-version': SUBSCRIPTION_API_VERSION}
return self.ms_client.http_request(method='GET', full_url=full_url, url_suffix=, params=params)
|
def list_sc_subscriptions(self):
'\n Returns:\n dict: response body\n\n '
full_url = f'{self.server}/subscriptions'
params = {'api-version': SUBSCRIPTION_API_VERSION}
return self.ms_client.http_request(method='GET', full_url=full_url, url_suffix=, params=params)<|docstring|>Returns:
dict: response body<|endoftext|>
|
6813de439192ce389e088604782b947c41dbe5b6df73a8618c39507e3e376f5d
|
def get_secure_scores(self, secure_score_name):
'\n Returns:\n dict: response body\n\n '
cmd_url = f'/providers/Microsoft.Security/secureScores/{secure_score_name}'
params = {'api-version': SECURE_STORES_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
Returns:
dict: response body
|
Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py
|
get_secure_scores
|
jon-athon/content
| 799 |
python
|
def get_secure_scores(self, secure_score_name):
'\n Returns:\n dict: response body\n\n '
cmd_url = f'/providers/Microsoft.Security/secureScores/{secure_score_name}'
params = {'api-version': SECURE_STORES_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)
|
def get_secure_scores(self, secure_score_name):
'\n Returns:\n dict: response body\n\n '
cmd_url = f'/providers/Microsoft.Security/secureScores/{secure_score_name}'
params = {'api-version': SECURE_STORES_API_VERSION}
return self.ms_client.http_request(method='GET', url_suffix=cmd_url, params=params)<|docstring|>Returns:
dict: response body<|endoftext|>
|
238955b3c02b7ef48ed06dd0ff9c1ca127c6aa29f3ddcbacd24d13bd6545c046
|
@property
def src_dim(self) -> Tuple[(Tuple[(int, int)], Tuple[(int, int)])]:
'x and y ranges of source.'
return self._src_dim
|
x and y ranges of source.
|
model_and_simulate/utilities/coordinate_mapper.py
|
src_dim
|
tomtuamnuq/model_and_simulate
| 1 |
python
|
@property
def src_dim(self) -> Tuple[(Tuple[(int, int)], Tuple[(int, int)])]:
return self._src_dim
|
@property
def src_dim(self) -> Tuple[(Tuple[(int, int)], Tuple[(int, int)])]:
return self._src_dim<|docstring|>x and y ranges of source.<|endoftext|>
|
a1faf3d1d4f40d0b7dbbbdf1d29514f9f333eb9fa02ff67b71a15d26bbc4bc53
|
@src_dim.setter
def src_dim(self, src_dim: Tuple[(Tuple[(int, int)], Tuple[(int, int)])]) -> None:
'Setter for src_dim.'
self._src_dim = src_dim
self._scale_matrix = self._calc_scale_matrix()
|
Setter for src_dim.
|
model_and_simulate/utilities/coordinate_mapper.py
|
src_dim
|
tomtuamnuq/model_and_simulate
| 1 |
python
|
@src_dim.setter
def src_dim(self, src_dim: Tuple[(Tuple[(int, int)], Tuple[(int, int)])]) -> None:
self._src_dim = src_dim
self._scale_matrix = self._calc_scale_matrix()
|
@src_dim.setter
def src_dim(self, src_dim: Tuple[(Tuple[(int, int)], Tuple[(int, int)])]) -> None:
self._src_dim = src_dim
self._scale_matrix = self._calc_scale_matrix()<|docstring|>Setter for src_dim.<|endoftext|>
|
1801aaf7c5e2c91f32a919c593e1f23b49119129459c2991796ed28eff28f27f
|
@property
def dst_dim(self) -> Tuple[(Tuple[(int, int)], Tuple[(int, int)])]:
'x and y ranges of destination.'
return self._dst_dim
|
x and y ranges of destination.
|
model_and_simulate/utilities/coordinate_mapper.py
|
dst_dim
|
tomtuamnuq/model_and_simulate
| 1 |
python
|
@property
def dst_dim(self) -> Tuple[(Tuple[(int, int)], Tuple[(int, int)])]:
return self._dst_dim
|
@property
def dst_dim(self) -> Tuple[(Tuple[(int, int)], Tuple[(int, int)])]:
return self._dst_dim<|docstring|>x and y ranges of destination.<|endoftext|>
|
1b7daed7a5c220944bd515f785afdd929d1b580251df64bf51822377dcd61536
|
@dst_dim.setter
def dst_dim(self, dst_dim: Tuple[(Tuple[(int, int)], Tuple[(int, int)])]) -> None:
'Setter for dst_dim.'
self._dst_dim = dst_dim
self._scale_matrix = self._calc_scale_matrix()
|
Setter for dst_dim.
|
model_and_simulate/utilities/coordinate_mapper.py
|
dst_dim
|
tomtuamnuq/model_and_simulate
| 1 |
python
|
@dst_dim.setter
def dst_dim(self, dst_dim: Tuple[(Tuple[(int, int)], Tuple[(int, int)])]) -> None:
self._dst_dim = dst_dim
self._scale_matrix = self._calc_scale_matrix()
|
@dst_dim.setter
def dst_dim(self, dst_dim: Tuple[(Tuple[(int, int)], Tuple[(int, int)])]) -> None:
self._dst_dim = dst_dim
self._scale_matrix = self._calc_scale_matrix()<|docstring|>Setter for dst_dim.<|endoftext|>
|
241d1d3778c9f35d688fa5c66f8cf3a9aab31f074530197249b56e135e7810d5
|
def map_coordinates(self, pos_sim: np.ndarray) -> np.ndarray:
'Maps source coordinates to destination coordinates.'
return np.matmul(pos_sim, self._scale_matrix)
|
Maps source coordinates to destination coordinates.
|
model_and_simulate/utilities/coordinate_mapper.py
|
map_coordinates
|
tomtuamnuq/model_and_simulate
| 1 |
python
|
def map_coordinates(self, pos_sim: np.ndarray) -> np.ndarray:
return np.matmul(pos_sim, self._scale_matrix)
|
def map_coordinates(self, pos_sim: np.ndarray) -> np.ndarray:
return np.matmul(pos_sim, self._scale_matrix)<|docstring|>Maps source coordinates to destination coordinates.<|endoftext|>
|
6d0bb5c3a3d54c2a98832a641169df376558cdcf14177102fc070f1628bb088f
|
def scale_size_x(self, size_sim: float) -> float:
'Scales the given size to the visualization.'
length_sim = np.asarray([size_sim, 0])
return self.map_coordinates(length_sim)[0]
|
Scales the given size to the visualization.
|
model_and_simulate/utilities/coordinate_mapper.py
|
scale_size_x
|
tomtuamnuq/model_and_simulate
| 1 |
python
|
def scale_size_x(self, size_sim: float) -> float:
length_sim = np.asarray([size_sim, 0])
return self.map_coordinates(length_sim)[0]
|
def scale_size_x(self, size_sim: float) -> float:
length_sim = np.asarray([size_sim, 0])
return self.map_coordinates(length_sim)[0]<|docstring|>Scales the given size to the visualization.<|endoftext|>
|
3cbc78ae161302d88eab401c9a44925f5e59da727addacfdcf93d048f9c41611
|
def image_chunk(self, images, n):
'Yield successive n-sized chunks from l.'
return [images[i:(i + n)] for i in range(0, len(images), n)]
|
Yield successive n-sized chunks from l.
|
face_recognition/identifier.py
|
image_chunk
|
Skarlso/kube-cluster-sample
| 40 |
python
|
def image_chunk(self, images, n):
return [images[i:(i + n)] for i in range(0, len(images), n)]
|
def image_chunk(self, images, n):
return [images[i:(i + n)] for i in range(0, len(images), n)]<|docstring|>Yield successive n-sized chunks from l.<|endoftext|>
|
8bda91141870037d9dc219374e983ca238b6a9feb214f95ff2eaaf6eff984722
|
def request_payment(user_id, message, options):
'Note that amount is a integer which specifies the amount of cents in the transaction\n Smooch will default to the currency specified in your account settings.'
if (not valid_args(user_id, message, options)):
logging.warning('request payment called with invalid args user_id={} message={} options={}'.format(user_id, message, options))
return
role = 'appMaker'
buttons = []
for (short_text, result) in options:
buttons.append({'type': 'buy', 'text': short_text, 'amount': result})
data = {'text': message, 'role': role, 'actions': buttons}
return ask('appusers/{0}/conversation/messages'.format(user_id), data, 'post')
|
Note that amount is a integer which specifies the amount of cents in the transaction
Smooch will default to the currency specified in your account settings.
|
smooch/conversations.py
|
request_payment
|
devinmcgloin/smooch
| 3 |
python
|
def request_payment(user_id, message, options):
'Note that amount is a integer which specifies the amount of cents in the transaction\n Smooch will default to the currency specified in your account settings.'
if (not valid_args(user_id, message, options)):
logging.warning('request payment called with invalid args user_id={} message={} options={}'.format(user_id, message, options))
return
role = 'appMaker'
buttons = []
for (short_text, result) in options:
buttons.append({'type': 'buy', 'text': short_text, 'amount': result})
data = {'text': message, 'role': role, 'actions': buttons}
return ask('appusers/{0}/conversation/messages'.format(user_id), data, 'post')
|
def request_payment(user_id, message, options):
'Note that amount is a integer which specifies the amount of cents in the transaction\n Smooch will default to the currency specified in your account settings.'
if (not valid_args(user_id, message, options)):
logging.warning('request payment called with invalid args user_id={} message={} options={}'.format(user_id, message, options))
return
role = 'appMaker'
buttons = []
for (short_text, result) in options:
buttons.append({'type': 'buy', 'text': short_text, 'amount': result})
data = {'text': message, 'role': role, 'actions': buttons}
return ask('appusers/{0}/conversation/messages'.format(user_id), data, 'post')<|docstring|>Note that amount is a integer which specifies the amount of cents in the transaction
Smooch will default to the currency specified in your account settings.<|endoftext|>
|
f04cecf125c2ed373bcf89ef572d53c49c30d7df909453e2c90a7107ef27541b
|
def send_links(user_id, message, options):
'Sends a series of links. The options field is a dictionary in which the keys are\n descriptions and values uris'
if (not valid_args(user_id, message, options)):
logging.warning('send links called with invalid args user_id={} message={} options={}'.format(user_id, message, options))
return
role = 'appMaker'
buttons = []
for (short_text, result) in options:
buttons.append({'type': 'link', 'text': short_text, 'uri': result})
data = {'text': message, 'role': role, 'actions': buttons}
return ask('appusers/{0}/conversation/messages'.format(user_id), data, 'post')
|
Sends a series of links. The options field is a dictionary in which the keys are
descriptions and values uris
|
smooch/conversations.py
|
send_links
|
devinmcgloin/smooch
| 3 |
python
|
def send_links(user_id, message, options):
'Sends a series of links. The options field is a dictionary in which the keys are\n descriptions and values uris'
if (not valid_args(user_id, message, options)):
logging.warning('send links called with invalid args user_id={} message={} options={}'.format(user_id, message, options))
return
role = 'appMaker'
buttons = []
for (short_text, result) in options:
buttons.append({'type': 'link', 'text': short_text, 'uri': result})
data = {'text': message, 'role': role, 'actions': buttons}
return ask('appusers/{0}/conversation/messages'.format(user_id), data, 'post')
|
def send_links(user_id, message, options):
'Sends a series of links. The options field is a dictionary in which the keys are\n descriptions and values uris'
if (not valid_args(user_id, message, options)):
logging.warning('send links called with invalid args user_id={} message={} options={}'.format(user_id, message, options))
return
role = 'appMaker'
buttons = []
for (short_text, result) in options:
buttons.append({'type': 'link', 'text': short_text, 'uri': result})
data = {'text': message, 'role': role, 'actions': buttons}
return ask('appusers/{0}/conversation/messages'.format(user_id), data, 'post')<|docstring|>Sends a series of links. The options field is a dictionary in which the keys are
descriptions and values uris<|endoftext|>
|
0e5b5de46919bce7affd0a3b7ab34b3bfcdabfd177a33992366b195a3100fa7d
|
def send_postbacks(user_id, message, options):
'Sends a series of options that you can listen for on your webhook. The options field is a dictionary in which the keys are\n descriptions and values the postback payload. You need to set up a webhook to listen for the postback.'
if (not valid_args(user_id, message, options)):
logging.warning('send postback called with invalid args user_id={} message={} options={}'.format(user_id, message, options))
return
role = 'appMaker'
buttons = []
for (short_text, result) in options:
buttons.append({'type': 'postback', 'text': short_text, 'payload': result})
data = {'text': message, 'role': role, 'actions': buttons}
return ask('appusers/{0}/conversation/messages'.format(user_id), data, 'post')
|
Sends a series of options that you can listen for on your webhook. The options field is a dictionary in which the keys are
descriptions and values the postback payload. You need to set up a webhook to listen for the postback.
|
smooch/conversations.py
|
send_postbacks
|
devinmcgloin/smooch
| 3 |
python
|
def send_postbacks(user_id, message, options):
'Sends a series of options that you can listen for on your webhook. The options field is a dictionary in which the keys are\n descriptions and values the postback payload. You need to set up a webhook to listen for the postback.'
if (not valid_args(user_id, message, options)):
logging.warning('send postback called with invalid args user_id={} message={} options={}'.format(user_id, message, options))
return
role = 'appMaker'
buttons = []
for (short_text, result) in options:
buttons.append({'type': 'postback', 'text': short_text, 'payload': result})
data = {'text': message, 'role': role, 'actions': buttons}
return ask('appusers/{0}/conversation/messages'.format(user_id), data, 'post')
|
def send_postbacks(user_id, message, options):
'Sends a series of options that you can listen for on your webhook. The options field is a dictionary in which the keys are\n descriptions and values the postback payload. You need to set up a webhook to listen for the postback.'
if (not valid_args(user_id, message, options)):
logging.warning('send postback called with invalid args user_id={} message={} options={}'.format(user_id, message, options))
return
role = 'appMaker'
buttons = []
for (short_text, result) in options:
buttons.append({'type': 'postback', 'text': short_text, 'payload': result})
data = {'text': message, 'role': role, 'actions': buttons}
return ask('appusers/{0}/conversation/messages'.format(user_id), data, 'post')<|docstring|>Sends a series of options that you can listen for on your webhook. The options field is a dictionary in which the keys are
descriptions and values the postback payload. You need to set up a webhook to listen for the postback.<|endoftext|>
|
8d007bedb19c10fa230ab95dd96f01c4afb13e503986f9130a24b0ffcb89c5f8
|
def send_buttons(user_id, message, options):
'Options is a list of tuples in which the first element is the type of the button,\n second the short text, and third the result for the specified type.'
if (not valid_args(user_id, message, options)):
logging.warning('send buttons called with invalid args user_id={} message={} options={}'.format(user_id, message, options))
return
role = 'appMaker'
buttons = []
for (text, kind, result) in options:
buttons.append({'type': kind, 'text': text, 'payload': result})
data = {'text': message, 'role': role, 'actions': buttons}
return ask('appusers/{0}/conversation/messages'.format(user_id), data, 'post')
|
Options is a list of tuples in which the first element is the type of the button,
second the short text, and third the result for the specified type.
|
smooch/conversations.py
|
send_buttons
|
devinmcgloin/smooch
| 3 |
python
|
def send_buttons(user_id, message, options):
'Options is a list of tuples in which the first element is the type of the button,\n second the short text, and third the result for the specified type.'
if (not valid_args(user_id, message, options)):
logging.warning('send buttons called with invalid args user_id={} message={} options={}'.format(user_id, message, options))
return
role = 'appMaker'
buttons = []
for (text, kind, result) in options:
buttons.append({'type': kind, 'text': text, 'payload': result})
data = {'text': message, 'role': role, 'actions': buttons}
return ask('appusers/{0}/conversation/messages'.format(user_id), data, 'post')
|
def send_buttons(user_id, message, options):
'Options is a list of tuples in which the first element is the type of the button,\n second the short text, and third the result for the specified type.'
if (not valid_args(user_id, message, options)):
logging.warning('send buttons called with invalid args user_id={} message={} options={}'.format(user_id, message, options))
return
role = 'appMaker'
buttons = []
for (text, kind, result) in options:
buttons.append({'type': kind, 'text': text, 'payload': result})
data = {'text': message, 'role': role, 'actions': buttons}
return ask('appusers/{0}/conversation/messages'.format(user_id), data, 'post')<|docstring|>Options is a list of tuples in which the first element is the type of the button,
second the short text, and third the result for the specified type.<|endoftext|>
|
92a30c01e44b74234f84e7a1fb180f7c06134953ef6b6d46bd4601c075a5d0f5
|
def train(num_timesteps, seed, model_path=None):
'\n Train PPO1 model for the Humanoid environment, for testing purposes\n\n :param num_timesteps: (int) The total number of samples\n :param seed: (int) The initial seed for training\n :param model_path: (str) path to the model\n '
env_id = 'Humanoid-v2'
env = make_mujoco_env(env_id, seed)
env = RewScale(env, 0.1)
model = PPO1(MlpPolicy, env, timesteps_per_actorbatch=2048, clip_param=0.2, entcoeff=0.0, optim_epochs=10, optim_stepsize=0.0003, optim_batchsize=64, gamma=0.99, lam=0.95, schedule='linear')
model.learn(total_timesteps=num_timesteps)
env.close()
if model_path:
tf_util.save_state(model_path)
return model
|
Train PPO1 model for the Humanoid environment, for testing purposes
:param num_timesteps: (int) The total number of samples
:param seed: (int) The initial seed for training
:param model_path: (str) path to the model
|
stable_baselines/ppo1/run_humanoid.py
|
train
|
ashigirl96/stable-baselines
| 49 |
python
|
def train(num_timesteps, seed, model_path=None):
'\n Train PPO1 model for the Humanoid environment, for testing purposes\n\n :param num_timesteps: (int) The total number of samples\n :param seed: (int) The initial seed for training\n :param model_path: (str) path to the model\n '
env_id = 'Humanoid-v2'
env = make_mujoco_env(env_id, seed)
env = RewScale(env, 0.1)
model = PPO1(MlpPolicy, env, timesteps_per_actorbatch=2048, clip_param=0.2, entcoeff=0.0, optim_epochs=10, optim_stepsize=0.0003, optim_batchsize=64, gamma=0.99, lam=0.95, schedule='linear')
model.learn(total_timesteps=num_timesteps)
env.close()
if model_path:
tf_util.save_state(model_path)
return model
|
def train(num_timesteps, seed, model_path=None):
'\n Train PPO1 model for the Humanoid environment, for testing purposes\n\n :param num_timesteps: (int) The total number of samples\n :param seed: (int) The initial seed for training\n :param model_path: (str) path to the model\n '
env_id = 'Humanoid-v2'
env = make_mujoco_env(env_id, seed)
env = RewScale(env, 0.1)
model = PPO1(MlpPolicy, env, timesteps_per_actorbatch=2048, clip_param=0.2, entcoeff=0.0, optim_epochs=10, optim_stepsize=0.0003, optim_batchsize=64, gamma=0.99, lam=0.95, schedule='linear')
model.learn(total_timesteps=num_timesteps)
env.close()
if model_path:
tf_util.save_state(model_path)
return model<|docstring|>Train PPO1 model for the Humanoid environment, for testing purposes
:param num_timesteps: (int) The total number of samples
:param seed: (int) The initial seed for training
:param model_path: (str) path to the model<|endoftext|>
|
c3000f6d1bf5bc33685781f1faef30f55dc33804e9ab19cbb061a1683a58efe0
|
def main():
'\n Runs the test\n '
logger.configure()
parser = mujoco_arg_parser()
parser.add_argument('--model-path', default=os.path.join(logger.get_dir(), 'humanoid_policy'))
parser.set_defaults(num_timesteps=int(20000000.0))
args = parser.parse_args()
if (not args.play):
train(num_timesteps=args.num_timesteps, seed=args.seed, model_path=args.model_path)
else:
model = train(num_timesteps=1, seed=args.seed)
tf_util.load_state(args.model_path)
env = make_mujoco_env('Humanoid-v2', seed=0)
obs = env.reset()
while True:
action = model.policy.act(stochastic=False, obs=obs)[0]
(obs, _, done, _) = env.step(action)
env.render()
if done:
obs = env.reset()
|
Runs the test
|
stable_baselines/ppo1/run_humanoid.py
|
main
|
ashigirl96/stable-baselines
| 49 |
python
|
def main():
'\n \n '
logger.configure()
parser = mujoco_arg_parser()
parser.add_argument('--model-path', default=os.path.join(logger.get_dir(), 'humanoid_policy'))
parser.set_defaults(num_timesteps=int(20000000.0))
args = parser.parse_args()
if (not args.play):
train(num_timesteps=args.num_timesteps, seed=args.seed, model_path=args.model_path)
else:
model = train(num_timesteps=1, seed=args.seed)
tf_util.load_state(args.model_path)
env = make_mujoco_env('Humanoid-v2', seed=0)
obs = env.reset()
while True:
action = model.policy.act(stochastic=False, obs=obs)[0]
(obs, _, done, _) = env.step(action)
env.render()
if done:
obs = env.reset()
|
def main():
'\n \n '
logger.configure()
parser = mujoco_arg_parser()
parser.add_argument('--model-path', default=os.path.join(logger.get_dir(), 'humanoid_policy'))
parser.set_defaults(num_timesteps=int(20000000.0))
args = parser.parse_args()
if (not args.play):
train(num_timesteps=args.num_timesteps, seed=args.seed, model_path=args.model_path)
else:
model = train(num_timesteps=1, seed=args.seed)
tf_util.load_state(args.model_path)
env = make_mujoco_env('Humanoid-v2', seed=0)
obs = env.reset()
while True:
action = model.policy.act(stochastic=False, obs=obs)[0]
(obs, _, done, _) = env.step(action)
env.render()
if done:
obs = env.reset()<|docstring|>Runs the test<|endoftext|>
|
42ebe704e9802e27908db5276684cbde0c5326108908a2d9da752327292dc920
|
def magnitude_to_count_rate(magnitudes, band='fuv'):
" Convert (flat) input magnitudes to count rates\n\t\n\tParameters\n\t----------\n\tmagnitudes : float array\n\t\tArray of magnitudes in ABmag units\n\t\t\n\tband : string\n\t\tWhich UVEX band to use, options are 'nuv' and 'fuv'\n\t\tDefaults to 'fuv'\n\t\t\n\tReturns\n\t-------\n\tcount_rate : float array\n\t\tArray of count rates in ph/s units\n\t"
wav = (np.arange(1000, 5000) * u.AA)
dw = (1 * u.AA)
ph_energy = (((cr.h.cgs * cr.c.cgs) / wav.cgs) / u.ph)
count_rate = ((np.zeros(len(magnitudes)) * u.ph) / u.s)
for (i, m) in enumerate(magnitudes):
flux_den = m.to(FLAM, equivalencies=u.spectral_density(wav))
ph_flux = ((flux_den * dw) / ph_energy)
fluence = ph_flux[((wav >= band_wav[band][0].to(u.AA)) & (wav <= band_wav[band][1].to(u.AA)))].sum()
count_rate[i] = (((fluence * area) * (reflectivity ** mirrors)) * dichroic[band])
return count_rate
|
Convert (flat) input magnitudes to count rates
Parameters
----------
magnitudes : float array
Array of magnitudes in ABmag units
band : string
Which UVEX band to use, options are 'nuv' and 'fuv'
Defaults to 'fuv'
Returns
-------
count_rate : float array
Array of count rates in ph/s units
|
cmost_hdr.py
|
magnitude_to_count_rate
|
hpearnshaw/cmost-analysis
| 0 |
python
|
def magnitude_to_count_rate(magnitudes, band='fuv'):
" Convert (flat) input magnitudes to count rates\n\t\n\tParameters\n\t----------\n\tmagnitudes : float array\n\t\tArray of magnitudes in ABmag units\n\t\t\n\tband : string\n\t\tWhich UVEX band to use, options are 'nuv' and 'fuv'\n\t\tDefaults to 'fuv'\n\t\t\n\tReturns\n\t-------\n\tcount_rate : float array\n\t\tArray of count rates in ph/s units\n\t"
wav = (np.arange(1000, 5000) * u.AA)
dw = (1 * u.AA)
ph_energy = (((cr.h.cgs * cr.c.cgs) / wav.cgs) / u.ph)
count_rate = ((np.zeros(len(magnitudes)) * u.ph) / u.s)
for (i, m) in enumerate(magnitudes):
flux_den = m.to(FLAM, equivalencies=u.spectral_density(wav))
ph_flux = ((flux_den * dw) / ph_energy)
fluence = ph_flux[((wav >= band_wav[band][0].to(u.AA)) & (wav <= band_wav[band][1].to(u.AA)))].sum()
count_rate[i] = (((fluence * area) * (reflectivity ** mirrors)) * dichroic[band])
return count_rate
|
def magnitude_to_count_rate(magnitudes, band='fuv'):
" Convert (flat) input magnitudes to count rates\n\t\n\tParameters\n\t----------\n\tmagnitudes : float array\n\t\tArray of magnitudes in ABmag units\n\t\t\n\tband : string\n\t\tWhich UVEX band to use, options are 'nuv' and 'fuv'\n\t\tDefaults to 'fuv'\n\t\t\n\tReturns\n\t-------\n\tcount_rate : float array\n\t\tArray of count rates in ph/s units\n\t"
wav = (np.arange(1000, 5000) * u.AA)
dw = (1 * u.AA)
ph_energy = (((cr.h.cgs * cr.c.cgs) / wav.cgs) / u.ph)
count_rate = ((np.zeros(len(magnitudes)) * u.ph) / u.s)
for (i, m) in enumerate(magnitudes):
flux_den = m.to(FLAM, equivalencies=u.spectral_density(wav))
ph_flux = ((flux_den * dw) / ph_energy)
fluence = ph_flux[((wav >= band_wav[band][0].to(u.AA)) & (wav <= band_wav[band][1].to(u.AA)))].sum()
count_rate[i] = (((fluence * area) * (reflectivity ** mirrors)) * dichroic[band])
return count_rate<|docstring|>Convert (flat) input magnitudes to count rates
Parameters
----------
magnitudes : float array
Array of magnitudes in ABmag units
band : string
Which UVEX band to use, options are 'nuv' and 'fuv'
Defaults to 'fuv'
Returns
-------
count_rate : float array
Array of count rates in ph/s units<|endoftext|>
|
e2b2a4c4091fed85f022e575d82a74a9395a332cdb880cf9ec5c336280d6d839
|
def count_rate_to_electron_rate(count_rate):
" Calculates the number of measured electrons for given count rate and exposure time\n\t\n\tParameters\n\t----------\n\tcount_rate : float array\n\t\tArray of count rates in photons per second\n\t\t\n\texp_time: float\n\t\tExposure time in seconds\n\t\t\n\tgain_mode : string\n\t\tWhich detector gain mode to use, options are 'low' and 'high'\n\t\tDefaults to 'high'\n\t\t\n\tReturns\n\t-------\n\te : float array\n\t\tArray of number of count rate in electrons per second the same shape as count_rate\n\t"
e = (count_rate * qe)
return e
|
Calculates the number of measured electrons for given count rate and exposure time
Parameters
----------
count_rate : float array
Array of count rates in photons per second
exp_time: float
Exposure time in seconds
gain_mode : string
Which detector gain mode to use, options are 'low' and 'high'
Defaults to 'high'
Returns
-------
e : float array
Array of number of count rate in electrons per second the same shape as count_rate
|
cmost_hdr.py
|
count_rate_to_electron_rate
|
hpearnshaw/cmost-analysis
| 0 |
python
|
def count_rate_to_electron_rate(count_rate):
" Calculates the number of measured electrons for given count rate and exposure time\n\t\n\tParameters\n\t----------\n\tcount_rate : float array\n\t\tArray of count rates in photons per second\n\t\t\n\texp_time: float\n\t\tExposure time in seconds\n\t\t\n\tgain_mode : string\n\t\tWhich detector gain mode to use, options are 'low' and 'high'\n\t\tDefaults to 'high'\n\t\t\n\tReturns\n\t-------\n\te : float array\n\t\tArray of number of count rate in electrons per second the same shape as count_rate\n\t"
e = (count_rate * qe)
return e
|
def count_rate_to_electron_rate(count_rate):
" Calculates the number of measured electrons for given count rate and exposure time\n\t\n\tParameters\n\t----------\n\tcount_rate : float array\n\t\tArray of count rates in photons per second\n\t\t\n\texp_time: float\n\t\tExposure time in seconds\n\t\t\n\tgain_mode : string\n\t\tWhich detector gain mode to use, options are 'low' and 'high'\n\t\tDefaults to 'high'\n\t\t\n\tReturns\n\t-------\n\te : float array\n\t\tArray of number of count rate in electrons per second the same shape as count_rate\n\t"
e = (count_rate * qe)
return e<|docstring|>Calculates the number of measured electrons for given count rate and exposure time
Parameters
----------
count_rate : float array
Array of count rates in photons per second
exp_time: float
Exposure time in seconds
gain_mode : string
Which detector gain mode to use, options are 'low' and 'high'
Defaults to 'high'
Returns
-------
e : float array
Array of number of count rate in electrons per second the same shape as count_rate<|endoftext|>
|
75b4647220a98a61a646ddc2ae563ff33132dc5989f64a1f12723f013733aa71
|
def count_rate_to_electrons(count_rate, exp_time, gain_mode='high'):
" Calculates the number of measured electrons for given count rate and exposure time\n\tIncorporates dark current and saturation, but otherwise returns ideal number of electrons (no noise/quantization)\n\t\n\tParameters\n\t----------\n\tcount_rate : float array\n\t\tArray of count rates in photons per second\n\t\t\n\texp_time: float\n\t\tExposure time in seconds\n\t\t\n\tgain_mode : string\n\t\tWhich detector gain mode to use, options are 'low' and 'high'\n\t\tDefaults to 'high'\n\t\t\n\tReturns\n\t-------\n\te : float array\n\t\tArray of number of electrons measured the same shape as count_rate\n\t\t\n\tsaturated : bool array\n\t\tArray the same shape as count_rate stating which pixels are saturated (i.e. True) \n\t"
e = ((count_rate * qe) * exp_time)
saturated = ((e + (dark_current * exp_time)) > well_depth[gain_mode])
e[saturated] = well_depth[gain_mode]
return (e, saturated)
|
Calculates the number of measured electrons for given count rate and exposure time
Incorporates dark current and saturation, but otherwise returns ideal number of electrons (no noise/quantization)
Parameters
----------
count_rate : float array
Array of count rates in photons per second
exp_time: float
Exposure time in seconds
gain_mode : string
Which detector gain mode to use, options are 'low' and 'high'
Defaults to 'high'
Returns
-------
e : float array
Array of number of electrons measured the same shape as count_rate
saturated : bool array
Array the same shape as count_rate stating which pixels are saturated (i.e. True)
|
cmost_hdr.py
|
count_rate_to_electrons
|
hpearnshaw/cmost-analysis
| 0 |
python
|
def count_rate_to_electrons(count_rate, exp_time, gain_mode='high'):
" Calculates the number of measured electrons for given count rate and exposure time\n\tIncorporates dark current and saturation, but otherwise returns ideal number of electrons (no noise/quantization)\n\t\n\tParameters\n\t----------\n\tcount_rate : float array\n\t\tArray of count rates in photons per second\n\t\t\n\texp_time: float\n\t\tExposure time in seconds\n\t\t\n\tgain_mode : string\n\t\tWhich detector gain mode to use, options are 'low' and 'high'\n\t\tDefaults to 'high'\n\t\t\n\tReturns\n\t-------\n\te : float array\n\t\tArray of number of electrons measured the same shape as count_rate\n\t\t\n\tsaturated : bool array\n\t\tArray the same shape as count_rate stating which pixels are saturated (i.e. True) \n\t"
e = ((count_rate * qe) * exp_time)
saturated = ((e + (dark_current * exp_time)) > well_depth[gain_mode])
e[saturated] = well_depth[gain_mode]
return (e, saturated)
|
def count_rate_to_electrons(count_rate, exp_time, gain_mode='high'):
" Calculates the number of measured electrons for given count rate and exposure time\n\tIncorporates dark current and saturation, but otherwise returns ideal number of electrons (no noise/quantization)\n\t\n\tParameters\n\t----------\n\tcount_rate : float array\n\t\tArray of count rates in photons per second\n\t\t\n\texp_time: float\n\t\tExposure time in seconds\n\t\t\n\tgain_mode : string\n\t\tWhich detector gain mode to use, options are 'low' and 'high'\n\t\tDefaults to 'high'\n\t\t\n\tReturns\n\t-------\n\te : float array\n\t\tArray of number of electrons measured the same shape as count_rate\n\t\t\n\tsaturated : bool array\n\t\tArray the same shape as count_rate stating which pixels are saturated (i.e. True) \n\t"
e = ((count_rate * qe) * exp_time)
saturated = ((e + (dark_current * exp_time)) > well_depth[gain_mode])
e[saturated] = well_depth[gain_mode]
return (e, saturated)<|docstring|>Calculates the number of measured electrons for given count rate and exposure time
Incorporates dark current and saturation, but otherwise returns ideal number of electrons (no noise/quantization)
Parameters
----------
count_rate : float array
Array of count rates in photons per second
exp_time: float
Exposure time in seconds
gain_mode : string
Which detector gain mode to use, options are 'low' and 'high'
Defaults to 'high'
Returns
-------
e : float array
Array of number of electrons measured the same shape as count_rate
saturated : bool array
Array the same shape as count_rate stating which pixels are saturated (i.e. True)<|endoftext|>
|
f0ffa9b6a7b3c29de2c7f1f272234ca25be15099d242b654b100f18c9a927140
|
def get_signal(count_rate, exp_times, gain_mode='high'):
" Runs count_rate_to_electrons then converts to detector signal\n\t\n\tParameters\n\t----------\n\tcount_rate : float array\n\t\tArray of count rates in photons per second\n\t\t\n\texp_times: float array\n\t\tExposure time in seconds\n\t\t\n\tgain_mode : string\n\t\tWhich detector gain mode to use, options are 'low' and 'high'\n\t\tDefaults to 'high'\n\t\t\n\tReturns\n\t-------\n\tsignal : 2-D float array\n\t\tArray of detector signal in ADU with shape len(exp_times) x len(count_rate)\n\t\t\n\tsaturated : 2-D bool array\n\t\tArray stating which pixels are saturated (i.e. True) with shape len(exp_times) x len(count_rate)\n\t"
(signals, sat) = ([], [])
for t in exp_times:
(e, saturated) = count_rate_to_electrons(count_rate, t, gain_mode=gain_mode)
signals.append((e * gain[gain_mode]))
sat.append(saturated)
return (np.array(signals), np.array(sat))
|
Runs count_rate_to_electrons then converts to detector signal
Parameters
----------
count_rate : float array
Array of count rates in photons per second
exp_times: float array
Exposure time in seconds
gain_mode : string
Which detector gain mode to use, options are 'low' and 'high'
Defaults to 'high'
Returns
-------
signal : 2-D float array
Array of detector signal in ADU with shape len(exp_times) x len(count_rate)
saturated : 2-D bool array
Array stating which pixels are saturated (i.e. True) with shape len(exp_times) x len(count_rate)
|
cmost_hdr.py
|
get_signal
|
hpearnshaw/cmost-analysis
| 0 |
python
|
def get_signal(count_rate, exp_times, gain_mode='high'):
" Runs count_rate_to_electrons then converts to detector signal\n\t\n\tParameters\n\t----------\n\tcount_rate : float array\n\t\tArray of count rates in photons per second\n\t\t\n\texp_times: float array\n\t\tExposure time in seconds\n\t\t\n\tgain_mode : string\n\t\tWhich detector gain mode to use, options are 'low' and 'high'\n\t\tDefaults to 'high'\n\t\t\n\tReturns\n\t-------\n\tsignal : 2-D float array\n\t\tArray of detector signal in ADU with shape len(exp_times) x len(count_rate)\n\t\t\n\tsaturated : 2-D bool array\n\t\tArray stating which pixels are saturated (i.e. True) with shape len(exp_times) x len(count_rate)\n\t"
(signals, sat) = ([], [])
for t in exp_times:
(e, saturated) = count_rate_to_electrons(count_rate, t, gain_mode=gain_mode)
signals.append((e * gain[gain_mode]))
sat.append(saturated)
return (np.array(signals), np.array(sat))
|
def get_signal(count_rate, exp_times, gain_mode='high'):
" Runs count_rate_to_electrons then converts to detector signal\n\t\n\tParameters\n\t----------\n\tcount_rate : float array\n\t\tArray of count rates in photons per second\n\t\t\n\texp_times: float array\n\t\tExposure time in seconds\n\t\t\n\tgain_mode : string\n\t\tWhich detector gain mode to use, options are 'low' and 'high'\n\t\tDefaults to 'high'\n\t\t\n\tReturns\n\t-------\n\tsignal : 2-D float array\n\t\tArray of detector signal in ADU with shape len(exp_times) x len(count_rate)\n\t\t\n\tsaturated : 2-D bool array\n\t\tArray stating which pixels are saturated (i.e. True) with shape len(exp_times) x len(count_rate)\n\t"
(signals, sat) = ([], [])
for t in exp_times:
(e, saturated) = count_rate_to_electrons(count_rate, t, gain_mode=gain_mode)
signals.append((e * gain[gain_mode]))
sat.append(saturated)
return (np.array(signals), np.array(sat))<|docstring|>Runs count_rate_to_electrons then converts to detector signal
Parameters
----------
count_rate : float array
Array of count rates in photons per second
exp_times: float array
Exposure time in seconds
gain_mode : string
Which detector gain mode to use, options are 'low' and 'high'
Defaults to 'high'
Returns
-------
signal : 2-D float array
Array of detector signal in ADU with shape len(exp_times) x len(count_rate)
saturated : 2-D bool array
Array stating which pixels are saturated (i.e. True) with shape len(exp_times) x len(count_rate)<|endoftext|>
|
2a75318c7b3027698d8a97ea5c49b20857b6f3ce71411e57ad07d4b5ee5b9959
|
def get_snr(count_rate, exp_times, band='fuv', gain_mode='high'):
" Calculate SNR for given count rates and exposure times\n\t\n\tParameters\n\t----------\n\tcount_rate : float array\n\t\tArray of count rates in photons per second\n\t\t\n\texp_times: float array\n\t\tArray of exposure times in seconds\n\t\t\n\tband : string\n\t\tWhich UVEX band to use, options are 'nuv' and 'fuv'\n\t\tDefaults to 'fuv'\n\t\t\n\tgain_mode : string\n\t\tWhich detector gain mode to use, options are 'low' and 'high'\n\t\tDefaults to 'high'\n\t\t\n\tReturns\n\t-------\n\tsnr : 2-D float array\n\t\tArray of SNR with shape len(exp_times) x len(count_rate)\n\t"
snr_list = []
for t in exp_times:
(signal, saturated) = count_rate_to_electrons(count_rate, t, gain_mode=gain_mode)
(sky_bgd, _) = count_rate_to_electrons(sky_bgd_rate[band], t, gain_mode=gain_mode)
shot_noise = (np.sqrt((signal + sky_bgd)).value * u.electron)
snr = (signal / np.sqrt(((shot_noise ** 2) + (read_noise[gain_mode] ** 2))))
snr[saturated] = 0
snr_list.append(snr)
return np.array(snr_list)
|
Calculate SNR for given count rates and exposure times
Parameters
----------
count_rate : float array
Array of count rates in photons per second
exp_times: float array
Array of exposure times in seconds
band : string
Which UVEX band to use, options are 'nuv' and 'fuv'
Defaults to 'fuv'
gain_mode : string
Which detector gain mode to use, options are 'low' and 'high'
Defaults to 'high'
Returns
-------
snr : 2-D float array
Array of SNR with shape len(exp_times) x len(count_rate)
|
cmost_hdr.py
|
get_snr
|
hpearnshaw/cmost-analysis
| 0 |
python
|
def get_snr(count_rate, exp_times, band='fuv', gain_mode='high'):
" Calculate SNR for given count rates and exposure times\n\t\n\tParameters\n\t----------\n\tcount_rate : float array\n\t\tArray of count rates in photons per second\n\t\t\n\texp_times: float array\n\t\tArray of exposure times in seconds\n\t\t\n\tband : string\n\t\tWhich UVEX band to use, options are 'nuv' and 'fuv'\n\t\tDefaults to 'fuv'\n\t\t\n\tgain_mode : string\n\t\tWhich detector gain mode to use, options are 'low' and 'high'\n\t\tDefaults to 'high'\n\t\t\n\tReturns\n\t-------\n\tsnr : 2-D float array\n\t\tArray of SNR with shape len(exp_times) x len(count_rate)\n\t"
snr_list = []
for t in exp_times:
(signal, saturated) = count_rate_to_electrons(count_rate, t, gain_mode=gain_mode)
(sky_bgd, _) = count_rate_to_electrons(sky_bgd_rate[band], t, gain_mode=gain_mode)
shot_noise = (np.sqrt((signal + sky_bgd)).value * u.electron)
snr = (signal / np.sqrt(((shot_noise ** 2) + (read_noise[gain_mode] ** 2))))
snr[saturated] = 0
snr_list.append(snr)
return np.array(snr_list)
|
def get_snr(count_rate, exp_times, band='fuv', gain_mode='high'):
" Calculate SNR for given count rates and exposure times\n\t\n\tParameters\n\t----------\n\tcount_rate : float array\n\t\tArray of count rates in photons per second\n\t\t\n\texp_times: float array\n\t\tArray of exposure times in seconds\n\t\t\n\tband : string\n\t\tWhich UVEX band to use, options are 'nuv' and 'fuv'\n\t\tDefaults to 'fuv'\n\t\t\n\tgain_mode : string\n\t\tWhich detector gain mode to use, options are 'low' and 'high'\n\t\tDefaults to 'high'\n\t\t\n\tReturns\n\t-------\n\tsnr : 2-D float array\n\t\tArray of SNR with shape len(exp_times) x len(count_rate)\n\t"
snr_list = []
for t in exp_times:
(signal, saturated) = count_rate_to_electrons(count_rate, t, gain_mode=gain_mode)
(sky_bgd, _) = count_rate_to_electrons(sky_bgd_rate[band], t, gain_mode=gain_mode)
shot_noise = (np.sqrt((signal + sky_bgd)).value * u.electron)
snr = (signal / np.sqrt(((shot_noise ** 2) + (read_noise[gain_mode] ** 2))))
snr[saturated] = 0
snr_list.append(snr)
return np.array(snr_list)<|docstring|>Calculate SNR for given count rates and exposure times
Parameters
----------
count_rate : float array
Array of count rates in photons per second
exp_times: float array
Array of exposure times in seconds
band : string
Which UVEX band to use, options are 'nuv' and 'fuv'
Defaults to 'fuv'
gain_mode : string
Which detector gain mode to use, options are 'low' and 'high'
Defaults to 'high'
Returns
-------
snr : 2-D float array
Array of SNR with shape len(exp_times) x len(count_rate)<|endoftext|>
|
37b708c34013630125279389ce863e173fb87e9e3ea9f0dce6e74661fba0995a
|
def perform_hdr_simple(pixels, saturated, exp_times):
' Simple HDR algorithm to iterate through exposure times and select pixels from as long an exposure as possible\n\t\n\tParameters\n\t----------\n\tpixels : 2-D float array\n\t\tArray of pixel values (could be signal or SNR) to be selected\n\t\tSecond dimension must be same length as exp_times\n\t\t\n\tsaturated: bool array\n\t\tArray stating which pixels are saturated (i.e. True), the same shape as pixels\n\t\t\n\texp_times: float array\n\t\tArray of exposure times in seconds\n\t\t\n\tReturns\n\t-------\n\thdr_pixels : float array\n\t\t1-D array of pixel values selected from pixels based on exp_times and saturation\n\t'
sortind = np.argsort((- exp_times))
hdr_pixels = np.zeros(pixels.shape[1])
prev_sat = True
for i in sortind:
this_sat = saturated[i]
this_exp = (prev_sat & (~ this_sat))
hdr_pixels[this_exp] = pixels[i][this_exp]
prev_sat = this_sat
return hdr_pixels
|
Simple HDR algorithm to iterate through exposure times and select pixels from as long an exposure as possible
Parameters
----------
pixels : 2-D float array
Array of pixel values (could be signal or SNR) to be selected
Second dimension must be same length as exp_times
saturated: bool array
Array stating which pixels are saturated (i.e. True), the same shape as pixels
exp_times: float array
Array of exposure times in seconds
Returns
-------
hdr_pixels : float array
1-D array of pixel values selected from pixels based on exp_times and saturation
|
cmost_hdr.py
|
perform_hdr_simple
|
hpearnshaw/cmost-analysis
| 0 |
python
|
def perform_hdr_simple(pixels, saturated, exp_times):
' Simple HDR algorithm to iterate through exposure times and select pixels from as long an exposure as possible\n\t\n\tParameters\n\t----------\n\tpixels : 2-D float array\n\t\tArray of pixel values (could be signal or SNR) to be selected\n\t\tSecond dimension must be same length as exp_times\n\t\t\n\tsaturated: bool array\n\t\tArray stating which pixels are saturated (i.e. True), the same shape as pixels\n\t\t\n\texp_times: float array\n\t\tArray of exposure times in seconds\n\t\t\n\tReturns\n\t-------\n\thdr_pixels : float array\n\t\t1-D array of pixel values selected from pixels based on exp_times and saturation\n\t'
sortind = np.argsort((- exp_times))
hdr_pixels = np.zeros(pixels.shape[1])
prev_sat = True
for i in sortind:
this_sat = saturated[i]
this_exp = (prev_sat & (~ this_sat))
hdr_pixels[this_exp] = pixels[i][this_exp]
prev_sat = this_sat
return hdr_pixels
|
def perform_hdr_simple(pixels, saturated, exp_times):
' Simple HDR algorithm to iterate through exposure times and select pixels from as long an exposure as possible\n\t\n\tParameters\n\t----------\n\tpixels : 2-D float array\n\t\tArray of pixel values (could be signal or SNR) to be selected\n\t\tSecond dimension must be same length as exp_times\n\t\t\n\tsaturated: bool array\n\t\tArray stating which pixels are saturated (i.e. True), the same shape as pixels\n\t\t\n\texp_times: float array\n\t\tArray of exposure times in seconds\n\t\t\n\tReturns\n\t-------\n\thdr_pixels : float array\n\t\t1-D array of pixel values selected from pixels based on exp_times and saturation\n\t'
sortind = np.argsort((- exp_times))
hdr_pixels = np.zeros(pixels.shape[1])
prev_sat = True
for i in sortind:
this_sat = saturated[i]
this_exp = (prev_sat & (~ this_sat))
hdr_pixels[this_exp] = pixels[i][this_exp]
prev_sat = this_sat
return hdr_pixels<|docstring|>Simple HDR algorithm to iterate through exposure times and select pixels from as long an exposure as possible
Parameters
----------
pixels : 2-D float array
Array of pixel values (could be signal or SNR) to be selected
Second dimension must be same length as exp_times
saturated: bool array
Array stating which pixels are saturated (i.e. True), the same shape as pixels
exp_times: float array
Array of exposure times in seconds
Returns
-------
hdr_pixels : float array
1-D array of pixel values selected from pixels based on exp_times and saturation<|endoftext|>
|
259131b1b362565ae6d79836961783b49136cebcfff4a15f41dc029c6673374d
|
def create_image(im_frame_size, exp_time, sources=[], band='fuv', gain_mode='high'):
' Creates an image from an exposure, with given sources\n \n Parameters\n ----------\n im_frame_size : int\n Size of the resulting image in pixels\n \n exp_time: float\n Exposure time in seconds\n \n sources: QTable object\n QTable of sources in format (x_pos, y_pos, count_rate)\n x_pos and y_pos are floats, fractional positions between 0 and 1\n count_rate is in photons per second\n '
oversample = 6
src_frame_size = 25
pixel_size_init = (pixel_size / oversample)
src_frame_size_init = (src_frame_size * oversample)
im_frame_size_init = (im_frame_size * oversample)
im_array = ((np.zeros([im_frame_size_init, im_frame_size_init]) * u.ph) / u.s)
psf_kernel = Gaussian2DKernel((psf_fwhm / pixel_size_init), x_size=src_frame_size_init, y_size=src_frame_size_init)
psf_array = psf_kernel.array
if (len(sources) > 0):
source_inv = np.array([sources['y_pos'], sources['x_pos']])
source_pix = (source_inv.transpose() * np.array(im_array.shape)).transpose().astype(int)
im_array[tuple(source_pix)] += sources['src_cr']
im_psf = (convolve_fft(im_array.value, psf_kernel) * im_array.unit)
shape = (im_frame_size, oversample, im_frame_size, oversample)
im_binned = im_psf.reshape(shape).sum((- 1)).sum(1)
im_binned[(im_binned < 0)] = 0
im_counts = (im_binned * exp_time)
im_sky = ((np.ones(im_counts.shape) * sky_bgd_rate[band]) * exp_time)
im_poisson = ((np.random.poisson(im_counts.value) + np.random.poisson(im_sky.value)) * im_counts.unit)
im_read = ((im_poisson * qe) + (dark_current * exp_time))
im_read[(im_read > well_depth[gain_mode])] = well_depth[gain_mode]
im_read += (np.random.normal(loc=0, scale=read_noise[gain_mode].value, size=im_read.shape) * im_read.unit)
im_read = np.floor(im_read)
im_read[(im_read < 0)] = 0
im_adu = (im_read * gain[gain_mode])
return im_adu
|
Creates an image from an exposure, with given sources
Parameters
----------
im_frame_size : int
Size of the resulting image in pixels
exp_time: float
Exposure time in seconds
sources: QTable object
QTable of sources in format (x_pos, y_pos, count_rate)
x_pos and y_pos are floats, fractional positions between 0 and 1
count_rate is in photons per second
|
cmost_hdr.py
|
create_image
|
hpearnshaw/cmost-analysis
| 0 |
python
|
def create_image(im_frame_size, exp_time, sources=[], band='fuv', gain_mode='high'):
' Creates an image from an exposure, with given sources\n \n Parameters\n ----------\n im_frame_size : int\n Size of the resulting image in pixels\n \n exp_time: float\n Exposure time in seconds\n \n sources: QTable object\n QTable of sources in format (x_pos, y_pos, count_rate)\n x_pos and y_pos are floats, fractional positions between 0 and 1\n count_rate is in photons per second\n '
oversample = 6
src_frame_size = 25
pixel_size_init = (pixel_size / oversample)
src_frame_size_init = (src_frame_size * oversample)
im_frame_size_init = (im_frame_size * oversample)
im_array = ((np.zeros([im_frame_size_init, im_frame_size_init]) * u.ph) / u.s)
psf_kernel = Gaussian2DKernel((psf_fwhm / pixel_size_init), x_size=src_frame_size_init, y_size=src_frame_size_init)
psf_array = psf_kernel.array
if (len(sources) > 0):
source_inv = np.array([sources['y_pos'], sources['x_pos']])
source_pix = (source_inv.transpose() * np.array(im_array.shape)).transpose().astype(int)
im_array[tuple(source_pix)] += sources['src_cr']
im_psf = (convolve_fft(im_array.value, psf_kernel) * im_array.unit)
shape = (im_frame_size, oversample, im_frame_size, oversample)
im_binned = im_psf.reshape(shape).sum((- 1)).sum(1)
im_binned[(im_binned < 0)] = 0
im_counts = (im_binned * exp_time)
im_sky = ((np.ones(im_counts.shape) * sky_bgd_rate[band]) * exp_time)
im_poisson = ((np.random.poisson(im_counts.value) + np.random.poisson(im_sky.value)) * im_counts.unit)
im_read = ((im_poisson * qe) + (dark_current * exp_time))
im_read[(im_read > well_depth[gain_mode])] = well_depth[gain_mode]
im_read += (np.random.normal(loc=0, scale=read_noise[gain_mode].value, size=im_read.shape) * im_read.unit)
im_read = np.floor(im_read)
im_read[(im_read < 0)] = 0
im_adu = (im_read * gain[gain_mode])
return im_adu
|
def create_image(im_frame_size, exp_time, sources=[], band='fuv', gain_mode='high'):
' Creates an image from an exposure, with given sources\n \n Parameters\n ----------\n im_frame_size : int\n Size of the resulting image in pixels\n \n exp_time: float\n Exposure time in seconds\n \n sources: QTable object\n QTable of sources in format (x_pos, y_pos, count_rate)\n x_pos and y_pos are floats, fractional positions between 0 and 1\n count_rate is in photons per second\n '
oversample = 6
src_frame_size = 25
pixel_size_init = (pixel_size / oversample)
src_frame_size_init = (src_frame_size * oversample)
im_frame_size_init = (im_frame_size * oversample)
im_array = ((np.zeros([im_frame_size_init, im_frame_size_init]) * u.ph) / u.s)
psf_kernel = Gaussian2DKernel((psf_fwhm / pixel_size_init), x_size=src_frame_size_init, y_size=src_frame_size_init)
psf_array = psf_kernel.array
if (len(sources) > 0):
source_inv = np.array([sources['y_pos'], sources['x_pos']])
source_pix = (source_inv.transpose() * np.array(im_array.shape)).transpose().astype(int)
im_array[tuple(source_pix)] += sources['src_cr']
im_psf = (convolve_fft(im_array.value, psf_kernel) * im_array.unit)
shape = (im_frame_size, oversample, im_frame_size, oversample)
im_binned = im_psf.reshape(shape).sum((- 1)).sum(1)
im_binned[(im_binned < 0)] = 0
im_counts = (im_binned * exp_time)
im_sky = ((np.ones(im_counts.shape) * sky_bgd_rate[band]) * exp_time)
im_poisson = ((np.random.poisson(im_counts.value) + np.random.poisson(im_sky.value)) * im_counts.unit)
im_read = ((im_poisson * qe) + (dark_current * exp_time))
im_read[(im_read > well_depth[gain_mode])] = well_depth[gain_mode]
im_read += (np.random.normal(loc=0, scale=read_noise[gain_mode].value, size=im_read.shape) * im_read.unit)
im_read = np.floor(im_read)
im_read[(im_read < 0)] = 0
im_adu = (im_read * gain[gain_mode])
return im_adu<|docstring|>Creates an image from an exposure, with given sources
Parameters
----------
im_frame_size : int
Size of the resulting image in pixels
exp_time: float
Exposure time in seconds
sources: QTable object
QTable of sources in format (x_pos, y_pos, count_rate)
x_pos and y_pos are floats, fractional positions between 0 and 1
count_rate is in photons per second<|endoftext|>
|
a46164b7aa459ad9123a72315c1e609329d3b60411b807aa01da1c2f2c263041
|
def fetch(url: str) -> str:
'Fetch URL.\n\n Parameters\n ----------\n url\n URL.\n\n Raises\n ------\n :code:`CommunicationError`\n If the HTTP request is unsuccessful.\n\n Returns\n -------\n :code:`str`\n Body.\n '
res = req.get(url, allow_redirects=False)
if re.match('^2\\d{2}$', str(res.status_code)):
return res.text
else:
raise CommunicationError(f'''Unexpected error in fetching html page: {url}
Status Code: {res.status_code}
''', status_code=res.status_code)
|
Fetch URL.
Parameters
----------
url
URL.
Raises
------
:code:`CommunicationError`
If the HTTP request is unsuccessful.
Returns
-------
:code:`str`
Body.
|
lyrics_classifier/collect_data/scrap/__init__.py
|
fetch
|
OliverSieweke/lyrics-classifier
| 0 |
python
|
def fetch(url: str) -> str:
'Fetch URL.\n\n Parameters\n ----------\n url\n URL.\n\n Raises\n ------\n :code:`CommunicationError`\n If the HTTP request is unsuccessful.\n\n Returns\n -------\n :code:`str`\n Body.\n '
res = req.get(url, allow_redirects=False)
if re.match('^2\\d{2}$', str(res.status_code)):
return res.text
else:
raise CommunicationError(f'Unexpected error in fetching html page: {url}
Status Code: {res.status_code}
', status_code=res.status_code)
|
def fetch(url: str) -> str:
'Fetch URL.\n\n Parameters\n ----------\n url\n URL.\n\n Raises\n ------\n :code:`CommunicationError`\n If the HTTP request is unsuccessful.\n\n Returns\n -------\n :code:`str`\n Body.\n '
res = req.get(url, allow_redirects=False)
if re.match('^2\\d{2}$', str(res.status_code)):
return res.text
else:
raise CommunicationError(f'Unexpected error in fetching html page: {url}
Status Code: {res.status_code}
', status_code=res.status_code)<|docstring|>Fetch URL.
Parameters
----------
url
URL.
Raises
------
:code:`CommunicationError`
If the HTTP request is unsuccessful.
Returns
-------
:code:`str`
Body.<|endoftext|>
|
476551df544ac895c45f67eea7f88c1d858c31cf404a77c0dd2ff4953b2da625
|
def retrieve_artists_html_pages(force: bool=False) -> None:
'Retrieve and save artist HTML pages from `lyrics.com`.\n\n Parameters\n ----------\n force\n Overwrite HTML pages that have already been retrieved.\n\n Returns\n -------\n :code:`None`\n '
print_table('ARTISTS HTML PAGES')
for artist in get_artists():
artist_html_file_path = paths.artist_html_file_path(artist)
if (artist_html_file_path.exists() and (not force)):
print_table_entry(artist, 'HTML page already retrieved.', LogLevel.INFO)
else:
artist_url = lyrics_com.artist_url(artist)
try:
artist_html_page = fetch(artist_url)
artist_html_file_path.write_text(artist_html_page)
print_table_entry(artist, 'HTML page retrieved and saved.', LogLevel.INFO)
except CommunicationError as err:
print_table_entry(artist, f'Error in retrieving HTML page [{err.status_code}].', LogLevel.ERROR)
|
Retrieve and save artist HTML pages from `lyrics.com`.
Parameters
----------
force
Overwrite HTML pages that have already been retrieved.
Returns
-------
:code:`None`
|
lyrics_classifier/collect_data/scrap/__init__.py
|
retrieve_artists_html_pages
|
OliverSieweke/lyrics-classifier
| 0 |
python
|
def retrieve_artists_html_pages(force: bool=False) -> None:
'Retrieve and save artist HTML pages from `lyrics.com`.\n\n Parameters\n ----------\n force\n Overwrite HTML pages that have already been retrieved.\n\n Returns\n -------\n :code:`None`\n '
print_table('ARTISTS HTML PAGES')
for artist in get_artists():
artist_html_file_path = paths.artist_html_file_path(artist)
if (artist_html_file_path.exists() and (not force)):
print_table_entry(artist, 'HTML page already retrieved.', LogLevel.INFO)
else:
artist_url = lyrics_com.artist_url(artist)
try:
artist_html_page = fetch(artist_url)
artist_html_file_path.write_text(artist_html_page)
print_table_entry(artist, 'HTML page retrieved and saved.', LogLevel.INFO)
except CommunicationError as err:
print_table_entry(artist, f'Error in retrieving HTML page [{err.status_code}].', LogLevel.ERROR)
|
def retrieve_artists_html_pages(force: bool=False) -> None:
'Retrieve and save artist HTML pages from `lyrics.com`.\n\n Parameters\n ----------\n force\n Overwrite HTML pages that have already been retrieved.\n\n Returns\n -------\n :code:`None`\n '
print_table('ARTISTS HTML PAGES')
for artist in get_artists():
artist_html_file_path = paths.artist_html_file_path(artist)
if (artist_html_file_path.exists() and (not force)):
print_table_entry(artist, 'HTML page already retrieved.', LogLevel.INFO)
else:
artist_url = lyrics_com.artist_url(artist)
try:
artist_html_page = fetch(artist_url)
artist_html_file_path.write_text(artist_html_page)
print_table_entry(artist, 'HTML page retrieved and saved.', LogLevel.INFO)
except CommunicationError as err:
print_table_entry(artist, f'Error in retrieving HTML page [{err.status_code}].', LogLevel.ERROR)<|docstring|>Retrieve and save artist HTML pages from `lyrics.com`.
Parameters
----------
force
Overwrite HTML pages that have already been retrieved.
Returns
-------
:code:`None`<|endoftext|>
|
0af52c180a7a906952b2258bbfb9cc59fa1eba73042a405f84caf793099d8b92
|
def retrieve_songs_html_pages(force: bool=False) -> None:
'Retrieve and save song HTML pages from `lyrics.com`.\n\n Parameters\n ----------\n force\n Overwrite HTML pages that have already been retrieved.\n\n Returns\n -------\n :code:`None`\n '
print_table('SONGS HTML PAGES')
with paths.songs_csv_file_path().open('r') as songs_csv_file:
reader = csv.DictReader(songs_csv_file)
for song in map((lambda attributes: Song(**attributes)), reader):
song_html_file_path = paths.song_html_file_path(song)
if (song_html_file_path.exists() and (not force)):
print_table_entry(song.song_title, 'HTML page already retrieved.', LogLevel.INFO)
else:
song_url = lyrics_com.song_url(song.song_path)
try:
song_html_page = fetch(song_url)
song_html_file_path.write_text(song_html_page)
print_table_entry(song.song_title, 'HTML page retrieved and saved.', LogLevel.INFO)
except CommunicationError as err:
print_table_entry(song.song_title, f'Error in retrieving HTML page [{err.status_code}].', LogLevel.ERROR)
|
Retrieve and save song HTML pages from `lyrics.com`.
Parameters
----------
force
Overwrite HTML pages that have already been retrieved.
Returns
-------
:code:`None`
|
lyrics_classifier/collect_data/scrap/__init__.py
|
retrieve_songs_html_pages
|
OliverSieweke/lyrics-classifier
| 0 |
python
|
def retrieve_songs_html_pages(force: bool=False) -> None:
'Retrieve and save song HTML pages from `lyrics.com`.\n\n Parameters\n ----------\n force\n Overwrite HTML pages that have already been retrieved.\n\n Returns\n -------\n :code:`None`\n '
print_table('SONGS HTML PAGES')
with paths.songs_csv_file_path().open('r') as songs_csv_file:
reader = csv.DictReader(songs_csv_file)
for song in map((lambda attributes: Song(**attributes)), reader):
song_html_file_path = paths.song_html_file_path(song)
if (song_html_file_path.exists() and (not force)):
print_table_entry(song.song_title, 'HTML page already retrieved.', LogLevel.INFO)
else:
song_url = lyrics_com.song_url(song.song_path)
try:
song_html_page = fetch(song_url)
song_html_file_path.write_text(song_html_page)
print_table_entry(song.song_title, 'HTML page retrieved and saved.', LogLevel.INFO)
except CommunicationError as err:
print_table_entry(song.song_title, f'Error in retrieving HTML page [{err.status_code}].', LogLevel.ERROR)
|
def retrieve_songs_html_pages(force: bool=False) -> None:
'Retrieve and save song HTML pages from `lyrics.com`.\n\n Parameters\n ----------\n force\n Overwrite HTML pages that have already been retrieved.\n\n Returns\n -------\n :code:`None`\n '
print_table('SONGS HTML PAGES')
with paths.songs_csv_file_path().open('r') as songs_csv_file:
reader = csv.DictReader(songs_csv_file)
for song in map((lambda attributes: Song(**attributes)), reader):
song_html_file_path = paths.song_html_file_path(song)
if (song_html_file_path.exists() and (not force)):
print_table_entry(song.song_title, 'HTML page already retrieved.', LogLevel.INFO)
else:
song_url = lyrics_com.song_url(song.song_path)
try:
song_html_page = fetch(song_url)
song_html_file_path.write_text(song_html_page)
print_table_entry(song.song_title, 'HTML page retrieved and saved.', LogLevel.INFO)
except CommunicationError as err:
print_table_entry(song.song_title, f'Error in retrieving HTML page [{err.status_code}].', LogLevel.ERROR)<|docstring|>Retrieve and save song HTML pages from `lyrics.com`.
Parameters
----------
force
Overwrite HTML pages that have already been retrieved.
Returns
-------
:code:`None`<|endoftext|>
|
31093aa79ba906aca9a4d2868b3d91efc1658acc49b208db16eb642a6c720351
|
def make_name_from_str(string, max_size=100):
' Return a name that is capitalized and without spaces '
return ''.join((('%s%s' % (w[0].upper(), w[1:])) for w in string.split()))[:max_size]
|
Return a name that is capitalized and without spaces
|
macho_symbols.py
|
make_name_from_str
|
bambu/binaryninja-machosymbols
| 7 |
python
|
def make_name_from_str(string, max_size=100):
' '
return .join((('%s%s' % (w[0].upper(), w[1:])) for w in string.split()))[:max_size]
|
def make_name_from_str(string, max_size=100):
' '
return .join((('%s%s' % (w[0].upper(), w[1:])) for w in string.split()))[:max_size]<|docstring|>Return a name that is capitalized and without spaces<|endoftext|>
|
8f1826ba32a1240ce483d3aa6d666beb4266753dfe96184252793cd3ec249d1f
|
def generate_selrefs(view):
' Create symbols for entries in __objc_selrefs section '
if (view.view_type != 'Mach-O'):
return
selrefs = view.sections.get('__objc_selrefs', None)
if (not selrefs):
return
initialize_idc(view)
size = view.arch.address_size
view.begin_undo_actions()
for address in xrange(selrefs.start, selrefs.end, size):
if view.get_symbol_at(address):
continue
ref_str = GetString(Pointer(address))
symbol_name = ('selRef_' + make_name_from_str(ref_str))
view.define_user_symbol(Symbol(SymbolType.DataSymbol, address, symbol_name))
view.commit_undo_actions()
|
Create symbols for entries in __objc_selrefs section
|
macho_symbols.py
|
generate_selrefs
|
bambu/binaryninja-machosymbols
| 7 |
python
|
def generate_selrefs(view):
' '
if (view.view_type != 'Mach-O'):
return
selrefs = view.sections.get('__objc_selrefs', None)
if (not selrefs):
return
initialize_idc(view)
size = view.arch.address_size
view.begin_undo_actions()
for address in xrange(selrefs.start, selrefs.end, size):
if view.get_symbol_at(address):
continue
ref_str = GetString(Pointer(address))
symbol_name = ('selRef_' + make_name_from_str(ref_str))
view.define_user_symbol(Symbol(SymbolType.DataSymbol, address, symbol_name))
view.commit_undo_actions()
|
def generate_selrefs(view):
' '
if (view.view_type != 'Mach-O'):
return
selrefs = view.sections.get('__objc_selrefs', None)
if (not selrefs):
return
initialize_idc(view)
size = view.arch.address_size
view.begin_undo_actions()
for address in xrange(selrefs.start, selrefs.end, size):
if view.get_symbol_at(address):
continue
ref_str = GetString(Pointer(address))
symbol_name = ('selRef_' + make_name_from_str(ref_str))
view.define_user_symbol(Symbol(SymbolType.DataSymbol, address, symbol_name))
view.commit_undo_actions()<|docstring|>Create symbols for entries in __objc_selrefs section<|endoftext|>
|
a87bd21960b1c1dc6fff7683f09b6b747459208baf9b01545a687fbcc6ac11ab
|
def generate_bind_symbols(view):
' Generate bind symbols using dyldinfo command '
if (view.view_type != 'Mach-O'):
return
if (sys.platform != 'darwin'):
return
raw_view = view.get_view_of_type('Raw')
with NamedTemporaryFile() as data_file:
data_file.write(raw_view.read(0, len(raw_view)))
data_file.flush()
output = subprocess.check_output(('xcrun dyldinfo -bind %s | tail -n +3' % data_file.name), shell=True)
view.begin_undo_actions()
for line in output.splitlines():
(_, section, address, _, _, _, symbol) = line.split()[:7]
address = int(address, 0)
if view.get_symbol_at(address):
continue
if (section == '__got'):
symbol_type = SymbolType.ImportedFunctionSymbol
else:
symbol_type = SymbolType.DataSymbol
view.define_user_symbol(Symbol(symbol_type, address, symbol))
view.commit_undo_actions()
|
Generate bind symbols using dyldinfo command
|
macho_symbols.py
|
generate_bind_symbols
|
bambu/binaryninja-machosymbols
| 7 |
python
|
def generate_bind_symbols(view):
' '
if (view.view_type != 'Mach-O'):
return
if (sys.platform != 'darwin'):
return
raw_view = view.get_view_of_type('Raw')
with NamedTemporaryFile() as data_file:
data_file.write(raw_view.read(0, len(raw_view)))
data_file.flush()
output = subprocess.check_output(('xcrun dyldinfo -bind %s | tail -n +3' % data_file.name), shell=True)
view.begin_undo_actions()
for line in output.splitlines():
(_, section, address, _, _, _, symbol) = line.split()[:7]
address = int(address, 0)
if view.get_symbol_at(address):
continue
if (section == '__got'):
symbol_type = SymbolType.ImportedFunctionSymbol
else:
symbol_type = SymbolType.DataSymbol
view.define_user_symbol(Symbol(symbol_type, address, symbol))
view.commit_undo_actions()
|
def generate_bind_symbols(view):
' '
if (view.view_type != 'Mach-O'):
return
if (sys.platform != 'darwin'):
return
raw_view = view.get_view_of_type('Raw')
with NamedTemporaryFile() as data_file:
data_file.write(raw_view.read(0, len(raw_view)))
data_file.flush()
output = subprocess.check_output(('xcrun dyldinfo -bind %s | tail -n +3' % data_file.name), shell=True)
view.begin_undo_actions()
for line in output.splitlines():
(_, section, address, _, _, _, symbol) = line.split()[:7]
address = int(address, 0)
if view.get_symbol_at(address):
continue
if (section == '__got'):
symbol_type = SymbolType.ImportedFunctionSymbol
else:
symbol_type = SymbolType.DataSymbol
view.define_user_symbol(Symbol(symbol_type, address, symbol))
view.commit_undo_actions()<|docstring|>Generate bind symbols using dyldinfo command<|endoftext|>
|
1ed2eb898e4db45e8d6cddfb6004d92d3f259d6c091067316613f72ff765ca4c
|
def generate_function_names(view):
' Generate symbols for Objective-C functions '
if (view.view_type != 'Mach-O'):
return
ptr_size = view.arch.address_size
if (ptr_size != 8):
return
try:
class_list = view.sections['__objc_classlist']
data_section = view.sections['__objc_data']
const_section = view.sections['__objc_const']
except KeyError:
return
classlist_pointers = struct.unpack(('<' + ('Q' * (len(class_list) / ptr_size))), view.read(class_list.start, len(class_list)))
data_content = view.read(data_section.start, data_section.length)
const_content = view.read(const_section.start, const_section.length)
initialize_idc(view)
view.begin_undo_actions()
for class_pointer in classlist_pointers:
objc_class = Objc2Class(data_content, (class_pointer - data_section.start))
objc_meta = Objc2Class(data_content, (objc_class.isa - data_section.start))
metadata = Objc2ClassRo(const_content, (objc_meta.info - const_section.start))
classdata = Objc2ClassRo(const_content, (objc_class.info - const_section.start))
class_name = GetString(metadata.name)
for (selector_name, imp) in get_methods(classdata, const_content, const_section.start):
function = view.get_function_at(imp)
function.name = ('-[%s %s]' % (class_name, selector_name))
for (selector_name, imp) in get_methods(metadata, const_content, const_section.start):
function = view.get_function_at(imp)
function.name = ('+[%s %s]' % (class_name, selector_name))
view.commit_undo_actions()
view.update_analysis()
|
Generate symbols for Objective-C functions
|
macho_symbols.py
|
generate_function_names
|
bambu/binaryninja-machosymbols
| 7 |
python
|
def generate_function_names(view):
' '
if (view.view_type != 'Mach-O'):
return
ptr_size = view.arch.address_size
if (ptr_size != 8):
return
try:
class_list = view.sections['__objc_classlist']
data_section = view.sections['__objc_data']
const_section = view.sections['__objc_const']
except KeyError:
return
classlist_pointers = struct.unpack(('<' + ('Q' * (len(class_list) / ptr_size))), view.read(class_list.start, len(class_list)))
data_content = view.read(data_section.start, data_section.length)
const_content = view.read(const_section.start, const_section.length)
initialize_idc(view)
view.begin_undo_actions()
for class_pointer in classlist_pointers:
objc_class = Objc2Class(data_content, (class_pointer - data_section.start))
objc_meta = Objc2Class(data_content, (objc_class.isa - data_section.start))
metadata = Objc2ClassRo(const_content, (objc_meta.info - const_section.start))
classdata = Objc2ClassRo(const_content, (objc_class.info - const_section.start))
class_name = GetString(metadata.name)
for (selector_name, imp) in get_methods(classdata, const_content, const_section.start):
function = view.get_function_at(imp)
function.name = ('-[%s %s]' % (class_name, selector_name))
for (selector_name, imp) in get_methods(metadata, const_content, const_section.start):
function = view.get_function_at(imp)
function.name = ('+[%s %s]' % (class_name, selector_name))
view.commit_undo_actions()
view.update_analysis()
|
def generate_function_names(view):
' '
if (view.view_type != 'Mach-O'):
return
ptr_size = view.arch.address_size
if (ptr_size != 8):
return
try:
class_list = view.sections['__objc_classlist']
data_section = view.sections['__objc_data']
const_section = view.sections['__objc_const']
except KeyError:
return
classlist_pointers = struct.unpack(('<' + ('Q' * (len(class_list) / ptr_size))), view.read(class_list.start, len(class_list)))
data_content = view.read(data_section.start, data_section.length)
const_content = view.read(const_section.start, const_section.length)
initialize_idc(view)
view.begin_undo_actions()
for class_pointer in classlist_pointers:
objc_class = Objc2Class(data_content, (class_pointer - data_section.start))
objc_meta = Objc2Class(data_content, (objc_class.isa - data_section.start))
metadata = Objc2ClassRo(const_content, (objc_meta.info - const_section.start))
classdata = Objc2ClassRo(const_content, (objc_class.info - const_section.start))
class_name = GetString(metadata.name)
for (selector_name, imp) in get_methods(classdata, const_content, const_section.start):
function = view.get_function_at(imp)
function.name = ('-[%s %s]' % (class_name, selector_name))
for (selector_name, imp) in get_methods(metadata, const_content, const_section.start):
function = view.get_function_at(imp)
function.name = ('+[%s %s]' % (class_name, selector_name))
view.commit_undo_actions()
view.update_analysis()<|docstring|>Generate symbols for Objective-C functions<|endoftext|>
|
032ffd50d08e7b9ead5a69372d98bee6d9cf3af779911d3e0c3a43132f1babb2
|
def get_methods(class_ro, content, section_base):
' Retrieve objc2_meth from read only class '
if (class_ro.base_meths == 0):
raise StopIteration
offset = ((class_ro.base_meths + 8) - section_base)
num_methods = struct.unpack_from('<I', content, (offset - 4))[0]
for offset in xrange(offset, (offset + (num_methods * 24)), 24):
(name, _, imp) = struct.unpack_from('<QQQ', content, offset)
(yield (GetString(name), imp))
|
Retrieve objc2_meth from read only class
|
macho_symbols.py
|
get_methods
|
bambu/binaryninja-machosymbols
| 7 |
python
|
def get_methods(class_ro, content, section_base):
' '
if (class_ro.base_meths == 0):
raise StopIteration
offset = ((class_ro.base_meths + 8) - section_base)
num_methods = struct.unpack_from('<I', content, (offset - 4))[0]
for offset in xrange(offset, (offset + (num_methods * 24)), 24):
(name, _, imp) = struct.unpack_from('<QQQ', content, offset)
(yield (GetString(name), imp))
|
def get_methods(class_ro, content, section_base):
' '
if (class_ro.base_meths == 0):
raise StopIteration
offset = ((class_ro.base_meths + 8) - section_base)
num_methods = struct.unpack_from('<I', content, (offset - 4))[0]
for offset in xrange(offset, (offset + (num_methods * 24)), 24):
(name, _, imp) = struct.unpack_from('<QQQ', content, offset)
(yield (GetString(name), imp))<|docstring|>Retrieve objc2_meth from read only class<|endoftext|>
|
56640c97da74c307e6535e56814b2895597731e1543da6044af5bd18896ed60a
|
def norm_control_plex(peptides, sample_cols, pooled_col, standard_vals):
' Normalises per peptide according to control channel. Returns df with updated sample cols and removes control channel'
pooled_factor = pd.merge(pd.DataFrame(peptides[pooled_col]), pd.DataFrame(standard_vals), left_index=True, right_index=True)
pooled_factor['pooled_factor'] = (pooled_factor.iloc[(:, 0)] / pooled_factor.iloc[(:, 1)])
peptides[sample_cols] = peptides[sample_cols].multiply(pooled_factor['pooled_factor'], axis=0)
return peptides
|
Normalises per peptide according to control channel. Returns df with updated sample cols and removes control channel
|
src/lysate_urea_denaturation/preprocessing/2_peptide_normalisation.py
|
norm_control_plex
|
dezeraecox-manuscripts/COX_Proteome-stability
| 0 |
python
|
def norm_control_plex(peptides, sample_cols, pooled_col, standard_vals):
' '
pooled_factor = pd.merge(pd.DataFrame(peptides[pooled_col]), pd.DataFrame(standard_vals), left_index=True, right_index=True)
pooled_factor['pooled_factor'] = (pooled_factor.iloc[(:, 0)] / pooled_factor.iloc[(:, 1)])
peptides[sample_cols] = peptides[sample_cols].multiply(pooled_factor['pooled_factor'], axis=0)
return peptides
|
def norm_control_plex(peptides, sample_cols, pooled_col, standard_vals):
' '
pooled_factor = pd.merge(pd.DataFrame(peptides[pooled_col]), pd.DataFrame(standard_vals), left_index=True, right_index=True)
pooled_factor['pooled_factor'] = (pooled_factor.iloc[(:, 0)] / pooled_factor.iloc[(:, 1)])
peptides[sample_cols] = peptides[sample_cols].multiply(pooled_factor['pooled_factor'], axis=0)
return peptides<|docstring|>Normalises per peptide according to control channel. Returns df with updated sample cols and removes control channel<|endoftext|>
|
3f25e522bb9a4f6b106a5ea464091f75bed12cf1774b7517dd917da99f210d9b
|
def cys_noncys_filter(peptides):
' Assigns cys_rank, then separates cys and noncys peptides.\n Collects only peptides from proteins that have at least one cys and one non-cys peptide'
peptides['cys_rank'] = [(1 if ('C' in sequence) else 0) for sequence in peptides['Sequence']]
cys_peptides = peptides[(peptides['cys_rank'] == 1)]
noncys_peptides = peptides[(peptides['cys_rank'] == 0)]
common_prots = set(cys_peptides['Proteins']).intersection(set(noncys_peptides['Proteins']))
cys_peptides = cys_peptides[cys_peptides['Proteins'].isin(common_prots)]
noncys_peptides = noncys_peptides[noncys_peptides['Proteins'].isin(common_prots)]
return (cys_peptides, noncys_peptides)
|
Assigns cys_rank, then separates cys and noncys peptides.
Collects only peptides from proteins that have at least one cys and one non-cys peptide
|
src/lysate_urea_denaturation/preprocessing/2_peptide_normalisation.py
|
cys_noncys_filter
|
dezeraecox-manuscripts/COX_Proteome-stability
| 0 |
python
|
def cys_noncys_filter(peptides):
' Assigns cys_rank, then separates cys and noncys peptides.\n Collects only peptides from proteins that have at least one cys and one non-cys peptide'
peptides['cys_rank'] = [(1 if ('C' in sequence) else 0) for sequence in peptides['Sequence']]
cys_peptides = peptides[(peptides['cys_rank'] == 1)]
noncys_peptides = peptides[(peptides['cys_rank'] == 0)]
common_prots = set(cys_peptides['Proteins']).intersection(set(noncys_peptides['Proteins']))
cys_peptides = cys_peptides[cys_peptides['Proteins'].isin(common_prots)]
noncys_peptides = noncys_peptides[noncys_peptides['Proteins'].isin(common_prots)]
return (cys_peptides, noncys_peptides)
|
def cys_noncys_filter(peptides):
' Assigns cys_rank, then separates cys and noncys peptides.\n Collects only peptides from proteins that have at least one cys and one non-cys peptide'
peptides['cys_rank'] = [(1 if ('C' in sequence) else 0) for sequence in peptides['Sequence']]
cys_peptides = peptides[(peptides['cys_rank'] == 1)]
noncys_peptides = peptides[(peptides['cys_rank'] == 0)]
common_prots = set(cys_peptides['Proteins']).intersection(set(noncys_peptides['Proteins']))
cys_peptides = cys_peptides[cys_peptides['Proteins'].isin(common_prots)]
noncys_peptides = noncys_peptides[noncys_peptides['Proteins'].isin(common_prots)]
return (cys_peptides, noncys_peptides)<|docstring|>Assigns cys_rank, then separates cys and noncys peptides.
Collects only peptides from proteins that have at least one cys and one non-cys peptide<|endoftext|>
|
ce509e9715fdb4d15391df18ec0bbc80659a568e4d8fdc91a2a943ca079ab6b1
|
def noncys_ci_calculator(noncys_peptides, sample_cols):
'Calculates relevant info per protein from noncys peptides, including overall mean, SD\n and the per-channel mean (used for cys/noncys calculation)'
noncys_cis = {}
for (protein, df) in noncys_peptides.groupby(['Proteins']):
values = df[sample_cols].values.flatten()
values = values[(~ np.isnan(values))]
noncys_cis[protein] = {'df': df, 'noncys_means': df[sample_cols].mean(), 'num_peptides': df.shape[0], 'values': values, 'pop_mean': np.mean(values), 'pop_stdev': np.std(values), 'num_vals': len(values)}
return noncys_cis
|
Calculates relevant info per protein from noncys peptides, including overall mean, SD
and the per-channel mean (used for cys/noncys calculation)
|
src/lysate_urea_denaturation/preprocessing/2_peptide_normalisation.py
|
noncys_ci_calculator
|
dezeraecox-manuscripts/COX_Proteome-stability
| 0 |
python
|
def noncys_ci_calculator(noncys_peptides, sample_cols):
'Calculates relevant info per protein from noncys peptides, including overall mean, SD\n and the per-channel mean (used for cys/noncys calculation)'
noncys_cis = {}
for (protein, df) in noncys_peptides.groupby(['Proteins']):
values = df[sample_cols].values.flatten()
values = values[(~ np.isnan(values))]
noncys_cis[protein] = {'df': df, 'noncys_means': df[sample_cols].mean(), 'num_peptides': df.shape[0], 'values': values, 'pop_mean': np.mean(values), 'pop_stdev': np.std(values), 'num_vals': len(values)}
return noncys_cis
|
def noncys_ci_calculator(noncys_peptides, sample_cols):
'Calculates relevant info per protein from noncys peptides, including overall mean, SD\n and the per-channel mean (used for cys/noncys calculation)'
noncys_cis = {}
for (protein, df) in noncys_peptides.groupby(['Proteins']):
values = df[sample_cols].values.flatten()
values = values[(~ np.isnan(values))]
noncys_cis[protein] = {'df': df, 'noncys_means': df[sample_cols].mean(), 'num_peptides': df.shape[0], 'values': values, 'pop_mean': np.mean(values), 'pop_stdev': np.std(values), 'num_vals': len(values)}
return noncys_cis<|docstring|>Calculates relevant info per protein from noncys peptides, including overall mean, SD
and the per-channel mean (used for cys/noncys calculation)<|endoftext|>
|
fde5929b3250dc0b348e09e3e40bb69d0b967ee4538d1133039491080b5f4b56
|
def cys_ratio(cys_peptides, noncys_cis, sample_cols):
'Calculates cys/noncys ratio per cys peptide, using the noncys per protein mean'
norm_cys = []
for (protein, df) in cys_peptides.groupby('Proteins'):
data = df.copy()
noncys_vals = noncys_cis[protein]['noncys_means']
data[sample_cols] = (data[sample_cols] / noncys_vals)
norm_cys.append(data)
cys_noncys_peptides = pd.concat(norm_cys)
return cys_noncys_peptides
|
Calculates cys/noncys ratio per cys peptide, using the noncys per protein mean
|
src/lysate_urea_denaturation/preprocessing/2_peptide_normalisation.py
|
cys_ratio
|
dezeraecox-manuscripts/COX_Proteome-stability
| 0 |
python
|
def cys_ratio(cys_peptides, noncys_cis, sample_cols):
norm_cys = []
for (protein, df) in cys_peptides.groupby('Proteins'):
data = df.copy()
noncys_vals = noncys_cis[protein]['noncys_means']
data[sample_cols] = (data[sample_cols] / noncys_vals)
norm_cys.append(data)
cys_noncys_peptides = pd.concat(norm_cys)
return cys_noncys_peptides
|
def cys_ratio(cys_peptides, noncys_cis, sample_cols):
norm_cys = []
for (protein, df) in cys_peptides.groupby('Proteins'):
data = df.copy()
noncys_vals = noncys_cis[protein]['noncys_means']
data[sample_cols] = (data[sample_cols] / noncys_vals)
norm_cys.append(data)
cys_noncys_peptides = pd.concat(norm_cys)
return cys_noncys_peptides<|docstring|>Calculates cys/noncys ratio per cys peptide, using the noncys per protein mean<|endoftext|>
|
59a486d5f7094afee2da238895d4ee71c5fc4af6048e1b222e39114f53b69953
|
def med_normalise(peptides, control_plex):
'Calculates correction factor from median of column 1, then normalises all other channels to this factor'
medians = peptides.median()
control_factor = (medians[control_plex] / medians)
peptides = (peptides * control_factor)
return peptides
|
Calculates correction factor from median of column 1, then normalises all other channels to this factor
|
src/lysate_urea_denaturation/preprocessing/2_peptide_normalisation.py
|
med_normalise
|
dezeraecox-manuscripts/COX_Proteome-stability
| 0 |
python
|
def med_normalise(peptides, control_plex):
medians = peptides.median()
control_factor = (medians[control_plex] / medians)
peptides = (peptides * control_factor)
return peptides
|
def med_normalise(peptides, control_plex):
medians = peptides.median()
control_factor = (medians[control_plex] / medians)
peptides = (peptides * control_factor)
return peptides<|docstring|>Calculates correction factor from median of column 1, then normalises all other channels to this factor<|endoftext|>
|
ddd0b631320f72eb50641bb65234cea542155fb17648185ae5193c019a8fb5e9
|
def __init__(__self__, *, resource_group_name: pulumi.Input[str], location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, tags: Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]=None):
'\n The set of arguments for constructing a DdosProtectionPlan resource.\n :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.\n '
pulumi.set(__self__, 'resource_group_name', resource_group_name)
if (location is not None):
pulumi.set(__self__, 'location', location)
if (name is not None):
pulumi.set(__self__, 'name', name)
if (tags is not None):
pulumi.set(__self__, 'tags', tags)
|
The set of arguments for constructing a DdosProtectionPlan resource.
:param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.
:param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
:param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
__init__
|
roderik/pulumi-azure
| 109 |
python
|
def __init__(__self__, *, resource_group_name: pulumi.Input[str], location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, tags: Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]=None):
'\n The set of arguments for constructing a DdosProtectionPlan resource.\n :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.\n '
pulumi.set(__self__, 'resource_group_name', resource_group_name)
if (location is not None):
pulumi.set(__self__, 'location', location)
if (name is not None):
pulumi.set(__self__, 'name', name)
if (tags is not None):
pulumi.set(__self__, 'tags', tags)
|
def __init__(__self__, *, resource_group_name: pulumi.Input[str], location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, tags: Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]=None):
'\n The set of arguments for constructing a DdosProtectionPlan resource.\n :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.\n '
pulumi.set(__self__, 'resource_group_name', resource_group_name)
if (location is not None):
pulumi.set(__self__, 'location', location)
if (name is not None):
pulumi.set(__self__, 'name', name)
if (tags is not None):
pulumi.set(__self__, 'tags', tags)<|docstring|>The set of arguments for constructing a DdosProtectionPlan resource.
:param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.
:param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
:param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.<|endoftext|>
|
f259476452552cbf4e714fa5e37de9f8a0d7c9ae5d3724b3d8fb7a15e1bbd3e7
|
@property
@pulumi.getter(name='resourceGroupName')
def resource_group_name(self) -> pulumi.Input[str]:
'\n The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n '
return pulumi.get(self, 'resource_group_name')
|
The name of the resource group in which to create the resource. Changing this forces a new resource to be created.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
resource_group_name
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter(name='resourceGroupName')
def resource_group_name(self) -> pulumi.Input[str]:
'\n \n '
return pulumi.get(self, 'resource_group_name')
|
@property
@pulumi.getter(name='resourceGroupName')
def resource_group_name(self) -> pulumi.Input[str]:
'\n \n '
return pulumi.get(self, 'resource_group_name')<|docstring|>The name of the resource group in which to create the resource. Changing this forces a new resource to be created.<|endoftext|>
|
ad8a652ff9d0726c92def5fbab71b25e061c211d2abed4991b1273a0bc2e9f34
|
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
'\n Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n '
return pulumi.get(self, 'location')
|
Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
location
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'location')
|
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'location')<|docstring|>Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.<|endoftext|>
|
ecfd1cf4bf95a05b677588deec59ab77242107d4f999e4707dcc1d1706ce4709
|
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n '
return pulumi.get(self, 'name')
|
Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
name
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'name')
|
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'name')<|docstring|>Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.<|endoftext|>
|
7d63086a7be36b11b91b236bf8134d7d088ef0a882d1aa87c623ee81094b634c
|
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]:
'\n A mapping of tags to assign to the resource.\n '
return pulumi.get(self, 'tags')
|
A mapping of tags to assign to the resource.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
tags
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]:
'\n \n '
return pulumi.get(self, 'tags')
|
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]:
'\n \n '
return pulumi.get(self, 'tags')<|docstring|>A mapping of tags to assign to the resource.<|endoftext|>
|
28382be8ddb01b863a64e938237e5553e3186a0249e167d8a879403177cf6827
|
def __init__(__self__, *, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, resource_group_name: Optional[pulumi.Input[str]]=None, tags: Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]=None, virtual_network_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]=None):
"\n Input properties used for looking up and filtering DdosProtectionPlan resources.\n :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.\n :param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_network_ids: A list of Virtual Network ID's associated with the DDoS Protection Plan.\n "
if (location is not None):
pulumi.set(__self__, 'location', location)
if (name is not None):
pulumi.set(__self__, 'name', name)
if (resource_group_name is not None):
pulumi.set(__self__, 'resource_group_name', resource_group_name)
if (tags is not None):
pulumi.set(__self__, 'tags', tags)
if (virtual_network_ids is not None):
pulumi.set(__self__, 'virtual_network_ids', virtual_network_ids)
|
Input properties used for looking up and filtering DdosProtectionPlan resources.
:param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
:param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.
:param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.
:param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_network_ids: A list of Virtual Network ID's associated with the DDoS Protection Plan.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
__init__
|
roderik/pulumi-azure
| 109 |
python
|
def __init__(__self__, *, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, resource_group_name: Optional[pulumi.Input[str]]=None, tags: Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]=None, virtual_network_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]=None):
"\n Input properties used for looking up and filtering DdosProtectionPlan resources.\n :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.\n :param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_network_ids: A list of Virtual Network ID's associated with the DDoS Protection Plan.\n "
if (location is not None):
pulumi.set(__self__, 'location', location)
if (name is not None):
pulumi.set(__self__, 'name', name)
if (resource_group_name is not None):
pulumi.set(__self__, 'resource_group_name', resource_group_name)
if (tags is not None):
pulumi.set(__self__, 'tags', tags)
if (virtual_network_ids is not None):
pulumi.set(__self__, 'virtual_network_ids', virtual_network_ids)
|
def __init__(__self__, *, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, resource_group_name: Optional[pulumi.Input[str]]=None, tags: Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]=None, virtual_network_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]=None):
"\n Input properties used for looking up and filtering DdosProtectionPlan resources.\n :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.\n :param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_network_ids: A list of Virtual Network ID's associated with the DDoS Protection Plan.\n "
if (location is not None):
pulumi.set(__self__, 'location', location)
if (name is not None):
pulumi.set(__self__, 'name', name)
if (resource_group_name is not None):
pulumi.set(__self__, 'resource_group_name', resource_group_name)
if (tags is not None):
pulumi.set(__self__, 'tags', tags)
if (virtual_network_ids is not None):
pulumi.set(__self__, 'virtual_network_ids', virtual_network_ids)<|docstring|>Input properties used for looking up and filtering DdosProtectionPlan resources.
:param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
:param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.
:param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.
:param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_network_ids: A list of Virtual Network ID's associated with the DDoS Protection Plan.<|endoftext|>
|
ad8a652ff9d0726c92def5fbab71b25e061c211d2abed4991b1273a0bc2e9f34
|
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
'\n Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n '
return pulumi.get(self, 'location')
|
Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
location
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'location')
|
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'location')<|docstring|>Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.<|endoftext|>
|
ecfd1cf4bf95a05b677588deec59ab77242107d4f999e4707dcc1d1706ce4709
|
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n '
return pulumi.get(self, 'name')
|
Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
name
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'name')
|
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'name')<|docstring|>Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.<|endoftext|>
|
640bb4e6b7a349a2471bc0fcae3b8f2e26c706a99707c36bc5ef9acce42975da
|
@property
@pulumi.getter(name='resourceGroupName')
def resource_group_name(self) -> Optional[pulumi.Input[str]]:
'\n The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n '
return pulumi.get(self, 'resource_group_name')
|
The name of the resource group in which to create the resource. Changing this forces a new resource to be created.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
resource_group_name
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter(name='resourceGroupName')
def resource_group_name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'resource_group_name')
|
@property
@pulumi.getter(name='resourceGroupName')
def resource_group_name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'resource_group_name')<|docstring|>The name of the resource group in which to create the resource. Changing this forces a new resource to be created.<|endoftext|>
|
7d63086a7be36b11b91b236bf8134d7d088ef0a882d1aa87c623ee81094b634c
|
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]:
'\n A mapping of tags to assign to the resource.\n '
return pulumi.get(self, 'tags')
|
A mapping of tags to assign to the resource.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
tags
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]:
'\n \n '
return pulumi.get(self, 'tags')
|
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]:
'\n \n '
return pulumi.get(self, 'tags')<|docstring|>A mapping of tags to assign to the resource.<|endoftext|>
|
789782c2d662c08c8edf1935eb10afdae935d8af21725fabe14fcdfa400ec9ee
|
@property
@pulumi.getter(name='virtualNetworkIds')
def virtual_network_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"\n A list of Virtual Network ID's associated with the DDoS Protection Plan.\n "
return pulumi.get(self, 'virtual_network_ids')
|
A list of Virtual Network ID's associated with the DDoS Protection Plan.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
virtual_network_ids
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter(name='virtualNetworkIds')
def virtual_network_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"\n \n "
return pulumi.get(self, 'virtual_network_ids')
|
@property
@pulumi.getter(name='virtualNetworkIds')
def virtual_network_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"\n \n "
return pulumi.get(self, 'virtual_network_ids')<|docstring|>A list of Virtual Network ID's associated with the DDoS Protection Plan.<|endoftext|>
|
be15b444cbc4b4a4d8ecce8ccdd0354f5eba31c92418dfa91cf4993c1c3a2a30
|
@overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, resource_group_name: Optional[pulumi.Input[str]]=None, tags: Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]=None, __props__=None):
'\n Manages an AzureNetwork DDoS Protection Plan.\n\n > **NOTE** Azure only allows `one` DDoS Protection Plan per region.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_azure as azure\n\n example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")\n example_ddos_protection_plan = azure.network.DdosProtectionPlan("exampleDdosProtectionPlan",\n location=example_resource_group.location,\n resource_group_name=example_resource_group.name)\n ```\n\n ## Import\n\n Azure DDoS Protection Plan can be imported using the `resource id`, e.g.\n\n ```sh\n $ pulumi import azure:network/ddosProtectionPlan:DdosProtectionPlan example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/ddosProtectionPlans/testddospplan\n ```\n\n :param str resource_name: The name of the resource.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.\n '
...
|
Manages an AzureNetwork DDoS Protection Plan.
> **NOTE** Azure only allows `one` DDoS Protection Plan per region.
## Example Usage
```python
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_ddos_protection_plan = azure.network.DdosProtectionPlan("exampleDdosProtectionPlan",
location=example_resource_group.location,
resource_group_name=example_resource_group.name)
```
## Import
Azure DDoS Protection Plan can be imported using the `resource id`, e.g.
```sh
$ pulumi import azure:network/ddosProtectionPlan:DdosProtectionPlan example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/ddosProtectionPlans/testddospplan
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
:param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.
:param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
__init__
|
roderik/pulumi-azure
| 109 |
python
|
@overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, resource_group_name: Optional[pulumi.Input[str]]=None, tags: Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]=None, __props__=None):
'\n Manages an AzureNetwork DDoS Protection Plan.\n\n > **NOTE** Azure only allows `one` DDoS Protection Plan per region.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_azure as azure\n\n example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")\n example_ddos_protection_plan = azure.network.DdosProtectionPlan("exampleDdosProtectionPlan",\n location=example_resource_group.location,\n resource_group_name=example_resource_group.name)\n ```\n\n ## Import\n\n Azure DDoS Protection Plan can be imported using the `resource id`, e.g.\n\n ```sh\n $ pulumi import azure:network/ddosProtectionPlan:DdosProtectionPlan example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/ddosProtectionPlans/testddospplan\n ```\n\n :param str resource_name: The name of the resource.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.\n '
...
|
@overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, resource_group_name: Optional[pulumi.Input[str]]=None, tags: Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]=None, __props__=None):
'\n Manages an AzureNetwork DDoS Protection Plan.\n\n > **NOTE** Azure only allows `one` DDoS Protection Plan per region.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_azure as azure\n\n example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")\n example_ddos_protection_plan = azure.network.DdosProtectionPlan("exampleDdosProtectionPlan",\n location=example_resource_group.location,\n resource_group_name=example_resource_group.name)\n ```\n\n ## Import\n\n Azure DDoS Protection Plan can be imported using the `resource id`, e.g.\n\n ```sh\n $ pulumi import azure:network/ddosProtectionPlan:DdosProtectionPlan example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/ddosProtectionPlans/testddospplan\n ```\n\n :param str resource_name: The name of the resource.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.\n '
...<|docstring|>Manages an AzureNetwork DDoS Protection Plan.
> **NOTE** Azure only allows `one` DDoS Protection Plan per region.
## Example Usage
```python
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_ddos_protection_plan = azure.network.DdosProtectionPlan("exampleDdosProtectionPlan",
location=example_resource_group.location,
resource_group_name=example_resource_group.name)
```
## Import
Azure DDoS Protection Plan can be imported using the `resource id`, e.g.
```sh
$ pulumi import azure:network/ddosProtectionPlan:DdosProtectionPlan example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/ddosProtectionPlans/testddospplan
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
:param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.
:param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.<|endoftext|>
|
bd9fff97c0b484b8bf3893b4ac7407264c26d5afbbd488bed76b6f9ad4291240
|
@overload
def __init__(__self__, resource_name: str, args: DdosProtectionPlanArgs, opts: Optional[pulumi.ResourceOptions]=None):
'\n Manages an AzureNetwork DDoS Protection Plan.\n\n > **NOTE** Azure only allows `one` DDoS Protection Plan per region.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_azure as azure\n\n example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")\n example_ddos_protection_plan = azure.network.DdosProtectionPlan("exampleDdosProtectionPlan",\n location=example_resource_group.location,\n resource_group_name=example_resource_group.name)\n ```\n\n ## Import\n\n Azure DDoS Protection Plan can be imported using the `resource id`, e.g.\n\n ```sh\n $ pulumi import azure:network/ddosProtectionPlan:DdosProtectionPlan example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/ddosProtectionPlans/testddospplan\n ```\n\n :param str resource_name: The name of the resource.\n :param DdosProtectionPlanArgs args: The arguments to use to populate this resource\'s properties.\n :param pulumi.ResourceOptions opts: Options for the resource.\n '
...
|
Manages an AzureNetwork DDoS Protection Plan.
> **NOTE** Azure only allows `one` DDoS Protection Plan per region.
## Example Usage
```python
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_ddos_protection_plan = azure.network.DdosProtectionPlan("exampleDdosProtectionPlan",
location=example_resource_group.location,
resource_group_name=example_resource_group.name)
```
## Import
Azure DDoS Protection Plan can be imported using the `resource id`, e.g.
```sh
$ pulumi import azure:network/ddosProtectionPlan:DdosProtectionPlan example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/ddosProtectionPlans/testddospplan
```
:param str resource_name: The name of the resource.
:param DdosProtectionPlanArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
__init__
|
roderik/pulumi-azure
| 109 |
python
|
@overload
def __init__(__self__, resource_name: str, args: DdosProtectionPlanArgs, opts: Optional[pulumi.ResourceOptions]=None):
'\n Manages an AzureNetwork DDoS Protection Plan.\n\n > **NOTE** Azure only allows `one` DDoS Protection Plan per region.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_azure as azure\n\n example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")\n example_ddos_protection_plan = azure.network.DdosProtectionPlan("exampleDdosProtectionPlan",\n location=example_resource_group.location,\n resource_group_name=example_resource_group.name)\n ```\n\n ## Import\n\n Azure DDoS Protection Plan can be imported using the `resource id`, e.g.\n\n ```sh\n $ pulumi import azure:network/ddosProtectionPlan:DdosProtectionPlan example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/ddosProtectionPlans/testddospplan\n ```\n\n :param str resource_name: The name of the resource.\n :param DdosProtectionPlanArgs args: The arguments to use to populate this resource\'s properties.\n :param pulumi.ResourceOptions opts: Options for the resource.\n '
...
|
@overload
def __init__(__self__, resource_name: str, args: DdosProtectionPlanArgs, opts: Optional[pulumi.ResourceOptions]=None):
'\n Manages an AzureNetwork DDoS Protection Plan.\n\n > **NOTE** Azure only allows `one` DDoS Protection Plan per region.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_azure as azure\n\n example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")\n example_ddos_protection_plan = azure.network.DdosProtectionPlan("exampleDdosProtectionPlan",\n location=example_resource_group.location,\n resource_group_name=example_resource_group.name)\n ```\n\n ## Import\n\n Azure DDoS Protection Plan can be imported using the `resource id`, e.g.\n\n ```sh\n $ pulumi import azure:network/ddosProtectionPlan:DdosProtectionPlan example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/ddosProtectionPlans/testddospplan\n ```\n\n :param str resource_name: The name of the resource.\n :param DdosProtectionPlanArgs args: The arguments to use to populate this resource\'s properties.\n :param pulumi.ResourceOptions opts: Options for the resource.\n '
...<|docstring|>Manages an AzureNetwork DDoS Protection Plan.
> **NOTE** Azure only allows `one` DDoS Protection Plan per region.
## Example Usage
```python
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_ddos_protection_plan = azure.network.DdosProtectionPlan("exampleDdosProtectionPlan",
location=example_resource_group.location,
resource_group_name=example_resource_group.name)
```
## Import
Azure DDoS Protection Plan can be imported using the `resource id`, e.g.
```sh
$ pulumi import azure:network/ddosProtectionPlan:DdosProtectionPlan example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/ddosProtectionPlans/testddospplan
```
:param str resource_name: The name of the resource.
:param DdosProtectionPlanArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.<|endoftext|>
|
bb38593457340d0a1be4ca352f0d39998daff25d3a051848989f4f5839f2e345
|
@staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, resource_group_name: Optional[pulumi.Input[str]]=None, tags: Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]=None, virtual_network_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]=None) -> 'DdosProtectionPlan':
"\n Get an existing DdosProtectionPlan resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique name of the resulting resource.\n :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.\n :param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_network_ids: A list of Virtual Network ID's associated with the DDoS Protection Plan.\n "
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _DdosProtectionPlanState.__new__(_DdosProtectionPlanState)
__props__.__dict__['location'] = location
__props__.__dict__['name'] = name
__props__.__dict__['resource_group_name'] = resource_group_name
__props__.__dict__['tags'] = tags
__props__.__dict__['virtual_network_ids'] = virtual_network_ids
return DdosProtectionPlan(resource_name, opts=opts, __props__=__props__)
|
Get an existing DdosProtectionPlan resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
:param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.
:param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.
:param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_network_ids: A list of Virtual Network ID's associated with the DDoS Protection Plan.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
get
|
roderik/pulumi-azure
| 109 |
python
|
@staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, resource_group_name: Optional[pulumi.Input[str]]=None, tags: Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]=None, virtual_network_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]=None) -> 'DdosProtectionPlan':
"\n Get an existing DdosProtectionPlan resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique name of the resulting resource.\n :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.\n :param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_network_ids: A list of Virtual Network ID's associated with the DDoS Protection Plan.\n "
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _DdosProtectionPlanState.__new__(_DdosProtectionPlanState)
__props__.__dict__['location'] = location
__props__.__dict__['name'] = name
__props__.__dict__['resource_group_name'] = resource_group_name
__props__.__dict__['tags'] = tags
__props__.__dict__['virtual_network_ids'] = virtual_network_ids
return DdosProtectionPlan(resource_name, opts=opts, __props__=__props__)
|
@staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, resource_group_name: Optional[pulumi.Input[str]]=None, tags: Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]=None, virtual_network_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]=None) -> 'DdosProtectionPlan':
"\n Get an existing DdosProtectionPlan resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique name of the resulting resource.\n :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.\n :param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_network_ids: A list of Virtual Network ID's associated with the DDoS Protection Plan.\n "
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _DdosProtectionPlanState.__new__(_DdosProtectionPlanState)
__props__.__dict__['location'] = location
__props__.__dict__['name'] = name
__props__.__dict__['resource_group_name'] = resource_group_name
__props__.__dict__['tags'] = tags
__props__.__dict__['virtual_network_ids'] = virtual_network_ids
return DdosProtectionPlan(resource_name, opts=opts, __props__=__props__)<|docstring|>Get an existing DdosProtectionPlan resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
:param pulumi.Input[str] name: Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.
:param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the resource. Changing this forces a new resource to be created.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A mapping of tags to assign to the resource.
:param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_network_ids: A list of Virtual Network ID's associated with the DDoS Protection Plan.<|endoftext|>
|
514ba529b37d7f4ed9f120d65b90462549f6b3f5eb861273167c202adf235f61
|
@property
@pulumi.getter
def location(self) -> pulumi.Output[str]:
'\n Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.\n '
return pulumi.get(self, 'location')
|
Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
location
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter
def location(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'location')
|
@property
@pulumi.getter
def location(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'location')<|docstring|>Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.<|endoftext|>
|
20ca61afc1e0bdfe6a20b7b678b16bf81856c54d1e03ff3a5f83542246eab74c
|
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
'\n Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.\n '
return pulumi.get(self, 'name')
|
Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
name
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'name')
|
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'name')<|docstring|>Specifies the name of the Network DDoS Protection Plan. Changing this forces a new resource to be created.<|endoftext|>
|
c4ae00a83a1ef8019b283a5d0f0372b7d695c9f55820ec7f3808779adfe2f705
|
@property
@pulumi.getter(name='resourceGroupName')
def resource_group_name(self) -> pulumi.Output[str]:
'\n The name of the resource group in which to create the resource. Changing this forces a new resource to be created.\n '
return pulumi.get(self, 'resource_group_name')
|
The name of the resource group in which to create the resource. Changing this forces a new resource to be created.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
resource_group_name
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter(name='resourceGroupName')
def resource_group_name(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'resource_group_name')
|
@property
@pulumi.getter(name='resourceGroupName')
def resource_group_name(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'resource_group_name')<|docstring|>The name of the resource group in which to create the resource. Changing this forces a new resource to be created.<|endoftext|>
|
d710b2d80e877037bcb55e54af0bd4d337ed646462b9750c99caaedfa82fb62d
|
@property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[(str, str)]]]:
'\n A mapping of tags to assign to the resource.\n '
return pulumi.get(self, 'tags')
|
A mapping of tags to assign to the resource.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
tags
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[(str, str)]]]:
'\n \n '
return pulumi.get(self, 'tags')
|
@property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[(str, str)]]]:
'\n \n '
return pulumi.get(self, 'tags')<|docstring|>A mapping of tags to assign to the resource.<|endoftext|>
|
872b3e90507c87256dabce73773dca414fea6b84f18617ad712f6f5d297c8376
|
@property
@pulumi.getter(name='virtualNetworkIds')
def virtual_network_ids(self) -> pulumi.Output[Sequence[str]]:
"\n A list of Virtual Network ID's associated with the DDoS Protection Plan.\n "
return pulumi.get(self, 'virtual_network_ids')
|
A list of Virtual Network ID's associated with the DDoS Protection Plan.
|
sdk/python/pulumi_azure/network/ddos_protection_plan.py
|
virtual_network_ids
|
roderik/pulumi-azure
| 109 |
python
|
@property
@pulumi.getter(name='virtualNetworkIds')
def virtual_network_ids(self) -> pulumi.Output[Sequence[str]]:
"\n \n "
return pulumi.get(self, 'virtual_network_ids')
|
@property
@pulumi.getter(name='virtualNetworkIds')
def virtual_network_ids(self) -> pulumi.Output[Sequence[str]]:
"\n \n "
return pulumi.get(self, 'virtual_network_ids')<|docstring|>A list of Virtual Network ID's associated with the DDoS Protection Plan.<|endoftext|>
|
c554d0e72b0fba1a9b55dc2803adb9307a55848a006a683ce48219a0eac06c95
|
def reverse(x):
'Reverse a letter'
return x[::(- 1)]
|
Reverse a letter
|
NEW/one.py
|
reverse
|
Aneesh540/python-projects
| 5 |
python
|
def reverse(x):
return x[::(- 1)]
|
def reverse(x):
return x[::(- 1)]<|docstring|>Reverse a letter<|endoftext|>
|
4ec4bf5e3e265e556d7f64218b813109b983af3a343872412e6b468fd0820597
|
def key_len(x):
'Sorting a list by their length'
return sorted(x, key=len)
|
Sorting a list by their length
|
NEW/one.py
|
key_len
|
Aneesh540/python-projects
| 5 |
python
|
def key_len(x):
return sorted(x, key=len)
|
def key_len(x):
return sorted(x, key=len)<|docstring|>Sorting a list by their length<|endoftext|>
|
23c5eee46f8b4ae6c31760c5050fc0978a61a2208483c247418e265f3cde1453
|
def key_reverse(x):
'Sorting a list by reverse spelling here reverse() f(x) is defined by us\n and key should be a function without execution'
return sorted(x, key=reverse)
|
Sorting a list by reverse spelling here reverse() f(x) is defined by us
and key should be a function without execution
|
NEW/one.py
|
key_reverse
|
Aneesh540/python-projects
| 5 |
python
|
def key_reverse(x):
'Sorting a list by reverse spelling here reverse() f(x) is defined by us\n and key should be a function without execution'
return sorted(x, key=reverse)
|
def key_reverse(x):
'Sorting a list by reverse spelling here reverse() f(x) is defined by us\n and key should be a function without execution'
return sorted(x, key=reverse)<|docstring|>Sorting a list by reverse spelling here reverse() f(x) is defined by us
and key should be a function without execution<|endoftext|>
|
3c73c4ef4e30d275126e46f49471ae9366e31e5d6d1bdea75c329a49f7f70abb
|
def sprint_addr(addr):
' binary ip addr -> string '
if (not len(addr)):
return ''
return str(ipaddress.ip_address(addr))
|
binary ip addr -> string
|
openr/py/openr/utils/ipnetwork.py
|
sprint_addr
|
arshanh/openr
| 1 |
python
|
def sprint_addr(addr):
' '
if (not len(addr)):
return
return str(ipaddress.ip_address(addr))
|
def sprint_addr(addr):
' '
if (not len(addr)):
return
return str(ipaddress.ip_address(addr))<|docstring|>binary ip addr -> string<|endoftext|>
|
3f7a1c973faae2beab7e4473f371aba6cb0a6df7a2716b65e2e93eb4233b43f8
|
def sprint_prefix(prefix):
'\n :param prefix: network_types.IpPrefix representing an CIDR network\n\n :returns: string representation of prefix (CIDR network)\n :rtype: str or unicode\n '
return '{}/{}'.format(sprint_addr(prefix.prefixAddress.addr), prefix.prefixLength)
|
:param prefix: network_types.IpPrefix representing an CIDR network
:returns: string representation of prefix (CIDR network)
:rtype: str or unicode
|
openr/py/openr/utils/ipnetwork.py
|
sprint_prefix
|
arshanh/openr
| 1 |
python
|
def sprint_prefix(prefix):
'\n :param prefix: network_types.IpPrefix representing an CIDR network\n\n :returns: string representation of prefix (CIDR network)\n :rtype: str or unicode\n '
return '{}/{}'.format(sprint_addr(prefix.prefixAddress.addr), prefix.prefixLength)
|
def sprint_prefix(prefix):
'\n :param prefix: network_types.IpPrefix representing an CIDR network\n\n :returns: string representation of prefix (CIDR network)\n :rtype: str or unicode\n '
return '{}/{}'.format(sprint_addr(prefix.prefixAddress.addr), prefix.prefixLength)<|docstring|>:param prefix: network_types.IpPrefix representing an CIDR network
:returns: string representation of prefix (CIDR network)
:rtype: str or unicode<|endoftext|>
|
47e88b6a5648e0017bbfd2943874bf2e216e0dfe672abc4039e66c96bbb65434
|
def ip_str_to_addr(addr_str: str, if_index: str=None) -> network_types.BinaryAddress:
'\n :param addr_str: ip address in string representation\n\n :returns: thrift struct BinaryAddress\n :rtype: network_types.BinaryAddress\n '
try:
addr = socket.inet_pton(socket.AF_INET, addr_str)
binary_address = network_types.BinaryAddress(addr=addr)
if if_index:
binary_address.ifName = if_index
return binary_address
except socket.error:
pass
addr = socket.inet_pton(socket.AF_INET6, addr_str)
binary_address = network_types.BinaryAddress(addr=addr)
if if_index:
binary_address.ifName = if_index
return binary_address
|
:param addr_str: ip address in string representation
:returns: thrift struct BinaryAddress
:rtype: network_types.BinaryAddress
|
openr/py/openr/utils/ipnetwork.py
|
ip_str_to_addr
|
arshanh/openr
| 1 |
python
|
def ip_str_to_addr(addr_str: str, if_index: str=None) -> network_types.BinaryAddress:
'\n :param addr_str: ip address in string representation\n\n :returns: thrift struct BinaryAddress\n :rtype: network_types.BinaryAddress\n '
try:
addr = socket.inet_pton(socket.AF_INET, addr_str)
binary_address = network_types.BinaryAddress(addr=addr)
if if_index:
binary_address.ifName = if_index
return binary_address
except socket.error:
pass
addr = socket.inet_pton(socket.AF_INET6, addr_str)
binary_address = network_types.BinaryAddress(addr=addr)
if if_index:
binary_address.ifName = if_index
return binary_address
|
def ip_str_to_addr(addr_str: str, if_index: str=None) -> network_types.BinaryAddress:
'\n :param addr_str: ip address in string representation\n\n :returns: thrift struct BinaryAddress\n :rtype: network_types.BinaryAddress\n '
try:
addr = socket.inet_pton(socket.AF_INET, addr_str)
binary_address = network_types.BinaryAddress(addr=addr)
if if_index:
binary_address.ifName = if_index
return binary_address
except socket.error:
pass
addr = socket.inet_pton(socket.AF_INET6, addr_str)
binary_address = network_types.BinaryAddress(addr=addr)
if if_index:
binary_address.ifName = if_index
return binary_address<|docstring|>:param addr_str: ip address in string representation
:returns: thrift struct BinaryAddress
:rtype: network_types.BinaryAddress<|endoftext|>
|
090767cf9e26fb545a1a57a33d330dd7c078b5dec2746c388ba1615225075f16
|
def ip_str_to_prefix(prefix_str: str) -> network_types.IpPrefix:
'\n :param prefix_str: string representing a prefix (CIDR network)\n\n :returns: thrift struct IpPrefix\n :rtype: network_types.IpPrefix\n '
(ip_str, ip_len_str) = prefix_str.split('/')
return network_types.IpPrefix(prefixAddress=ip_str_to_addr(ip_str), prefixLength=int(ip_len_str))
|
:param prefix_str: string representing a prefix (CIDR network)
:returns: thrift struct IpPrefix
:rtype: network_types.IpPrefix
|
openr/py/openr/utils/ipnetwork.py
|
ip_str_to_prefix
|
arshanh/openr
| 1 |
python
|
def ip_str_to_prefix(prefix_str: str) -> network_types.IpPrefix:
'\n :param prefix_str: string representing a prefix (CIDR network)\n\n :returns: thrift struct IpPrefix\n :rtype: network_types.IpPrefix\n '
(ip_str, ip_len_str) = prefix_str.split('/')
return network_types.IpPrefix(prefixAddress=ip_str_to_addr(ip_str), prefixLength=int(ip_len_str))
|
def ip_str_to_prefix(prefix_str: str) -> network_types.IpPrefix:
'\n :param prefix_str: string representing a prefix (CIDR network)\n\n :returns: thrift struct IpPrefix\n :rtype: network_types.IpPrefix\n '
(ip_str, ip_len_str) = prefix_str.split('/')
return network_types.IpPrefix(prefixAddress=ip_str_to_addr(ip_str), prefixLength=int(ip_len_str))<|docstring|>:param prefix_str: string representing a prefix (CIDR network)
:returns: thrift struct IpPrefix
:rtype: network_types.IpPrefix<|endoftext|>
|
aada42d8939e449604384e00ffa1547398a7fce826d367717cef62788b603ecf
|
def ip_nexthop_to_nexthop_thrift(ip_addr: str, if_index: str, weight: int=0, metric: int=0) -> network_types.NextHopThrift:
'\n :param ip_addr: Next hop IP address\n :param if_index: Next hop interface index\n :param weight: Next hop weigth\n :param metric: Cost associated with next hop\n '
binary_address = ip_str_to_addr(ip_addr, if_index)
return network_types.NextHopThrift(address=binary_address, weight=weight, metric=metric)
|
:param ip_addr: Next hop IP address
:param if_index: Next hop interface index
:param weight: Next hop weigth
:param metric: Cost associated with next hop
|
openr/py/openr/utils/ipnetwork.py
|
ip_nexthop_to_nexthop_thrift
|
arshanh/openr
| 1 |
python
|
def ip_nexthop_to_nexthop_thrift(ip_addr: str, if_index: str, weight: int=0, metric: int=0) -> network_types.NextHopThrift:
'\n :param ip_addr: Next hop IP address\n :param if_index: Next hop interface index\n :param weight: Next hop weigth\n :param metric: Cost associated with next hop\n '
binary_address = ip_str_to_addr(ip_addr, if_index)
return network_types.NextHopThrift(address=binary_address, weight=weight, metric=metric)
|
def ip_nexthop_to_nexthop_thrift(ip_addr: str, if_index: str, weight: int=0, metric: int=0) -> network_types.NextHopThrift:
'\n :param ip_addr: Next hop IP address\n :param if_index: Next hop interface index\n :param weight: Next hop weigth\n :param metric: Cost associated with next hop\n '
binary_address = ip_str_to_addr(ip_addr, if_index)
return network_types.NextHopThrift(address=binary_address, weight=weight, metric=metric)<|docstring|>:param ip_addr: Next hop IP address
:param if_index: Next hop interface index
:param weight: Next hop weigth
:param metric: Cost associated with next hop<|endoftext|>
|
cd01090a100b799f06b04bb351ad9d1cbaf1e307fd42ea28b18ba0c53994ead9
|
def ip_to_unicast_route(ip_prefix: str, nexthops: List[network_types.NextHopThrift]) -> network_types.UnicastRoute:
'\n :param ip_prefix: IP prefix\n :param nexthops: List of next hops\n '
return network_types.UnicastRoute(dest=ip_str_to_prefix(ip_prefix), nextHops=nexthops)
|
:param ip_prefix: IP prefix
:param nexthops: List of next hops
|
openr/py/openr/utils/ipnetwork.py
|
ip_to_unicast_route
|
arshanh/openr
| 1 |
python
|
def ip_to_unicast_route(ip_prefix: str, nexthops: List[network_types.NextHopThrift]) -> network_types.UnicastRoute:
'\n :param ip_prefix: IP prefix\n :param nexthops: List of next hops\n '
return network_types.UnicastRoute(dest=ip_str_to_prefix(ip_prefix), nextHops=nexthops)
|
def ip_to_unicast_route(ip_prefix: str, nexthops: List[network_types.NextHopThrift]) -> network_types.UnicastRoute:
'\n :param ip_prefix: IP prefix\n :param nexthops: List of next hops\n '
return network_types.UnicastRoute(dest=ip_str_to_prefix(ip_prefix), nextHops=nexthops)<|docstring|>:param ip_prefix: IP prefix
:param nexthops: List of next hops<|endoftext|>
|
e94ad3df0bfde76a1e1c86d6ef1a0ecbbd25d0dfb4eb091e62782619dec70ea8
|
def mpls_to_mpls_route(label: int, nexthops: List[network_types.NextHopThrift]) -> network_types.UnicastRoute:
'\n :param label: MPLS label\n :param nexthops: List of nexthops\n '
return network_types.MplsRoute(topLabel=label, nextHops=nexthops)
|
:param label: MPLS label
:param nexthops: List of nexthops
|
openr/py/openr/utils/ipnetwork.py
|
mpls_to_mpls_route
|
arshanh/openr
| 1 |
python
|
def mpls_to_mpls_route(label: int, nexthops: List[network_types.NextHopThrift]) -> network_types.UnicastRoute:
'\n :param label: MPLS label\n :param nexthops: List of nexthops\n '
return network_types.MplsRoute(topLabel=label, nextHops=nexthops)
|
def mpls_to_mpls_route(label: int, nexthops: List[network_types.NextHopThrift]) -> network_types.UnicastRoute:
'\n :param label: MPLS label\n :param nexthops: List of nexthops\n '
return network_types.MplsRoute(topLabel=label, nextHops=nexthops)<|docstring|>:param label: MPLS label
:param nexthops: List of nexthops<|endoftext|>
|
d5688c8ac46ca89975a945c413f3c675394b76e2e84855f70ff3c9740d46641e
|
def mpls_nexthop_to_nexthop_thrift(ip_addr: str, if_index: str, weight: int=0, metric: int=0, label: Optional[List[int]]=None, action: network_types.MplsActionCode=network_types.MplsActionCode.PHP) -> network_types.NextHopThrift:
'\n :param label: label(s) for PUSH, SWAP action\n :param action: label action PUSH, POP, SWAP\n :param ip_addr: Next hop IP address\n :param if_index: Next hop interface index\n :param weight: Next hop weigth\n :param metric: Cost associated with next hop\n '
binary_address = ip_str_to_addr(ip_addr, if_index)
nexthop = network_types.NextHopThrift(address=binary_address, weight=weight, metric=metric)
mpls_action = network_types.MplsAction(action=action)
if (action == network_types.MplsActionCode.SWAP):
mpls_action.swapLabel = label[0]
elif (action == network_types.MplsActionCode.PUSH):
mpls_action.pushLabels = label[:]
nexthop.mplsAction = mpls_action
return nexthop
|
:param label: label(s) for PUSH, SWAP action
:param action: label action PUSH, POP, SWAP
:param ip_addr: Next hop IP address
:param if_index: Next hop interface index
:param weight: Next hop weigth
:param metric: Cost associated with next hop
|
openr/py/openr/utils/ipnetwork.py
|
mpls_nexthop_to_nexthop_thrift
|
arshanh/openr
| 1 |
python
|
def mpls_nexthop_to_nexthop_thrift(ip_addr: str, if_index: str, weight: int=0, metric: int=0, label: Optional[List[int]]=None, action: network_types.MplsActionCode=network_types.MplsActionCode.PHP) -> network_types.NextHopThrift:
'\n :param label: label(s) for PUSH, SWAP action\n :param action: label action PUSH, POP, SWAP\n :param ip_addr: Next hop IP address\n :param if_index: Next hop interface index\n :param weight: Next hop weigth\n :param metric: Cost associated with next hop\n '
binary_address = ip_str_to_addr(ip_addr, if_index)
nexthop = network_types.NextHopThrift(address=binary_address, weight=weight, metric=metric)
mpls_action = network_types.MplsAction(action=action)
if (action == network_types.MplsActionCode.SWAP):
mpls_action.swapLabel = label[0]
elif (action == network_types.MplsActionCode.PUSH):
mpls_action.pushLabels = label[:]
nexthop.mplsAction = mpls_action
return nexthop
|
def mpls_nexthop_to_nexthop_thrift(ip_addr: str, if_index: str, weight: int=0, metric: int=0, label: Optional[List[int]]=None, action: network_types.MplsActionCode=network_types.MplsActionCode.PHP) -> network_types.NextHopThrift:
'\n :param label: label(s) for PUSH, SWAP action\n :param action: label action PUSH, POP, SWAP\n :param ip_addr: Next hop IP address\n :param if_index: Next hop interface index\n :param weight: Next hop weigth\n :param metric: Cost associated with next hop\n '
binary_address = ip_str_to_addr(ip_addr, if_index)
nexthop = network_types.NextHopThrift(address=binary_address, weight=weight, metric=metric)
mpls_action = network_types.MplsAction(action=action)
if (action == network_types.MplsActionCode.SWAP):
mpls_action.swapLabel = label[0]
elif (action == network_types.MplsActionCode.PUSH):
mpls_action.pushLabels = label[:]
nexthop.mplsAction = mpls_action
return nexthop<|docstring|>:param label: label(s) for PUSH, SWAP action
:param action: label action PUSH, POP, SWAP
:param ip_addr: Next hop IP address
:param if_index: Next hop interface index
:param weight: Next hop weigth
:param metric: Cost associated with next hop<|endoftext|>
|
c66154265cecec6feaee1e5587fe629372b8808f3a15f1e2ae10df68c87a0386
|
def routes_to_route_db(node: str, unicast_routes: Optional[List[network_types.UnicastRoute]]=None, mpls_routes: Optional[List[network_types.MplsRoute]]=None) -> fib_types.RouteDatabase:
'\n :param node: node name\n :param unicast_routes: list of unicast IP routes\n :param mpls_routes: list of MPLS routes\n '
unicast_routes = ([] if (unicast_routes is None) else unicast_routes)
mpls_routes = ([] if (mpls_routes is None) else mpls_routes)
return fib_types.RouteDatabase(thisNodeName=node, unicastRoutes=unicast_routes, mplsRoutes=mpls_routes)
|
:param node: node name
:param unicast_routes: list of unicast IP routes
:param mpls_routes: list of MPLS routes
|
openr/py/openr/utils/ipnetwork.py
|
routes_to_route_db
|
arshanh/openr
| 1 |
python
|
def routes_to_route_db(node: str, unicast_routes: Optional[List[network_types.UnicastRoute]]=None, mpls_routes: Optional[List[network_types.MplsRoute]]=None) -> fib_types.RouteDatabase:
'\n :param node: node name\n :param unicast_routes: list of unicast IP routes\n :param mpls_routes: list of MPLS routes\n '
unicast_routes = ([] if (unicast_routes is None) else unicast_routes)
mpls_routes = ([] if (mpls_routes is None) else mpls_routes)
return fib_types.RouteDatabase(thisNodeName=node, unicastRoutes=unicast_routes, mplsRoutes=mpls_routes)
|
def routes_to_route_db(node: str, unicast_routes: Optional[List[network_types.UnicastRoute]]=None, mpls_routes: Optional[List[network_types.MplsRoute]]=None) -> fib_types.RouteDatabase:
'\n :param node: node name\n :param unicast_routes: list of unicast IP routes\n :param mpls_routes: list of MPLS routes\n '
unicast_routes = ([] if (unicast_routes is None) else unicast_routes)
mpls_routes = ([] if (mpls_routes is None) else mpls_routes)
return fib_types.RouteDatabase(thisNodeName=node, unicastRoutes=unicast_routes, mplsRoutes=mpls_routes)<|docstring|>:param node: node name
:param unicast_routes: list of unicast IP routes
:param mpls_routes: list of MPLS routes<|endoftext|>
|
4bac570766012b8eb532b1d890df86b748e7d12e7324bcc07e95506b2702dd9d
|
def sprint_prefix_type(prefix_type):
'\n :param prefix: network_types.PrefixType\n '
return network_types.PrefixType._VALUES_TO_NAMES.get(prefix_type, None)
|
:param prefix: network_types.PrefixType
|
openr/py/openr/utils/ipnetwork.py
|
sprint_prefix_type
|
arshanh/openr
| 1 |
python
|
def sprint_prefix_type(prefix_type):
'\n \n '
return network_types.PrefixType._VALUES_TO_NAMES.get(prefix_type, None)
|
def sprint_prefix_type(prefix_type):
'\n \n '
return network_types.PrefixType._VALUES_TO_NAMES.get(prefix_type, None)<|docstring|>:param prefix: network_types.PrefixType<|endoftext|>
|
1e3db949585e00098a0e01c74cd5b59bcc96e00e2df7d8fc3100df53758715c8
|
def sprint_prefix_forwarding_type(forwarding_type):
'\n :param forwarding_type: lsdb_types.PrefixForwardingType\n '
return lsdb_types.PrefixForwardingType._VALUES_TO_NAMES.get(forwarding_type)
|
:param forwarding_type: lsdb_types.PrefixForwardingType
|
openr/py/openr/utils/ipnetwork.py
|
sprint_prefix_forwarding_type
|
arshanh/openr
| 1 |
python
|
def sprint_prefix_forwarding_type(forwarding_type):
'\n \n '
return lsdb_types.PrefixForwardingType._VALUES_TO_NAMES.get(forwarding_type)
|
def sprint_prefix_forwarding_type(forwarding_type):
'\n \n '
return lsdb_types.PrefixForwardingType._VALUES_TO_NAMES.get(forwarding_type)<|docstring|>:param forwarding_type: lsdb_types.PrefixForwardingType<|endoftext|>
|
0dc861cf47933d1f68c158abcbd79bdd225f9c8d0d748052a583b59bd8ef1782
|
def sprint_prefix_forwarding_algorithm(forwarding_algo: lsdb_types.PrefixForwardingAlgorithm) -> str:
'\n :param forwarding_algorithm: lsdb_types.PrefixForwardingAlgorithm\n '
return lsdb_types.PrefixForwardingAlgorithm._VALUES_TO_NAMES.get(forwarding_algo)
|
:param forwarding_algorithm: lsdb_types.PrefixForwardingAlgorithm
|
openr/py/openr/utils/ipnetwork.py
|
sprint_prefix_forwarding_algorithm
|
arshanh/openr
| 1 |
python
|
def sprint_prefix_forwarding_algorithm(forwarding_algo: lsdb_types.PrefixForwardingAlgorithm) -> str:
'\n \n '
return lsdb_types.PrefixForwardingAlgorithm._VALUES_TO_NAMES.get(forwarding_algo)
|
def sprint_prefix_forwarding_algorithm(forwarding_algo: lsdb_types.PrefixForwardingAlgorithm) -> str:
'\n \n '
return lsdb_types.PrefixForwardingAlgorithm._VALUES_TO_NAMES.get(forwarding_algo)<|docstring|>:param forwarding_algorithm: lsdb_types.PrefixForwardingAlgorithm<|endoftext|>
|
9de0baa031777d6cc09570cbac19678001e0a49d7bc1fdb50e816d83b43fe223
|
def sprint_prefix_is_ephemeral(prefix_entry: lsdb_types.PrefixEntry) -> str:
'\n :param prefix_entry: lsdb_types.PrefixEntry\n '
return (str(prefix_entry.ephemeral) if (prefix_entry.ephemeral is not None) else 'False')
|
:param prefix_entry: lsdb_types.PrefixEntry
|
openr/py/openr/utils/ipnetwork.py
|
sprint_prefix_is_ephemeral
|
arshanh/openr
| 1 |
python
|
def sprint_prefix_is_ephemeral(prefix_entry: lsdb_types.PrefixEntry) -> str:
'\n \n '
return (str(prefix_entry.ephemeral) if (prefix_entry.ephemeral is not None) else 'False')
|
def sprint_prefix_is_ephemeral(prefix_entry: lsdb_types.PrefixEntry) -> str:
'\n \n '
return (str(prefix_entry.ephemeral) if (prefix_entry.ephemeral is not None) else 'False')<|docstring|>:param prefix_entry: lsdb_types.PrefixEntry<|endoftext|>
|
4a62551528976ba95582bd2add5545fa46b23f77faab938930a5e7bc9a1817dd
|
def ip_version(addr):
' return ip addr version\n '
return ipaddress.ip_address(addr).version
|
return ip addr version
|
openr/py/openr/utils/ipnetwork.py
|
ip_version
|
arshanh/openr
| 1 |
python
|
def ip_version(addr):
' \n '
return ipaddress.ip_address(addr).version
|
def ip_version(addr):
' \n '
return ipaddress.ip_address(addr).version<|docstring|>return ip addr version<|endoftext|>
|
5cd03823d63fcb6e7850460623b88ad86e0f33cee6c8cd28f8944b3db4b1a8c7
|
def is_same_subnet(addr1, addr2, subnet):
'\n Check whether two given addresses belong to the same subnet\n '
if (ipaddress.ip_network((addr1, subnet), strict=False) == ipaddress.ip_network((addr2, subnet), strict=False)):
return True
return False
|
Check whether two given addresses belong to the same subnet
|
openr/py/openr/utils/ipnetwork.py
|
is_same_subnet
|
arshanh/openr
| 1 |
python
|
def is_same_subnet(addr1, addr2, subnet):
'\n \n '
if (ipaddress.ip_network((addr1, subnet), strict=False) == ipaddress.ip_network((addr2, subnet), strict=False)):
return True
return False
|
def is_same_subnet(addr1, addr2, subnet):
'\n \n '
if (ipaddress.ip_network((addr1, subnet), strict=False) == ipaddress.ip_network((addr2, subnet), strict=False)):
return True
return False<|docstring|>Check whether two given addresses belong to the same subnet<|endoftext|>
|
6dceb4eab4a7f335dc590ff672ac3713cdcbf80638973be56e65ba39c4ebcc96
|
def is_link_local(addr):
'\n Check whether given addr is link local or not\n '
return ipaddress.ip_network(addr).is_link_local
|
Check whether given addr is link local or not
|
openr/py/openr/utils/ipnetwork.py
|
is_link_local
|
arshanh/openr
| 1 |
python
|
def is_link_local(addr):
'\n \n '
return ipaddress.ip_network(addr).is_link_local
|
def is_link_local(addr):
'\n \n '
return ipaddress.ip_network(addr).is_link_local<|docstring|>Check whether given addr is link local or not<|endoftext|>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.