fog-azure-rm 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +2 -1
- data/CHANGELOG.md +8 -0
- data/lib/fog/azurerm/async_response.rb +6 -1
- data/lib/fog/azurerm/docs/application_gateway.md +119 -116
- data/lib/fog/azurerm/docs/compute.md +219 -217
- data/lib/fog/azurerm/docs/dns.md +43 -45
- data/lib/fog/azurerm/docs/key_vault.md +31 -31
- data/lib/fog/azurerm/docs/network.md +403 -405
- data/lib/fog/azurerm/docs/resources.md +51 -51
- data/lib/fog/azurerm/docs/sql.md +51 -51
- data/lib/fog/azurerm/docs/storage.md +89 -88
- data/lib/fog/azurerm/docs/traffic_manager.md +55 -54
- data/lib/fog/azurerm/models/compute/server.rb +6 -0
- data/lib/fog/azurerm/models/compute/servers.rb +1 -1
- data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +4 -2
- data/lib/fog/azurerm/version.rb +1 -1
- data/rake-script.sh +7 -1
- data/rakefile +1 -1
- data/test/api_stub/models/compute/server.rb +16 -0
- data/test/models/compute/test_server.rb +7 -3
- metadata +3 -3
@@ -1,6 +1,6 @@
|
|
1
1
|
# Traffic Manager
|
2
2
|
|
3
|
-
This document explains how to get started using Azure Traffic Manager Service with Fog. With this gem you can create
|
3
|
+
This document explains how to get started using Azure Traffic Manager Service with Fog. With this gem you can create, update, list or delete Traffic Manager Profiles and End Points.
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
@@ -14,19 +14,19 @@ require 'fog/azurerm'
|
|
14
14
|
Next, create a connection to the Traffic Manager Service:
|
15
15
|
|
16
16
|
```ruby
|
17
|
-
|
18
|
-
tenant_id: '<
|
19
|
-
client_id: '<
|
20
|
-
client_secret: '<
|
21
|
-
subscription_id: '<
|
22
|
-
environment: '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>'
|
17
|
+
fog_traffic_manager_service = Fog::TrafficManager::AzureRM.new(
|
18
|
+
tenant_id: '<Tenant Id>', # Tenant Id of Azure Active Directory Application
|
19
|
+
client_id: '<Client Id>', # Client Id of Azure Active Directory Application
|
20
|
+
client_secret: '<Client Secret>', # Client Secret of Azure Active Directory Application
|
21
|
+
subscription_id: '<Subscription Id>', # Subscription Id of an Azure Account
|
22
|
+
environment: '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>' # Azure cloud environment. Default is AzureCloud.
|
23
23
|
)
|
24
24
|
```
|
25
25
|
|
26
26
|
## Check Traffic Manager Profile Existence
|
27
27
|
|
28
28
|
```ruby
|
29
|
-
|
29
|
+
fog_traffic_manager_service.traffic_manager_profiles.check_traffic_manager_profile_exists('<Resource Group Name>', '<Profile Name>')
|
30
30
|
```
|
31
31
|
|
32
32
|
## Create Traffic Manager Profile
|
@@ -34,17 +34,17 @@ azure_traffic_manager_service.traffic_manager_profiles.check_traffic_manager_pro
|
|
34
34
|
Create a new Traffic Manager Profile. The parameter 'traffic_routing_method' can be 'Performance', 'Weighted' or 'Priority'.
|
35
35
|
|
36
36
|
```ruby
|
37
|
-
|
37
|
+
profile = fog_traffic_manager_service.traffic_manager_profiles.create(
|
38
38
|
name: '<Profile Name>',
|
39
39
|
resource_group: '<Resource Group Name>',
|
40
|
-
traffic_routing_method: '
|
40
|
+
traffic_routing_method: '<Routing Method Name>',
|
41
41
|
relative_name: '<Profile Relative Name>',
|
42
|
-
ttl: '
|
43
|
-
protocol: '
|
44
|
-
port: '
|
45
|
-
path: '
|
46
|
-
tags: { key1:
|
47
|
-
|
42
|
+
ttl: '<TTL>',
|
43
|
+
protocol: '<Protocol Name>',
|
44
|
+
port: '<Port Number>',
|
45
|
+
path: '<Path>',
|
46
|
+
tags: { key1: 'value1', key2: 'value2', keyN: 'valueN' } # [Optional]
|
47
|
+
)
|
48
48
|
```
|
49
49
|
|
50
50
|
## List Traffic Manager Profiles
|
@@ -52,10 +52,10 @@ Create a new Traffic Manager Profile. The parameter 'traffic_routing_method' can
|
|
52
52
|
List Traffic Manager Profiles in a resource group
|
53
53
|
|
54
54
|
```ruby
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
profiles = fog_traffic_manager_service.traffic_manager_profiles(resource_group: '<Resource Group Name>')
|
56
|
+
profiles.each do |profile|
|
57
|
+
puts "#{profile.name}"
|
58
|
+
end
|
59
59
|
```
|
60
60
|
|
61
61
|
## Retrieve a single Traffic Manager Profile
|
@@ -63,10 +63,10 @@ List Traffic Manager Profiles in a resource group
|
|
63
63
|
Get a single record of Traffic Manager Profile
|
64
64
|
|
65
65
|
```ruby
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
profile = fog_traffic_manager_service
|
67
|
+
.traffic_manager_profiles
|
68
|
+
.get('<Resource Group Name>', '<Profile Name>')
|
69
|
+
puts "#{profile.name}"
|
70
70
|
```
|
71
71
|
|
72
72
|
## Update a Traffic Manager Profile
|
@@ -74,13 +74,13 @@ Get a single record of Traffic Manager Profile
|
|
74
74
|
Get a Traffic Manager Profile object from the get method and then update that Traffic Manager Profile. You can update the Traffic Manager Profile by passing the modifiable attributes in the form of a hash.
|
75
75
|
|
76
76
|
```ruby
|
77
|
-
|
78
|
-
traffic_routing_method: '
|
79
|
-
ttl: '
|
80
|
-
protocol: '
|
81
|
-
port: '
|
82
|
-
path: '
|
83
|
-
|
77
|
+
profile.update(
|
78
|
+
traffic_routing_method: '<Routing Method Name>',
|
79
|
+
ttl: '<TTL>',
|
80
|
+
protocol: '<Protocol Name>',
|
81
|
+
port: '<Port Number>',
|
82
|
+
path: '<Path>'
|
83
|
+
)
|
84
84
|
```
|
85
85
|
|
86
86
|
## Destroy a single Traffic Manager Profile
|
@@ -88,18 +88,18 @@ Get a Traffic Manager Profile object from the get method and then update that Tr
|
|
88
88
|
Get a Traffic Manager Profile object from the get method and then destroy that Traffic Manager Profile.
|
89
89
|
|
90
90
|
```ruby
|
91
|
-
|
91
|
+
profile.destroy
|
92
92
|
```
|
93
93
|
|
94
94
|
## Check Traffic Manager Endpoint Existence
|
95
95
|
|
96
96
|
```ruby
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
97
|
+
azure_network_service.traffic_manager_end_points.check_traffic_manager_endpoint_exists(
|
98
|
+
'<Resource Group Name>',
|
99
|
+
'<Profile Name>',
|
100
|
+
'<Endpoint Name>',
|
101
|
+
'<Type(<Endpoint Type>)>'
|
102
|
+
)
|
103
103
|
```
|
104
104
|
|
105
105
|
## Create Traffic Manager Endpoint
|
@@ -107,14 +107,14 @@ Get a Traffic Manager Profile object from the get method and then destroy that T
|
|
107
107
|
Traffic Manager Profile is pre-requisite of Traffic Manager Endpoint. Create a new Traffic Manager Endpoint. The parameter 'type' can be 'externalEndpoints, 'azureEndpoints' or 'nestedEndpoints'.
|
108
108
|
|
109
109
|
```ruby
|
110
|
-
|
110
|
+
endpoint = azure_network_service.traffic_manager_end_points.create(
|
111
111
|
name: '<Endpoint Name>',
|
112
112
|
traffic_manager_profile_name: '<Profile Name>',
|
113
113
|
resource_group: '<Resource Group Name>',
|
114
|
-
type: '
|
115
|
-
target: '
|
116
|
-
endpoint_location: '
|
117
|
-
|
114
|
+
type: '<Endpoint Type>',
|
115
|
+
target: '<Target URL>',
|
116
|
+
endpoint_location: '<Location>'
|
117
|
+
)
|
118
118
|
```
|
119
119
|
|
120
120
|
## List Traffic Manager Endpoints
|
@@ -122,10 +122,10 @@ Traffic Manager Profile is pre-requisite of Traffic Manager Endpoint. Create a n
|
|
122
122
|
List Traffic Manager Endpoints in a resource group.
|
123
123
|
|
124
124
|
```ruby
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
125
|
+
endpoints = fog_traffic_manager_service.traffic_manager_end_points(resource_group: '<Resource Group Name>', traffic_manager_profile_name: '<Profile Name>')
|
126
|
+
endpoints.each do |endpoint|
|
127
|
+
puts "#{endpoint.name}"
|
128
|
+
end
|
129
129
|
```
|
130
130
|
|
131
131
|
## Retrieve a single Traffic Manager Endpoint
|
@@ -133,19 +133,20 @@ List Traffic Manager Endpoints in a resource group.
|
|
133
133
|
Get a single Traffic Manager Endpoint.
|
134
134
|
|
135
135
|
```ruby
|
136
|
-
|
136
|
+
endpoint = fog_traffic_manager_service
|
137
137
|
.traffic_manager_end_points
|
138
|
-
.get('<Resource Group
|
139
|
-
|
138
|
+
.get('<Resource Group Name>', '<Profile Name>', '<Endpoint name>', '<Endpoint Type>')
|
139
|
+
puts "#{endpoint.name}"
|
140
140
|
```
|
141
141
|
## Update a Traffic Manager Endpoint
|
142
142
|
|
143
143
|
Get a Traffic Manager Endpoint object from the get method and then update that Traffic Manager Endpoint. You can update the Traffic Manager Endpoint by passing the modifiable attributes in the form of a hash.
|
144
144
|
|
145
145
|
```ruby
|
146
|
-
|
147
|
-
|
148
|
-
|
146
|
+
endpoint.update(type: '<Endpoint Type>',
|
147
|
+
target: '<Target URL>',
|
148
|
+
endpoint_location: '<Location>'
|
149
|
+
)
|
149
150
|
```
|
150
151
|
|
151
152
|
## Destroy a single Traffic Manager Endpoint
|
@@ -153,7 +154,7 @@ Get a Traffic Manager Endpoint object from the get method and then update that T
|
|
153
154
|
Get a Traffic Manager Endpoint object from the get method and then destroy that Traffic Manager Endpoint.
|
154
155
|
|
155
156
|
```ruby
|
156
|
-
|
157
|
+
endpoint.destroy
|
157
158
|
```
|
158
159
|
|
159
160
|
## Support and Feedback
|
@@ -108,6 +108,7 @@ module Fog
|
|
108
108
|
service.create_virtual_machine(virtual_machine_params(ssh_key_path), true)
|
109
109
|
else
|
110
110
|
vm = service.create_virtual_machine(virtual_machine_params(ssh_key_path))
|
111
|
+
vm = service.get_virtual_machine(resource_group, name, false)
|
111
112
|
merge_attributes(Fog::Compute::AzureRM::Server.parse(vm))
|
112
113
|
end
|
113
114
|
end
|
@@ -183,6 +184,11 @@ module Fog
|
|
183
184
|
end
|
184
185
|
end
|
185
186
|
|
187
|
+
def update_attributes
|
188
|
+
vm = service.get_virtual_machine(resource_group, name, false)
|
189
|
+
merge_attributes(Fog::Compute::AzureRM::Server.parse(vm))
|
190
|
+
end
|
191
|
+
|
186
192
|
private
|
187
193
|
|
188
194
|
def platform_is_linux?(platform)
|
@@ -19,7 +19,7 @@ module Fog
|
|
19
19
|
def create_async(attributes = {})
|
20
20
|
server = new(attributes)
|
21
21
|
promise = server.save(true)
|
22
|
-
Fog::AzureRM::AsyncResponse.new(server, promise, true)
|
22
|
+
Fog::AzureRM::AsyncResponse.new(server, promise, true, 'update_attributes')
|
23
23
|
end
|
24
24
|
|
25
25
|
def get(resource_group_name, virtual_machine_name, async = false)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
INSTANCE_VIEW = 'instanceView'.freeze
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class AzureRM
|
@@ -8,9 +10,9 @@ module Fog
|
|
8
10
|
Fog::Logger.debug msg
|
9
11
|
begin
|
10
12
|
if async
|
11
|
-
response = @compute_mgmt_client.virtual_machines.get_async(resource_group, name)
|
13
|
+
response = @compute_mgmt_client.virtual_machines.get_async(resource_group, name, INSTANCE_VIEW)
|
12
14
|
else
|
13
|
-
response = @compute_mgmt_client.virtual_machines.get(resource_group, name)
|
15
|
+
response = @compute_mgmt_client.virtual_machines.get(resource_group, name, INSTANCE_VIEW)
|
14
16
|
end
|
15
17
|
rescue MsRestAzure::AzureOperationError => e
|
16
18
|
raise_azure_exception(e, msg)
|
data/lib/fog/azurerm/version.rb
CHANGED
data/rake-script.sh
CHANGED
data/rakefile
CHANGED
@@ -49,6 +49,10 @@ module ApiStub
|
|
49
49
|
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/networkInterfaces/fogtestnetworkinterface'
|
50
50
|
}
|
51
51
|
]
|
52
|
+
},
|
53
|
+
'instanceView' => {
|
54
|
+
'platformUpgradeDomain' => 5,
|
55
|
+
'platformFaultDomain' => 2
|
52
56
|
}
|
53
57
|
}
|
54
58
|
}
|
@@ -100,6 +104,10 @@ module ApiStub
|
|
100
104
|
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/networkInterfaces/fogtestnetworkinterface'
|
101
105
|
}
|
102
106
|
]
|
107
|
+
},
|
108
|
+
'instanceView' => {
|
109
|
+
'platformUpgradeDomain' => 5,
|
110
|
+
'platformFaultDomain' => 2
|
103
111
|
}
|
104
112
|
}
|
105
113
|
}
|
@@ -179,6 +187,10 @@ module ApiStub
|
|
179
187
|
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/networkInterfaces/fogtestnetworkinterface'
|
180
188
|
}
|
181
189
|
]
|
190
|
+
},
|
191
|
+
'instanceView' => {
|
192
|
+
'platformUpgradeDomain' => 5,
|
193
|
+
'platformFaultDomain' => 2
|
182
194
|
}
|
183
195
|
}
|
184
196
|
}
|
@@ -240,6 +252,10 @@ module ApiStub
|
|
240
252
|
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/networkInterfaces/fogtestnetworkinterface'
|
241
253
|
}
|
242
254
|
]
|
255
|
+
},
|
256
|
+
'instanceView' => {
|
257
|
+
'platformUpgradeDomain' => 5,
|
258
|
+
'platformFaultDomain' => 2
|
243
259
|
}
|
244
260
|
}
|
245
261
|
}
|
@@ -69,7 +69,9 @@ class TestServer < Minitest::Test
|
|
69
69
|
def test_save_method_response_for_linux_vm
|
70
70
|
response = ApiStub::Models::Compute::Server.create_linux_virtual_machine_response(@compute_client)
|
71
71
|
@service.stub :create_virtual_machine, response do
|
72
|
-
|
72
|
+
@service.stub :get_virtual_machine, response do
|
73
|
+
assert_instance_of Fog::Compute::AzureRM::Server, @server.save
|
74
|
+
end
|
73
75
|
end
|
74
76
|
|
75
77
|
# Async
|
@@ -82,8 +84,10 @@ class TestServer < Minitest::Test
|
|
82
84
|
def test_save_method_response_for_windows_vm
|
83
85
|
response = ApiStub::Models::Compute::Server.create_windows_virtual_machine_response(@compute_client)
|
84
86
|
@service.stub :create_virtual_machine, response do
|
85
|
-
|
86
|
-
|
87
|
+
@service.stub :get_virtual_machine, response do
|
88
|
+
assert_instance_of Fog::Compute::AzureRM::Server, @server.save
|
89
|
+
refute @server.save.disable_password_authentication
|
90
|
+
end
|
87
91
|
end
|
88
92
|
end
|
89
93
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-azure-rm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shaffan Chaudhry
|
@@ -18,7 +18,7 @@ authors:
|
|
18
18
|
autorequire:
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
|
-
date: 2017-
|
21
|
+
date: 2017-11-17 00:00:00.000000000 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
24
|
name: rake
|
@@ -1041,7 +1041,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1041
1041
|
version: '0'
|
1042
1042
|
requirements: []
|
1043
1043
|
rubyforge_project:
|
1044
|
-
rubygems_version: 2.
|
1044
|
+
rubygems_version: 2.7.2
|
1045
1045
|
signing_key:
|
1046
1046
|
specification_version: 4
|
1047
1047
|
summary: Module for the 'fog' gem to support Azure Resource Manager cloud services.
|