Skip to content

Commit b572004

Browse files
committed
Update gists to match new environment naming for sync endpoint
1 parent 1dd46a7 commit b572004

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

azure_dbs.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def format_db_server_for_tidal(server)
148148
db_server[:host_name] = server["name"] || server[:name]
149149
fqdn = properties.fetch("fullyQualifiedDomainName", nil)
150150
db_server[:fqdn] = fqdn if fqdn
151-
db_server[:environment] = extract_environment_tag(server["tags"]) if server["tags"]
151+
db_server[:environment] = { name: extract_environment_tag(server["tags"]) } if server["tags"]
152152
custom_fields.merge!(extract_azure_tags_as_custom_fields(server["tags"])) if server["tags"]
153153
db_server[:custom_fields] = custom_fields
154154
db_server
@@ -166,7 +166,7 @@ def format_elastic_pool_for_tidal(pool)
166166
elastic_pool[:host_name] = pool["name"] || pool[:name]
167167
fqdn = properties.fetch("fullyQualifiedDomainName", nil)
168168
elastic_pool[:fqdn] = fqdn if fqdn
169-
elastic_pool[:environment] = extract_environment_tag(pool["tags"]) if pool["tags"]
169+
elastic_pool[:environment] = { name: extract_environment_tag(pool["tags"]) } if pool["tags"]
170170
custom_fields.merge!(extract_azure_tags_as_custom_fields(pool["tags"])) if pool["tags"]
171171
elastic_pool[:custom_fields] = custom_fields
172172
elastic_pool
@@ -416,7 +416,7 @@ def self.pull_from_azure_server_and_db
416416
db_object[:description] = "Azure SQL Database"
417417
db_object[:server] = { host_name: db[:server_name] }
418418
db_object[:server_id] = db[:server_id]
419-
db_object[:environment] = environment if environment
419+
db_object[:environment] = { name: environment } if environment
420420
db_object[:custom_fields] = custom_fields
421421

422422
# STDERR.puts "## Transformed database: #{db_object.inspect}"

azure_vms.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,9 @@ def get_vms(subscription, resource_group)
266266
az_id: vm["id"],
267267
state: vm.dig("properties", "provisioningState"),
268268
custom_fields: custom_fields_from_tags,
269-
environment: environment
269+
environment: {
270+
name: environment
271+
}
270272
}
271273
end
272274
end
@@ -357,7 +359,9 @@ def pull_from_azure_vm
357359
az_vmSize: vm[:vm_size],
358360
state: vm[:state]
359361
}.merge(vm[:custom_fields]),
360-
environment: vm[:environment],
362+
environment: {
363+
name: vm[:environment],
364+
},
361365
ram_allocated_gb: size_details['memoryInMB'] ? (size_details['memoryInMB'] / 1024).to_i : nil,
362366
cpu_count: size_details['numberOfCores'] || "N/A",
363367
storage_allocated_gb: vm[:storage_allocated_gb] || "N/A",
@@ -414,7 +418,9 @@ def get_app_service_details(app_service)
414418
operating_system: app_service.dig("properties", "linuxFxVersion") ? "Linux" : "Windows",
415419
tags: app_service["tags"],
416420
fqdn: fqdn,
417-
environment: environment,
421+
environment: {
422+
name: environment
423+
},
418424
custom_fields: {
419425
siteId: app_service["id"],
420426
state: app_service.dig("properties", "state"),
@@ -533,4 +539,4 @@ def self.execute
533539
end
534540
execute
535541
end
536-
542+

0 commit comments

Comments
 (0)