Class: Azure::CloudServiceManagement::CloudServiceManagementService
- Inherits:
-
BaseManagement::BaseManagementService
- Object
- BaseManagement::BaseManagementService
- Azure::CloudServiceManagement::CloudServiceManagementService
- Includes:
- Azure::Core::Utility
- Defined in:
- lib/azure/cloud_service_management/cloud_service_management_service.rb
Instance Attribute Summary
Attributes inherited from BaseManagement::BaseManagementService
Instance Method Summary collapse
-
#create_cloud_service(name, options = {}) ⇒ Object
Public: Creates a new cloud service in Microsoft Azure.
-
#delete_cloud_service(cloud_service_name) ⇒ Object
Public: Deletes the specified cloud service of given subscription id from Microsoft Azure.
-
#delete_cloud_service_deployment(cloud_service_name, slot = 'production') ⇒ Object
Public: Deletes the specified deployment.
-
#get_cloud_service(name) ⇒ Object
Public: Checks to see if the specified hosted service is available.
- #get_cloud_service_properties(name) ⇒ Object
-
#list_cloud_services ⇒ Object
Public: Gets a list of hosted services available under the current subscription.
- #upload_certificate(cloud_service_name, ssh) ⇒ Object
Methods inherited from BaseManagement::BaseManagementService
#create_affinity_group, #delete_affinity_group, #get_affinity_group, #initialize, #list_affinity_groups, #list_locations, #list_role_sizes, #update_affinity_group, #validate_configuration!
Constructor Details
This class inherits a constructor from Azure::BaseManagement::BaseManagementService
Instance Method Details
#create_cloud_service(name, options = {}) ⇒ Object
Public: Creates a new cloud service in Microsoft Azure.
Attributes
-
name
- String. The name of the cloud service. -
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:label
-String. The label for this cloud service. -
:description
- String. A description for the hosted service. (optional) -
:location
- String. The regional data center location where the
cloud service will be created. Required if affinity group not specified (optional)
-
+:affinity_group_name - String. Name of the affinity group with
which to assocate the cloud service. Required if location not specified (optional)
-
:extended_properties
- Hash. Key/Value pairs of extended
properties to add to the cloud service. The key is used as the property name and the value as its value. (optional)
See msdn.microsoft.com/en-us/library/azure/gg441304.aspx
Returns None
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/azure/cloud_service_management/cloud_service_management_service.rb', line 47 def create_cloud_service(name, = {}) Azure::Loggerx.error_with_exit 'Cloud service name is not valid ' unless name if get_cloud_service(name) Azure::Loggerx.warn "Cloud service #{name} already exists. Skipped..." else Azure::Loggerx.info "Creating cloud service #{name}." request_path = '/services/hostedservices' body = Serialization.cloud_services_to_xml(name, ) request = client.management_request(:post, request_path, body) request.call end end |
#delete_cloud_service(cloud_service_name) ⇒ Object
Public: Deletes the specified cloud service of given subscription id from Microsoft Azure.
Attributes
-
name
- String. Cloud service name.
Returns: None
97 98 99 100 101 102 |
# File 'lib/azure/cloud_service_management/cloud_service_management_service.rb', line 97 def delete_cloud_service(cloud_service_name) request_path= "/services/hostedservices/#{cloud_service_name}" request = client.management_request(:delete, request_path) Azure::Loggerx.info "Deleting cloud service #{cloud_service_name}. \n" request.call end |
#delete_cloud_service_deployment(cloud_service_name, slot = 'production') ⇒ Object
Public: Deletes the specified deployment.
Attributes
-
cloud_service_name
- String. Cloud service name. -
slot
- String. ‘production’ or ‘staging’. Optional parameters.Default if not specified is 'production'
See msdn.microsoft.com/en-us/library/azure/ee460815.aspx
Returns NONE
115 116 117 118 119 120 121 |
# File 'lib/azure/cloud_service_management/cloud_service_management_service.rb', line 115 def delete_cloud_service_deployment(cloud_service_name, slot='production') slot = 'production' unless slot request_path= "/services/hostedservices/#{cloud_service_name}/deploymentslots/#{slot}" request = client.management_request(:delete, request_path) Azure::Loggerx.info "Deleting deployment of cloud service \"#{cloud_service_name}\" ..." request.call end |
#get_cloud_service(name) ⇒ Object
Public: Checks to see if the specified hosted service is available
Attributes
-
name
- String. Cloud service name.
Returns: A boolean value indicating whether the cloud service exists. If true, the cloud service is available. If false, the cloud service does not exist.
79 80 81 |
# File 'lib/azure/cloud_service_management/cloud_service_management_service.rb', line 79 def get_cloud_service(name) list_cloud_services.select { |x| x.name.casecmp(name) == 0 }.first end |
#get_cloud_service_properties(name) ⇒ Object
83 84 85 86 87 88 |
# File 'lib/azure/cloud_service_management/cloud_service_management_service.rb', line 83 def get_cloud_service_properties(name) request_path = "/services/hostedservices/#{name}?embed-detail=true" request = client.management_request(:get, request_path) response = request.call Serialization.cloud_services_from_xml(response).first end |
#list_cloud_services ⇒ Object
Public: Gets a list of hosted services available under the current subscription.
Returns an array of Azure::CloudServiceManagement::CloudService objects
63 64 65 66 67 68 |
# File 'lib/azure/cloud_service_management/cloud_service_management_service.rb', line 63 def list_cloud_services request_path = '/services/hostedservices' request = client.management_request(:get, request_path) response = request.call Serialization.cloud_services_from_xml(response) end |
#upload_certificate(cloud_service_name, ssh) ⇒ Object
123 124 125 126 127 128 129 130 |
# File 'lib/azure/cloud_service_management/cloud_service_management_service.rb', line 123 def upload_certificate(cloud_service_name, ssh) data = export_der(ssh[:cert], ssh[:key]) request_path= "/services/hostedservices/#{cloud_service_name}/certificates" body = Serialization.add_certificate_to_xml(data) Azure::Loggerx.info "Uploading certificate to cloud service #{cloud_service_name}..." request = client.management_request(:post, request_path, body) request.call end |