azure-fix 0.7.0.pre3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.env_sample +13 -0
- data/.gitignore +30 -0
- data/.travis.yml +13 -0
- data/ChangeLog.txt +56 -0
- data/Gemfile +16 -0
- data/LICENSE.txt +202 -0
- data/README.md +702 -0
- data/Rakefile +121 -0
- data/azure.gemspec +51 -0
- data/bin/pfxer +35 -0
- data/lib/azure.rb +147 -0
- data/lib/azure/base_management/affinity_group.rb +32 -0
- data/lib/azure/base_management/base_management_service.rb +220 -0
- data/lib/azure/base_management/location.rb +27 -0
- data/lib/azure/base_management/management_http_request.rb +172 -0
- data/lib/azure/base_management/serialization.rb +135 -0
- data/lib/azure/base_management/sql_management_http_request.rb +35 -0
- data/lib/azure/blob/auth/shared_access_signature.rb +147 -0
- data/lib/azure/blob/blob.rb +32 -0
- data/lib/azure/blob/blob_service.rb +1452 -0
- data/lib/azure/blob/block.rb +31 -0
- data/lib/azure/blob/container.rb +32 -0
- data/lib/azure/blob/serialization.rb +285 -0
- data/lib/azure/client.rb +31 -0
- data/lib/azure/client_services.rb +98 -0
- data/lib/azure/cloud_service_management/cloud_service.rb +38 -0
- data/lib/azure/cloud_service_management/cloud_service_management_service.rb +135 -0
- data/lib/azure/cloud_service_management/serialization.rb +118 -0
- data/lib/azure/configurable.rb +290 -0
- data/lib/azure/core/auth/authorizer.rb +36 -0
- data/lib/azure/core/auth/shared_key.rb +118 -0
- data/lib/azure/core/auth/shared_key_lite.rb +48 -0
- data/lib/azure/core/auth/signer.rb +51 -0
- data/lib/azure/core/error.rb +21 -0
- data/lib/azure/core/filtered_service.rb +45 -0
- data/lib/azure/core/http/debug_filter.rb +36 -0
- data/lib/azure/core/http/http_error.rb +86 -0
- data/lib/azure/core/http/http_filter.rb +53 -0
- data/lib/azure/core/http/http_request.rb +173 -0
- data/lib/azure/core/http/http_response.rb +96 -0
- data/lib/azure/core/http/retry_policy.rb +74 -0
- data/lib/azure/core/http/signer_filter.rb +33 -0
- data/lib/azure/core/service.rb +46 -0
- data/lib/azure/core/signed_service.rb +45 -0
- data/lib/azure/core/utility.rb +244 -0
- data/lib/azure/default.rb +126 -0
- data/lib/azure/http_client.rb +85 -0
- data/lib/azure/queue/message.rb +30 -0
- data/lib/azure/queue/queue.rb +28 -0
- data/lib/azure/queue/queue_service.rb +570 -0
- data/lib/azure/queue/serialization.rb +105 -0
- data/lib/azure/service/access_policy.rb +26 -0
- data/lib/azure/service/cors.rb +11 -0
- data/lib/azure/service/cors_rule.rb +15 -0
- data/lib/azure/service/enumeration_results.rb +21 -0
- data/lib/azure/service/logging.rb +32 -0
- data/lib/azure/service/metrics.rb +31 -0
- data/lib/azure/service/retention_policy.rb +25 -0
- data/lib/azure/service/serialization.rb +299 -0
- data/lib/azure/service/signed_identifier.rb +30 -0
- data/lib/azure/service/storage_service.rb +86 -0
- data/lib/azure/service/storage_service_properties.rb +37 -0
- data/lib/azure/service_bus/action.rb +21 -0
- data/lib/azure/service_bus/auth/shared_access_signer.rb +44 -0
- data/lib/azure/service_bus/auth/wrap_service.rb +90 -0
- data/lib/azure/service_bus/auth/wrap_signer.rb +77 -0
- data/lib/azure/service_bus/brokered_message.rb +124 -0
- data/lib/azure/service_bus/brokered_message_serializer.rb +159 -0
- data/lib/azure/service_bus/correlation_filter.rb +45 -0
- data/lib/azure/service_bus/empty_rule_action.rb +30 -0
- data/lib/azure/service_bus/false_filter.rb +38 -0
- data/lib/azure/service_bus/filter.rb +21 -0
- data/lib/azure/service_bus/interval.rb +104 -0
- data/lib/azure/service_bus/queue.rb +230 -0
- data/lib/azure/service_bus/relay.rb +88 -0
- data/lib/azure/service_bus/resource.rb +109 -0
- data/lib/azure/service_bus/rule.rb +98 -0
- data/lib/azure/service_bus/rule_aspect.rb +34 -0
- data/lib/azure/service_bus/serialization.rb +161 -0
- data/lib/azure/service_bus/service_bus_service.rb +899 -0
- data/lib/azure/service_bus/sql_filter.rb +50 -0
- data/lib/azure/service_bus/sql_rule_action.rb +50 -0
- data/lib/azure/service_bus/subscription.rb +184 -0
- data/lib/azure/service_bus/topic.rb +187 -0
- data/lib/azure/service_bus/true_filter.rb +38 -0
- data/lib/azure/sql_database_management/errors.rb +11 -0
- data/lib/azure/sql_database_management/firewall_rule.rb +30 -0
- data/lib/azure/sql_database_management/serialization.rb +99 -0
- data/lib/azure/sql_database_management/sql_database_management_service.rb +211 -0
- data/lib/azure/sql_database_management/sql_server.rb +32 -0
- data/lib/azure/storage_management/serialization.rb +204 -0
- data/lib/azure/storage_management/storage_account.rb +48 -0
- data/lib/azure/storage_management/storage_management_service.rb +207 -0
- data/lib/azure/table/auth/shared_key.rb +59 -0
- data/lib/azure/table/auth/shared_key_lite.rb +44 -0
- data/lib/azure/table/batch.rb +330 -0
- data/lib/azure/table/batch_response.rb +118 -0
- data/lib/azure/table/edmtype.rb +127 -0
- data/lib/azure/table/entity.rb +31 -0
- data/lib/azure/table/guid.rb +24 -0
- data/lib/azure/table/query.rb +112 -0
- data/lib/azure/table/serialization.rb +108 -0
- data/lib/azure/table/table_service.rb +563 -0
- data/lib/azure/version.rb +31 -0
- data/lib/azure/virtual_machine_image_management/serialization.rb +70 -0
- data/lib/azure/virtual_machine_image_management/virtual_machine_disk.rb +25 -0
- data/lib/azure/virtual_machine_image_management/virtual_machine_image.rb +25 -0
- data/lib/azure/virtual_machine_image_management/virtual_machine_image_management_service.rb +83 -0
- data/lib/azure/virtual_machine_management/serialization.rb +459 -0
- data/lib/azure/virtual_machine_management/virtual_machine.rb +44 -0
- data/lib/azure/virtual_machine_management/virtual_machine_management_service.rb +552 -0
- data/lib/azure/virtual_network_management/serialization.rb +193 -0
- data/lib/azure/virtual_network_management/virtual_network.rb +37 -0
- data/lib/azure/virtual_network_management/virtual_network_management_service.rb +108 -0
- data/test/fixtures/32px-fulls-black.jpg +0 -0
- data/test/fixtures/affinity_group.xml +33 -0
- data/test/fixtures/all_containers.xml +20 -0
- data/test/fixtures/all_tables.xml +22 -0
- data/test/fixtures/container_acl.xml +11 -0
- data/test/fixtures/create_sql_database_server.xml +2 -0
- data/test/fixtures/create_storage_desc_error.xml +5 -0
- data/test/fixtures/create_storage_extendedprop_error.xml +8 -0
- data/test/fixtures/create_storage_extendedpropname_error.xml +6 -0
- data/test/fixtures/create_storage_full_error.xml +6 -0
- data/test/fixtures/create_storage_label_error.xml +5 -0
- data/test/fixtures/create_storage_location_error.xml +5 -0
- data/test/fixtures/create_storage_name_error.xml +6 -0
- data/test/fixtures/create_table_response_entry.xml +15 -0
- data/test/fixtures/delete_storage_container_error.xml +5 -0
- data/test/fixtures/delete_storage_error.xml +5 -0
- data/test/fixtures/deployment_error.xml +5 -0
- data/test/fixtures/empty_xml_file +0 -0
- data/test/fixtures/get_storage_account_error.xml +5 -0
- data/test/fixtures/get_storage_account_properties.xml +34 -0
- data/test/fixtures/get_storage_account_properties_new.xml +32 -0
- data/test/fixtures/http_error.xml +5 -0
- data/test/fixtures/insert_entity_response_entry.xml +25 -0
- data/test/fixtures/list_affinity_groups.xml +22 -0
- data/test/fixtures/list_blobs.xml +121 -0
- data/test/fixtures/list_block_all_with_none_committed.xml +22 -0
- data/test/fixtures/list_blocks_all.xml +23 -0
- data/test/fixtures/list_blocks_committed.xml +13 -0
- data/test/fixtures/list_cloud_services.xml +39 -0
- data/test/fixtures/list_containers.xml +38 -0
- data/test/fixtures/list_firewall_management_endpoint.xml +27 -0
- data/test/fixtures/list_locations.xml +212 -0
- data/test/fixtures/list_os_images.xml +110 -0
- data/test/fixtures/list_page_ranges.xml +11 -0
- data/test/fixtures/list_sql_database.xml +24 -0
- data/test/fixtures/list_sql_server_firewall.xml +23 -0
- data/test/fixtures/list_storage_account_single.xml +25 -0
- data/test/fixtures/list_storage_accounts.xml +48 -0
- data/test/fixtures/list_virtual_networks.xml +92 -0
- data/test/fixtures/list_vm_images.xml +21 -0
- data/test/fixtures/logging.xml +11 -0
- data/test/fixtures/management_certificate.pfx +0 -0
- data/test/fixtures/messages.xml +12 -0
- data/test/fixtures/metrics.xml +10 -0
- data/test/fixtures/privatekey.key +28 -0
- data/test/fixtures/query_entities_empty_response.xml +7 -0
- data/test/fixtures/query_entities_response.xml +45 -0
- data/test/fixtures/queue_service_properties.xml +22 -0
- data/test/fixtures/queue_service_properties_original.xml +19 -0
- data/test/fixtures/queues.xml +16 -0
- data/test/fixtures/retention_policy.xml +5 -0
- data/test/fixtures/sb_default_create_queue_response.xml +23 -0
- data/test/fixtures/sb_default_create_relay_response.xml +15 -0
- data/test/fixtures/sb_default_create_topic_response.xml +18 -0
- data/test/fixtures/sb_get_access_token_response.txt +1 -0
- data/test/fixtures/sb_queues_runtime_peek_message_response_headers.txt +9 -0
- data/test/fixtures/storage_service_keys.xml +8 -0
- data/test/fixtures/storage_service_properties.xml +55 -0
- data/test/fixtures/update_storage_account.xml +16 -0
- data/test/fixtures/update_storage_error.xml +5 -0
- data/test/fixtures/updated_storage_accounts.xml +55 -0
- data/test/fixtures/virtual_machine.xml +116 -0
- data/test/fixtures/windows_virtual_machine.xml +106 -0
- data/test/integration/affinity_group/Affinity_test.rb +55 -0
- data/test/integration/affinity_group/Create_Affinity_test.rb +64 -0
- data/test/integration/affinity_group/Delete_Affinity_test.rb +56 -0
- data/test/integration/affinity_group/List_Affinity_test.rb +41 -0
- data/test/integration/affinity_group/Update_Affinity_test.rb +87 -0
- data/test/integration/blob/blob_gb18030_test.rb +199 -0
- data/test/integration/blob/blob_metadata_test.rb +75 -0
- data/test/integration/blob/blob_pages_test.rb +119 -0
- data/test/integration/blob/blob_properties_test.rb +77 -0
- data/test/integration/blob/block_blob_test.rb +254 -0
- data/test/integration/blob/container/container_acl_test.rb +69 -0
- data/test/integration/blob/container/container_metadata_test.rb +50 -0
- data/test/integration/blob/container/create_container_test.rb +60 -0
- data/test/integration/blob/container/delete_container_test.rb +39 -0
- data/test/integration/blob/container/get_container_properties_test.rb +48 -0
- data/test/integration/blob/container/list_containers_test.rb +79 -0
- data/test/integration/blob/container/root_container_test.rb +55 -0
- data/test/integration/blob/copy_blob_test.rb +113 -0
- data/test/integration/blob/create_blob_snapshot_test.rb +80 -0
- data/test/integration/blob/create_page_blob_test.rb +83 -0
- data/test/integration/blob/delete_blob_test.rb +159 -0
- data/test/integration/blob/get_blob_test.rb +65 -0
- data/test/integration/blob/informative_errors_test.rb +39 -0
- data/test/integration/blob/lease/acquire_lease_test.rb +36 -0
- data/test/integration/blob/lease/break_lease_test.rb +40 -0
- data/test/integration/blob/lease/release_lease_test.rb +40 -0
- data/test/integration/blob/lease/renew_lease_test.rb +42 -0
- data/test/integration/blob/list_blobs_test.rb +113 -0
- data/test/integration/cloud_service/Cloud_Create_test.rb +45 -0
- data/test/integration/cloud_service/Cloud_Delete_test.rb +45 -0
- data/test/integration/database/create_sql_server_firewall_test.rb +81 -0
- data/test/integration/database/create_sql_server_test.rb +53 -0
- data/test/integration/database/delete_sql_server_firewall_test.rb +64 -0
- data/test/integration/database/delete_sql_server_test.rb +45 -0
- data/test/integration/database/list_sql_server_firewall_test.rb +44 -0
- data/test/integration/database/list_sql_servers_test.rb +44 -0
- data/test/integration/database/reset_password_sql_server_test.rb +53 -0
- data/test/integration/location/Location_List_test.rb +39 -0
- data/test/integration/location/RoleSize_List_test.rb +35 -0
- data/test/integration/queue/clear_messages_test.rb +42 -0
- data/test/integration/queue/create_message_test.rb +75 -0
- data/test/integration/queue/create_queue_test.rb +50 -0
- data/test/integration/queue/delete_message_test.rb +67 -0
- data/test/integration/queue/delete_queue_test.rb +45 -0
- data/test/integration/queue/informative_errors_test.rb +42 -0
- data/test/integration/queue/list_messages_encoded_test.rb +79 -0
- data/test/integration/queue/list_messages_test.rb +79 -0
- data/test/integration/queue/list_queues_test.rb +43 -0
- data/test/integration/queue/peek_messages_test.rb +59 -0
- data/test/integration/queue/queue_gb18030_test.rb +131 -0
- data/test/integration/queue/queue_metadata_test.rb +40 -0
- data/test/integration/queue/update_message_test.rb +74 -0
- data/test/integration/service_bus/informative_errors_test.rb +37 -0
- data/test/integration/service_bus/queues_scenario_test.rb +200 -0
- data/test/integration/service_bus/queues_test.rb +266 -0
- data/test/integration/service_bus/relay_test.rb +132 -0
- data/test/integration/service_bus/rules_test.rb +145 -0
- data/test/integration/service_bus/sb_queue_gb18030_test.rb +182 -0
- data/test/integration/service_bus/scenario_test.rb +101 -0
- data/test/integration/service_bus/subscriptions_test.rb +211 -0
- data/test/integration/service_bus/topics_scenario_test.rb +406 -0
- data/test/integration/service_bus/topics_test.rb +129 -0
- data/test/integration/storage_management/storage_management_test.rb +185 -0
- data/test/integration/table/create_table_test.rb +36 -0
- data/test/integration/table/delete_entity_batch_test.rb +107 -0
- data/test/integration/table/delete_entity_test.rb +94 -0
- data/test/integration/table/delete_table_test.rb +40 -0
- data/test/integration/table/get_table_test.rb +37 -0
- data/test/integration/table/informative_errors_test.rb +39 -0
- data/test/integration/table/insert_entity_batch_test.rb +100 -0
- data/test/integration/table/insert_entity_test.rb +88 -0
- data/test/integration/table/insert_or_merge_entity_batch_test.rb +159 -0
- data/test/integration/table/insert_or_merge_entity_test.rb +143 -0
- data/test/integration/table/insert_or_replace_entity_batch_test.rb +152 -0
- data/test/integration/table/insert_or_replace_entity_test.rb +137 -0
- data/test/integration/table/merge_entity_batch_test.rb +128 -0
- data/test/integration/table/merge_entity_test.rb +113 -0
- data/test/integration/table/query_entities_test.rb +196 -0
- data/test/integration/table/query_tables_test.rb +43 -0
- data/test/integration/table/query_test.rb +251 -0
- data/test/integration/table/table_acl_test.rb +52 -0
- data/test/integration/table/table_gb18030_test.rb +355 -0
- data/test/integration/table/update_entity_batch_test.rb +149 -0
- data/test/integration/table/update_entity_test.rb +131 -0
- data/test/integration/test_helper.rb +40 -0
- data/test/integration/vm/VM_Create_test.rb +262 -0
- data/test/integration/vm/VM_Delete_test.rb +53 -0
- data/test/integration/vm/VM_Operations_test.rb +172 -0
- data/test/integration/vm_image/virtual_machine_disk_test.rb +37 -0
- data/test/integration/vm_image/virtual_machine_image_test.rb +37 -0
- data/test/integration/vnet/Virtual_Network_Create_test.rb +116 -0
- data/test/integration/vnet/Virtual_Network_list_test.rb +48 -0
- data/test/support/env.rb +19 -0
- data/test/support/fixtures.rb +36 -0
- data/test/support/name_generator.rb +168 -0
- data/test/support/stubs.rb +42 -0
- data/test/support/virtual_machine_name_generator.rb +102 -0
- data/test/support/virtual_network_helper.rb +73 -0
- data/test/test_helper.rb +47 -0
- data/test/unit/affinity_group/affinity_group_test.rb +189 -0
- data/test/unit/affinity_group/serialization_test.rb +87 -0
- data/test/unit/base_management/base_management_service_test.rb +19 -0
- data/test/unit/base_management/location_test.rb +56 -0
- data/test/unit/base_management/role_size_test.rb +50 -0
- data/test/unit/blob/auth/shared_access_signature_test.rb +71 -0
- data/test/unit/blob/blob_service_test.rb +1970 -0
- data/test/unit/cloud_service_management/cloud_service_management_service_test.rb +94 -0
- data/test/unit/cloud_service_management/serialization_test.rb +169 -0
- data/test/unit/config/azure_test.rb +112 -0
- data/test/unit/config/client_test.rb +37 -0
- data/test/unit/core/auth/shared_key_lite_test.rb +51 -0
- data/test/unit/core/auth/shared_key_test.rb +58 -0
- data/test/unit/core/auth/signer_test.rb +30 -0
- data/test/unit/core/http/http_error_test.rb +61 -0
- data/test/unit/core/http/http_request_test.rb +138 -0
- data/test/unit/core/http/http_response_test.rb +20 -0
- data/test/unit/core/http/retry_policy_test.rb +23 -0
- data/test/unit/core/utility_test.rb +122 -0
- data/test/unit/database/serialization_test.rb +94 -0
- data/test/unit/database/sql_database_server_service_test.rb +341 -0
- data/test/unit/http_client_test.rb +74 -0
- data/test/unit/service/serialization_test.rb +533 -0
- data/test/unit/service/storage_service_test.rb +297 -0
- data/test/unit/storage_management/serialization_test.rb +244 -0
- data/test/unit/storage_management/storage_management_service_test.rb +247 -0
- data/test/unit/table/edmtype_test.rb +108 -0
- data/test/unit/virtual_machine_image_management/serialization_test.rb +50 -0
- data/test/unit/virtual_machine_image_management/virtual_machine_image_management_service_test.rb +114 -0
- data/test/unit/virtual_machine_management/serialization_test.rb +316 -0
- data/test/unit/virtual_machine_management/virtual_machine_management_service_test.rb +480 -0
- data/test/unit/vnet/serialization_test.rb +187 -0
- data/test/unit/vnet/virtual_network_management_service_test.rb +131 -0
- metadata +579 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#-------------------------------------------------------------------------
|
|
2
|
+
# Copyright 2013 Microsoft Open Technologies, Inc.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#--------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
module Azure
|
|
17
|
+
module CloudServiceManagement
|
|
18
|
+
class CloudService
|
|
19
|
+
def initialize
|
|
20
|
+
yield self if block_given?
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
attr_accessor :url
|
|
24
|
+
attr_accessor :name
|
|
25
|
+
attr_accessor :label
|
|
26
|
+
attr_accessor :description
|
|
27
|
+
attr_accessor :location
|
|
28
|
+
attr_accessor :affinity_group
|
|
29
|
+
attr_accessor :status
|
|
30
|
+
attr_accessor :date_created
|
|
31
|
+
attr_accessor :date_modified
|
|
32
|
+
attr_accessor :extended_properties
|
|
33
|
+
attr_accessor :default_winrm_certificate_thumbprint
|
|
34
|
+
attr_accessor :virtual_machines
|
|
35
|
+
attr_accessor :deployment_name
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#-------------------------------------------------------------------------
|
|
2
|
+
# Copyright 2013 Microsoft Open Technologies, Inc.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#--------------------------------------------------------------------------
|
|
15
|
+
require 'azure/cloud_service_management/serialization'
|
|
16
|
+
|
|
17
|
+
module Azure
|
|
18
|
+
module CloudServiceManagement
|
|
19
|
+
class CloudServiceManagementService < BaseManagement::BaseManagementService
|
|
20
|
+
include Azure::Core::Utility
|
|
21
|
+
|
|
22
|
+
# Public: Creates a new cloud service in Microsoft Azure.
|
|
23
|
+
#
|
|
24
|
+
# ==== Attributes
|
|
25
|
+
#
|
|
26
|
+
# * +name+ - String. The name of the cloud service.
|
|
27
|
+
# * +options+ - Hash. Optional parameters.
|
|
28
|
+
#
|
|
29
|
+
# ==== Options
|
|
30
|
+
#
|
|
31
|
+
# Accepted key/value pairs in options parameter are:
|
|
32
|
+
# * +:label+ -String. The label for this cloud service.
|
|
33
|
+
# * +:description+ - String. A description for the hosted service. (optional)
|
|
34
|
+
# * +:location+ - String. The regional data center location where the
|
|
35
|
+
# cloud service will be created. Required if affinity group not
|
|
36
|
+
# specified (optional)
|
|
37
|
+
# * +:affinity_group_name - String. Name of the affinity group with
|
|
38
|
+
# which to assocate the cloud service. Required if location not
|
|
39
|
+
# specified (optional)
|
|
40
|
+
# * +:extended_properties+ - Hash. Key/Value pairs of extended
|
|
41
|
+
# properties to add to the cloud service. The key is used as the
|
|
42
|
+
# property name and the value as its value. (optional)
|
|
43
|
+
#
|
|
44
|
+
# See http://msdn.microsoft.com/en-us/library/azure/gg441304.aspx
|
|
45
|
+
#
|
|
46
|
+
# Returns None
|
|
47
|
+
def create_cloud_service(name, options = {})
|
|
48
|
+
Azure::Loggerx.error_with_exit 'Cloud service name is not valid ' unless name
|
|
49
|
+
if get_cloud_service(name)
|
|
50
|
+
Azure::Loggerx.warn "Cloud service #{name} already exists. Skipped..."
|
|
51
|
+
else
|
|
52
|
+
Azure::Loggerx.info "Creating cloud service #{name}."
|
|
53
|
+
request_path = '/services/hostedservices'
|
|
54
|
+
body = Serialization.cloud_services_to_xml(name, options)
|
|
55
|
+
request = client.management_request(:post, request_path, body)
|
|
56
|
+
request.call
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Public: Gets a list of hosted services available under the current subscription.
|
|
61
|
+
#
|
|
62
|
+
# Returns an array of Azure::CloudServiceManagement::CloudService objects
|
|
63
|
+
def list_cloud_services
|
|
64
|
+
request_path = '/services/hostedservices'
|
|
65
|
+
request = client.management_request(:get, request_path)
|
|
66
|
+
response = request.call
|
|
67
|
+
Serialization.cloud_services_from_xml(response)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Public: Checks to see if the specified hosted service is available
|
|
71
|
+
#
|
|
72
|
+
# ==== Attributes
|
|
73
|
+
#
|
|
74
|
+
# * +name+ - String. Cloud service name.
|
|
75
|
+
#
|
|
76
|
+
# Returns: A boolean value indicating whether the cloud service exists.
|
|
77
|
+
# If true, the cloud service is available. If false, the cloud service
|
|
78
|
+
# does not exist.
|
|
79
|
+
def get_cloud_service(name)
|
|
80
|
+
list_cloud_services.select { |x| x.name.casecmp(name) == 0 }.first
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def get_cloud_service_properties(name)
|
|
84
|
+
request_path = "/services/hostedservices/#{name}?embed-detail=true"
|
|
85
|
+
request = client.management_request(:get, request_path)
|
|
86
|
+
response = request.call
|
|
87
|
+
Serialization.cloud_services_from_xml(response).first
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Public: Deletes the specified cloud service of given subscription id from Microsoft Azure.
|
|
91
|
+
#
|
|
92
|
+
# ==== Attributes
|
|
93
|
+
#
|
|
94
|
+
# * +name+ - String. Cloud service name.
|
|
95
|
+
#
|
|
96
|
+
# Returns: None
|
|
97
|
+
def delete_cloud_service(cloud_service_name)
|
|
98
|
+
request_path= "/services/hostedservices/#{cloud_service_name}"
|
|
99
|
+
request = client.management_request(:delete, request_path)
|
|
100
|
+
Azure::Loggerx.info "Deleting cloud service #{cloud_service_name}. \n"
|
|
101
|
+
request.call
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Public: Deletes the specified deployment.
|
|
105
|
+
#
|
|
106
|
+
# ==== Attributes
|
|
107
|
+
#
|
|
108
|
+
# * +cloud_service_name+ - String. Cloud service name.
|
|
109
|
+
# * +slot+ - String. 'production' or 'staging'. Optional parameters.
|
|
110
|
+
# Default if not specified is 'production'
|
|
111
|
+
#
|
|
112
|
+
# See http://msdn.microsoft.com/en-us/library/azure/ee460815.aspx
|
|
113
|
+
#
|
|
114
|
+
# Returns NONE
|
|
115
|
+
def delete_cloud_service_deployment(cloud_service_name, slot='production')
|
|
116
|
+
slot = 'production' unless slot
|
|
117
|
+
request_path= "/services/hostedservices/#{cloud_service_name}/deploymentslots/#{slot}"
|
|
118
|
+
request = client.management_request(:delete, request_path)
|
|
119
|
+
Azure::Loggerx.info "Deleting deployment of cloud service \"#{cloud_service_name}\" ..."
|
|
120
|
+
request.call
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def upload_certificate(cloud_service_name, ssh)
|
|
124
|
+
data = export_der(ssh[:cert], ssh[:key])
|
|
125
|
+
request_path= "/services/hostedservices/#{cloud_service_name}/certificates"
|
|
126
|
+
body = Serialization.add_certificate_to_xml(data)
|
|
127
|
+
Azure::Loggerx.info "Uploading certificate to cloud service #{cloud_service_name}..."
|
|
128
|
+
request = client.management_request(:post, request_path, body)
|
|
129
|
+
request.call
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
Azure::CloudServiceManagementService = Azure::CloudServiceManagement::CloudServiceManagementService
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#-------------------------------------------------------------------------
|
|
2
|
+
# Copyright 2013 Microsoft Open Technologies, Inc.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#--------------------------------------------------------------------------
|
|
15
|
+
require 'base64'
|
|
16
|
+
require 'azure/cloud_service_management/cloud_service'
|
|
17
|
+
require 'azure/virtual_machine_management/serialization'
|
|
18
|
+
|
|
19
|
+
module Azure
|
|
20
|
+
module CloudServiceManagement
|
|
21
|
+
module Serialization
|
|
22
|
+
extend Azure::Core::Utility
|
|
23
|
+
def self.cloud_services_to_xml(name, options = {})
|
|
24
|
+
options[:label] = options[:label] || name
|
|
25
|
+
|
|
26
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
|
27
|
+
xml.CreateHostedService(
|
|
28
|
+
'xmlns' => 'http://schemas.microsoft.com/windowsazure'
|
|
29
|
+
) do
|
|
30
|
+
xml.ServiceName(name)
|
|
31
|
+
xml.Label(Base64.encode64(options[:label]))
|
|
32
|
+
xml.Description(options[:description]) unless\
|
|
33
|
+
options[:description].nil? || options[:description].empty?
|
|
34
|
+
|
|
35
|
+
unless options[:affinity_group_name].nil?
|
|
36
|
+
xml.AffinityGroup(options[:affinity_group_name])
|
|
37
|
+
else
|
|
38
|
+
xml.Location(options[:location])
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
xml.ExtendedProperties do
|
|
42
|
+
options[:extended_properties].each do |prop_name, prop_value|
|
|
43
|
+
xml.ExtendedProperty do
|
|
44
|
+
xml.Name(prop_name)
|
|
45
|
+
xml.Value(prop_value)
|
|
46
|
+
end unless (prop_name.nil? || prop_name.empty?)\
|
|
47
|
+
|| (prop_value.nil? || prop_value.empty?)
|
|
48
|
+
end
|
|
49
|
+
end unless options[:extended_properties].nil?\
|
|
50
|
+
|| options[:extended_properties].empty?
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
builder.doc.to_xml
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.cloud_services_from_xml(cloud_xml)
|
|
57
|
+
clouds = []
|
|
58
|
+
cloud_services_xml = cloud_xml.css('HostedServices HostedService')
|
|
59
|
+
cloud_services_xml = cloud_xml.css('HostedService') if \
|
|
60
|
+
cloud_services_xml.length == 0
|
|
61
|
+
cloud_services_xml.each do |cloud_service_xml|
|
|
62
|
+
cloud = CloudService.new
|
|
63
|
+
cloud.url = xml_content(cloud_service_xml, 'Url')
|
|
64
|
+
cloud.name = xml_content(cloud_service_xml, 'ServiceName')
|
|
65
|
+
|
|
66
|
+
props_xml = cloud_service_xml.css('HostedServiceProperties')
|
|
67
|
+
|
|
68
|
+
cloud.label = Base64.decode64(xml_content(props_xml, 'Label'))
|
|
69
|
+
cloud.description = xml_content(props_xml, 'Description')
|
|
70
|
+
location = xml_content(props_xml, 'Location')
|
|
71
|
+
cloud.location = location unless location.empty?
|
|
72
|
+
affinity_group = xml_content(props_xml, 'AffinityGroup')
|
|
73
|
+
cloud.affinity_group = affinity_group unless affinity_group
|
|
74
|
+
cloud.status = xml_content(props_xml, 'Status')
|
|
75
|
+
cloud.date_created = xml_content(props_xml, 'DateCreated')
|
|
76
|
+
cloud.date_modified = xml_content(props_xml, 'DateLastModified')
|
|
77
|
+
|
|
78
|
+
cloud.extended_properties = {}
|
|
79
|
+
props_xml.css('ExtendedProperties ExtendedProperty').map do |prop|
|
|
80
|
+
p_name = xml_content(prop, 'Name')
|
|
81
|
+
p_value = xml_content(prop, 'Value')
|
|
82
|
+
cloud.extended_properties[p_name] = p_value
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
cloud.default_winrm_certificate_thumbprint = xml_content(
|
|
86
|
+
cloud_service_xml, 'DefaultWinRMCertificateThumbprint'
|
|
87
|
+
)
|
|
88
|
+
deployment_xml = cloud_services_xml.css('Deployments Deployment')
|
|
89
|
+
cloud.deployment_name = xml_content(deployment_xml, 'Name')
|
|
90
|
+
vms_in_deployment = {}
|
|
91
|
+
|
|
92
|
+
cloud_service_xml.css('Deployments').each do |deployxml|
|
|
93
|
+
deployment_name = xml_content(deployxml, 'Deployment Name')
|
|
94
|
+
vms = Azure::VirtualMachineManagement::Serialization.virtual_machines_from_xml(
|
|
95
|
+
deployxml, cloud.name
|
|
96
|
+
)
|
|
97
|
+
vms_in_deployment[deployment_name.to_sym] = vms if vms
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
cloud.virtual_machines = vms_in_deployment
|
|
101
|
+
clouds << cloud
|
|
102
|
+
end
|
|
103
|
+
clouds.compact
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def self.add_certificate_to_xml(data)
|
|
107
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
|
108
|
+
xml.CertificateFile('xmlns' => 'http://schemas.microsoft.com/windowsazure') do
|
|
109
|
+
xml.Data data
|
|
110
|
+
xml.CertificateFormat 'pfx'
|
|
111
|
+
xml.Password nil
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
builder.doc.to_xml
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
#-------------------------------------------------------------------------
|
|
2
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#--------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
module Azure
|
|
17
|
+
# The Azure::Configurable module provides basic configuration for Azure activities.
|
|
18
|
+
module Configurable
|
|
19
|
+
|
|
20
|
+
# @!attribute [w] storage_access_key
|
|
21
|
+
# @return [String] Azure Storage access key.
|
|
22
|
+
# @!attribute storage_account_name
|
|
23
|
+
# @return [String] Azure Storage account name
|
|
24
|
+
# @!attribute sb_access_key
|
|
25
|
+
# @return [String] Azure Service Bus access key
|
|
26
|
+
# @!attribute sb_sas_key
|
|
27
|
+
# @return [String] Azure Service Bus Shared Access Signature key
|
|
28
|
+
# @!attribute sb_sas_key_name
|
|
29
|
+
# @return [String] Azure Service Bus Shared Access Signature key name
|
|
30
|
+
# @!attribute sb_namespace
|
|
31
|
+
# @return [String] Azure Service Bus namespace
|
|
32
|
+
# @!attribute sb_issuer
|
|
33
|
+
# @return [String] Azure Service Bus issuer
|
|
34
|
+
# @!attribute ca_file
|
|
35
|
+
# @return [String] Location of the Certificate Authority bundle to be used for HTTPS
|
|
36
|
+
# @!attribute management_certificate
|
|
37
|
+
# @return [String|File] Azure Service Management certificate (pfx or pem)
|
|
38
|
+
# @!attribute subscription_id
|
|
39
|
+
# @return [String] Azure Subscription ID
|
|
40
|
+
# @!attribute http_private_key
|
|
41
|
+
# @return [String] Private key used for HTTPS certificate based authentication (derived from the management cert)
|
|
42
|
+
# @!attribute http_certificate_key
|
|
43
|
+
# @return [String] Public key used for HTTPS certificate based authentication (derived from the management cert)
|
|
44
|
+
# @!attribute sql_database_management_endpoint
|
|
45
|
+
# @return [String] Azure SQL database management endpoint. default: https://management.core.windows.net:8443/
|
|
46
|
+
# @!attribute storage_blob_host
|
|
47
|
+
# @return [String] Set the host for the Blob service. Only set this if you want
|
|
48
|
+
# something custom (like, for example, to point this to a LocalStorage
|
|
49
|
+
# emulator). This should be the complete host, including http:// at the
|
|
50
|
+
# start. When using the emulator, make sure to include your account name at
|
|
51
|
+
# the end.
|
|
52
|
+
# @!attribute storage_table_host
|
|
53
|
+
# @return [String] Get the host for this service. If you set something using #storage_table_host=,
|
|
54
|
+
# then we use that. Else we default to Azure's default hosts, based
|
|
55
|
+
# on your account name.
|
|
56
|
+
# @!attribute storage_queue_host
|
|
57
|
+
# @return [String] Set the host for the Queue service. Only set this if you want
|
|
58
|
+
# something custom (like, for example, to point this to a LocalStorage
|
|
59
|
+
# emulator). This should be the complete host, including http:// at the
|
|
60
|
+
# start. When using the emulator, make sure to include your account name at
|
|
61
|
+
# the end.
|
|
62
|
+
# @!attribute management_endpoint
|
|
63
|
+
# @return [String] Azure Service Management Endpoint. default: https://management.core.windows.net
|
|
64
|
+
|
|
65
|
+
attr_accessor :storage_access_key,
|
|
66
|
+
:storage_account_name,
|
|
67
|
+
:sb_access_key,
|
|
68
|
+
:sb_namespace,
|
|
69
|
+
:sb_sas_key,
|
|
70
|
+
:sb_sas_key_name,
|
|
71
|
+
:sb_issuer,
|
|
72
|
+
:ca_file,
|
|
73
|
+
:subscription_id
|
|
74
|
+
|
|
75
|
+
attr_reader :http_private_key,
|
|
76
|
+
:http_certificate_key,
|
|
77
|
+
:acs_host,
|
|
78
|
+
:service_bus_host
|
|
79
|
+
|
|
80
|
+
attr_writer :storage_table_host,
|
|
81
|
+
:storage_blob_host,
|
|
82
|
+
:storage_queue_host,
|
|
83
|
+
:sql_database_management_endpoint,
|
|
84
|
+
:management_endpoint
|
|
85
|
+
|
|
86
|
+
class << self
|
|
87
|
+
|
|
88
|
+
# List of configurable keys for {Azure::Client}
|
|
89
|
+
# @return [Array] of option keys
|
|
90
|
+
def keys
|
|
91
|
+
@keys ||= [
|
|
92
|
+
:storage_access_key,
|
|
93
|
+
:storage_account_name,
|
|
94
|
+
:sb_access_key,
|
|
95
|
+
:sb_sas_key,
|
|
96
|
+
:sb_sas_key_name,
|
|
97
|
+
:ca_file,
|
|
98
|
+
:sb_namespace,
|
|
99
|
+
:management_certificate,
|
|
100
|
+
:subscription_id,
|
|
101
|
+
:sql_database_management_endpoint,
|
|
102
|
+
:sb_issuer,
|
|
103
|
+
:storage_table_host,
|
|
104
|
+
:storage_blob_host,
|
|
105
|
+
:storage_queue_host,
|
|
106
|
+
:management_endpoint
|
|
107
|
+
]
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Set configuration options using a block
|
|
112
|
+
def configure
|
|
113
|
+
yield self
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Reset configuration options to default values
|
|
117
|
+
def reset!(options = {})
|
|
118
|
+
Azure::Configurable.keys.each do |key|
|
|
119
|
+
value = if self == Azure
|
|
120
|
+
Azure::Default.options[key]
|
|
121
|
+
else
|
|
122
|
+
Azure.send(key)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if key == :management_certificate
|
|
126
|
+
@certificate_key = nil
|
|
127
|
+
@private_key = nil
|
|
128
|
+
send(:"#{key.to_s + '='}", value)
|
|
129
|
+
else
|
|
130
|
+
instance_variable_set(:"@#{key}", options.fetch(key, value))
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
self.send(:reset_agents!) if self.respond_to?(:reset_agents!)
|
|
134
|
+
self
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
alias setup reset!
|
|
138
|
+
|
|
139
|
+
def management_certificate
|
|
140
|
+
@management_certificate
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Set the management certificate via string or file (populates #http_private_key and #http_certificate_key)
|
|
144
|
+
# @param [String|File] the string or file representing the .pem or .pfx
|
|
145
|
+
def management_certificate=(cert_string_or_file)
|
|
146
|
+
self.send(:reset_agents!) if self.respond_to?(:reset_agents!)
|
|
147
|
+
if cert_string_or_file.nil?
|
|
148
|
+
@certificate_key = @private_key = @management_certificate = nil
|
|
149
|
+
else
|
|
150
|
+
|
|
151
|
+
# the pfx may have null chars which will raise an exception in File.file?
|
|
152
|
+
invalid_file_chars = cert_string_or_file.to_s =~ /\x00/
|
|
153
|
+
|
|
154
|
+
# validate only if input is file path
|
|
155
|
+
if !invalid_file_chars && File.file?(cert_string_or_file) && File.extname(cert_string_or_file).downcase =~ /(pem|pfx)$/
|
|
156
|
+
error_message = "Could not read from file '#{cert_string_or_file}'."
|
|
157
|
+
raise ArgumentError.new(error_message) unless test('r', cert_string_or_file)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# get the string representation of cert
|
|
161
|
+
cert_file = if !invalid_file_chars && File.file?(cert_string_or_file)
|
|
162
|
+
read_cert_from_file(cert_string_or_file)
|
|
163
|
+
else
|
|
164
|
+
cert_string_or_file
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
begin
|
|
168
|
+
if cert_file =~ /-----BEGIN CERTIFICATE-----/
|
|
169
|
+
# Parse pem content
|
|
170
|
+
@certificate_key = OpenSSL::X509::Certificate.new(cert_file)
|
|
171
|
+
@private_key = OpenSSL::PKey::RSA.new(cert_file)
|
|
172
|
+
else
|
|
173
|
+
# Parse pfx content
|
|
174
|
+
cert_content = OpenSSL::PKCS12.new(cert_file)
|
|
175
|
+
@certificate_key = OpenSSL::X509::Certificate.new(
|
|
176
|
+
cert_content.certificate.to_pem
|
|
177
|
+
)
|
|
178
|
+
@private_key = OpenSSL::PKey::RSA.new(cert_content.key.to_pem)
|
|
179
|
+
end
|
|
180
|
+
@management_certificate = cert_file
|
|
181
|
+
rescue OpenSSL::OpenSSLError => e
|
|
182
|
+
@certificate_key = nil
|
|
183
|
+
@private_key = nil
|
|
184
|
+
raise ArgumentError.new("Management certificate not valid. Error: #{e.message}")
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Private side of the management certificate
|
|
190
|
+
# @returns [OpenSSL::X509::Certificate]
|
|
191
|
+
def http_private_key
|
|
192
|
+
@private_key
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Public side of the management certificate
|
|
196
|
+
# @returns [OpenSSL::PKey::RSA]
|
|
197
|
+
def http_certificate_key
|
|
198
|
+
@certificate_key
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def management_endpoint
|
|
202
|
+
normalize_endpoint do
|
|
203
|
+
if URI(@management_endpoint).scheme.nil?
|
|
204
|
+
"https://#{@management_endpoint}"
|
|
205
|
+
else
|
|
206
|
+
@management_endpoint
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def sql_database_management_endpoint
|
|
212
|
+
normalize_endpoint do
|
|
213
|
+
if URI(@sql_database_management_endpoint).scheme.nil?
|
|
214
|
+
"https://#{@sql_database_management_endpoint}:8443"
|
|
215
|
+
else
|
|
216
|
+
@sql_database_management_endpoint
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Storage queue host
|
|
222
|
+
# @return [String]
|
|
223
|
+
def storage_queue_host
|
|
224
|
+
@storage_queue_host || default_host(:queue)
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Storage blob host
|
|
228
|
+
# @return [String]
|
|
229
|
+
def storage_blob_host
|
|
230
|
+
@storage_blob_host || default_host(:blob)
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# Storage table host
|
|
234
|
+
# @return [String]
|
|
235
|
+
def storage_table_host
|
|
236
|
+
@storage_table_host || default_host(:table)
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Get the host for the ACS service.
|
|
240
|
+
# @return [String]
|
|
241
|
+
def acs_host
|
|
242
|
+
if sb_namespace.empty?
|
|
243
|
+
nil
|
|
244
|
+
else
|
|
245
|
+
"https://#{sb_namespace}-sb.accesscontrol.windows.net"
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# Get the host for Service Bus based on the Service Bus Namespace.
|
|
250
|
+
# @return [String]
|
|
251
|
+
def service_bus_host
|
|
252
|
+
if sb_namespace.empty?
|
|
253
|
+
nil
|
|
254
|
+
else
|
|
255
|
+
"https://#{sb_namespace}.servicebus.windows.net"
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
def config
|
|
260
|
+
self
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
private
|
|
264
|
+
|
|
265
|
+
def default_host(service)
|
|
266
|
+
"https://#{storage_account_name}.#{service}.core.windows.net"
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
def read_cert_from_file(cert_file_path)
|
|
270
|
+
if File.extname(cert_file_path).downcase == '.pem'
|
|
271
|
+
File.read(cert_file_path)
|
|
272
|
+
else
|
|
273
|
+
File.binread(cert_file_path)
|
|
274
|
+
end
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
def normalize_endpoint
|
|
278
|
+
if block_given?
|
|
279
|
+
File.join(yield, '')
|
|
280
|
+
else
|
|
281
|
+
nil
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
def options
|
|
286
|
+
Hash[Azure::Configurable.keys.map { |key| [key, instance_variable_get(:"@#{key}")] }]
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
end
|
|
290
|
+
end
|