Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def update_site(self, webspace_name, website_name, state=None):
'''
Update a web site.
webspace_name:
The name of the webspace.
website_name:
The name of the website.
state:
The wanted state ('Running' or 'Stopped' accepted)
'''
xml = _XmlSerializer.update_website_to_xml(state)
return self._perform_put(
self._get_sites_details_path(webspace_name, website_name),
xml, as_async=True)
'''
Regenerates the primary or secondary access key for the specified
storage account.
service_name:
Name of the storage service account.
key_type:
Specifies which key to regenerate. Valid values are:
Primary, Secondary
'''
_validate_not_none('service_name', service_name)
_validate_not_none('key_type', key_type)
return self._perform_post(
self._get_storage_service_path(
service_name) + '/keys?action=regenerate',
_XmlSerializer.regenerate_keys_to_xml(
key_type),
StorageService)
@staticmethod
def doc_from_data(document_element_name, data, extended_properties=None):
xml = _XmlSerializer.data_to_xml(data)
if extended_properties is not None:
xml += _XmlSerializer.extended_properties_dict_to_xml_fragment(
extended_properties)
return _XmlSerializer.doc_from_xml(document_element_name, xml)
This value must be 'VirtualDedicatedPlan'.
compute_mode:
This value should be 'Shared' for the Free or Paid Shared
offerings, or 'Dedicated' for the Standard offering. The default
value is 'Shared'. If you set it to 'Dedicated', you must specify
a value for the server_farm parameter.
server_farm:
The name of the Server Farm associated with this website. This is
a required value for Standard mode.
site_mode:
Can be None, 'Limited' or 'Basic'. This value is 'Limited' for the
Free offering, and 'Basic' for the Paid Shared offering. Standard
mode does not use the site_mode parameter; it uses the compute_mode
parameter.
'''
xml = _XmlSerializer.create_website_to_xml(webspace_name, website_name, geo_region, plan, host_names, compute_mode, server_farm, site_mode)
return self._perform_post(
self._get_sites_path(webspace_name),
xml,
Site)
version:
Specifies the publisher defined version of the image.
The allowed characters are digit and period.
Format: ..
Example: '1.0.0' or '1.1.0' The 3 version number to
follow standard of most of the RPs. See http://semver.org
'''
_validate_not_none('vm_image_name', vm_image_name)
_validate_not_none('regions', regions)
_validate_not_none('offer', offer)
_validate_not_none('sku', sku)
_validate_not_none('version', version)
return self._perform_put(
self._get_replication_path_using_vm_image_name(vm_image_name),
_XmlSerializer.replicate_image_to_xml(
regions,
offer,
sku,
version
),
async=True,
x_ms_version='2015-04-01'
)
@staticmethod
def windows_configuration_to_xml(configuration):
xml = _XmlSerializer.data_to_xml(
[('ConfigurationSetType', configuration.configuration_set_type),
('ComputerName', configuration.computer_name),
('AdminPassword', configuration.admin_password),
('ResetPasswordOnFirstLogon',
configuration.reset_password_on_first_logon,
_lower),
('EnableAutomaticUpdates',
configuration.enable_automatic_updates,
_lower),
('TimeZone', configuration.time_zone)])
if configuration.domain_join is not None:
xml += ''
xml += ''
xml += _XmlSerializer.data_to_xml(
[('Domain', configuration.domain_join.credentials.domain),
This value must be 'VirtualDedicatedPlan'.
compute_mode:
This value should be 'Shared' for the Free or Paid Shared
offerings, or 'Dedicated' for the Standard offering. The default
value is 'Shared'. If you set it to 'Dedicated', you must specify
a value for the server_farm parameter.
server_farm:
The name of the Server Farm associated with this website. This is
a required value for Standard mode.
site_mode:
Can be None, 'Limited' or 'Basic'. This value is 'Limited' for the
Free offering, and 'Basic' for the Paid Shared offering. Standard
mode does not use the site_mode parameter; it uses the compute_mode
parameter.
'''
xml = _XmlSerializer.create_website_to_xml(webspace_name, website_name, geo_region, plan, host_names, compute_mode, server_farm, site_mode)
return self._perform_post(
self._get_sites_path(webspace_name),
xml,
Site)
def update_site(self, webspace_name, website_name, state=None):
'''
Update a web site.
webspace_name:
The name of the webspace.
website_name:
The name of the website.
state:
The wanted state ('Running' or 'Stopped' accepted)
'''
xml = _XmlSerializer.update_website_to_xml(state)
return self._perform_put(
self._get_sites_details_path(webspace_name, website_name),
xml, as_async=True)
@staticmethod
def role_to_xml(availability_set_name, data_virtual_hard_disks,
network_configuration_set, os_virtual_hard_disk, role_name,
role_size, role_type, system_configuration_set,
resource_extension_references,
provision_guest_agent, vm_image_name, media_location):
xml = _XmlSerializer.data_to_xml([('RoleName', role_name),
('RoleType', role_type)])
if system_configuration_set or network_configuration_set:
xml += ''
if system_configuration_set is not None:
xml += ''
if isinstance(system_configuration_set, WindowsConfigurationSet):
xml += _XmlSerializer.windows_configuration_to_xml(
system_configuration_set)
elif isinstance(system_configuration_set, LinuxConfigurationSet):
xml += _XmlSerializer.linux_configuration_to_xml(
system_configuration_set)
xml += ''
if network_configuration_set is not None:
xml += ''
xml += _XmlSerializer.network_configuration_to_xml(
network_configuration_set)
xml += ''
xml += ''
if resource_extension_references:
xml += ''
if system_configuration_set or network_configuration_set:
xml += ''
if system_configuration_set is not None:
xml += ''
if isinstance(system_configuration_set, WindowsConfigurationSet):
xml += _XmlSerializer.windows_configuration_to_xml(
system_configuration_set)
elif isinstance(system_configuration_set, LinuxConfigurationSet):
xml += _XmlSerializer.linux_configuration_to_xml(
system_configuration_set)
xml += ''
if network_configuration_set is not None:
xml += ''
xml += _XmlSerializer.network_configuration_to_xml(
network_configuration_set)
xml += ''
xml += ''
if resource_extension_references:
xml += ''
for ext in resource_extension_references:
xml += ''
xml += _XmlSerializer.data_to_xml(
[('ReferenceName', ext.reference_name),
('Publisher', ext.publisher),
('Name', ext.name),
('Version', ext.version)])
if ext.resource_extension_parameter_values:
xml += ''