azure.servicemanagement.websitemanagementservice module

class azure.servicemanagement.websitemanagementservice.WebsiteManagementService(subscription_id=None, cert_file=None, host='management.core.windows.net', request_session=None, timeout=65)[source]

Bases: azure.servicemanagement.servicemanagementclient._ServiceManagementClient

Note that this class is a preliminary work on WebSite management. Since it lack a lot a features, final version can be slightly different from the current one.

Initializes the website management service.

subscription_id:
Subscription to manage.
cert_file:
Path to .pem certificate file (httplib), or location of the certificate in your Personal certificate store (winhttp) in the CURRENT_USERmyCertificateName format. If a request_session is specified, then this is unused.
host:
Live ServiceClient URL. Defaults to Azure public cloud.
request_session:
Session object to use for http requests. If this is specified, it replaces the default use of httplib or winhttp. Also, the cert_file parameter is unused when a session is passed in. The session object handles authentication, and as such can support multiple types of authentication: .pem certificate, oauth. For example, you can pass in a Session instance from the requests library. To use .pem certificate authentication with requests library, set the path to the .pem file on the session.cert attribute.
timeout:
Optional. Timeout for the http request, in seconds.
create_site(webspace_name, website_name, geo_region, host_names, plan='VirtualDedicatedPlan', compute_mode='Shared', server_farm=None, site_mode=None)[source]

Create a website.

webspace_name:
The name of the webspace.
website_name:
The name of the website.
geo_region:
The geographical region of the webspace that will be created.
host_names:
An array of fully qualified domain names for website. Only one hostname can be specified in the azurewebsites.net domain. The hostname should match the name of the website. Custom domains can only be specified for Shared or Standard websites.
plan:
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.
delete_site(webspace_name, website_name, delete_empty_server_farm=False, delete_metrics=False)[source]

Delete a website.

webspace_name:
The name of the webspace.
website_name:
The name of the website.
delete_empty_server_farm:
If the site being deleted is the last web site in a server farm, you can delete the server farm by setting this to True.
delete_metrics:
To also delete the metrics for the site that you are deleting, you can set this to True.
get_historical_usage_metrics(webspace_name, website_name, metrics=None, start_time=None, end_time=None, time_grain=None)[source]

Get historical usage metrics.

webspace_name:
The name of the webspace.
website_name:
The name of the website.
metrics:
Optional. List of metrics name. Otherwise, all metrics returned.
start_time:
Optional. An ISO8601 date. Otherwise, current hour is used.
end_time:
Optional. An ISO8601 date. Otherwise, current time is used.
time_grain:
Optional. A rollup name, as P1D. OTherwise, default rollup for the metrics is used.

More information and metrics name at: http://msdn.microsoft.com/en-us/library/azure/dn166964.aspx

get_metric_definitions(webspace_name, website_name)[source]

Get metric definitions of metrics available of this web site.

webspace_name:
The name of the webspace.
website_name:
The name of the website.
get_publish_profile(webspace_name, website_name)[source]

Get a site’s publish profile as an object

webspace_name:
The name of the webspace.
website_name:
The name of the website.
get_publish_profile_xml(webspace_name, website_name)[source]

Get a site’s publish profile as a string

webspace_name:
The name of the webspace.
website_name:
The name of the website.
get_site(webspace_name, website_name)[source]

List the web sites defined on this webspace.

webspace_name:
The name of the webspace.
website_name:
The name of the website.
get_webspace(webspace_name)[source]

Get details of a specific webspace.

webspace_name:
The name of the webspace.
list_sites(webspace_name)[source]

List the web sites defined on this webspace.

webspace_name:
The name of the webspace.
list_webspaces()[source]

List the webspaces defined on the account.

restart_site(webspace_name, website_name)[source]

Restart a web site.

webspace_name:
The name of the webspace.
website_name:
The name of the website.
update_site(webspace_name, website_name, state=None)[source]

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)