diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns.rb new file mode 100644 index 0000000000..81582ed108 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns.rb @@ -0,0 +1,51 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +require 'uri' +require 'cgi' +require 'date' +require 'json' +require 'base64' +require 'erb' +require 'securerandom' +require 'time' +require 'timeliness' +require 'faraday' +require 'faraday-cookie_jar' +require 'concurrent' +require 'ms_rest' +require '2018-09-01/generated/azure_mgmt_privatedns/module_definition' +require 'ms_rest_azure' + +module Azure::PrivateDns::Mgmt::V2018_09_01 + autoload :PrivateZones, '2018-09-01/generated/azure_mgmt_privatedns/private_zones.rb' + autoload :VirtualNetworkLinks, '2018-09-01/generated/azure_mgmt_privatedns/virtual_network_links.rb' + autoload :RecordSets, '2018-09-01/generated/azure_mgmt_privatedns/record_sets.rb' + autoload :PrivateDnsManagementClient, '2018-09-01/generated/azure_mgmt_privatedns/private_dns_management_client.rb' + + module Models + autoload :PtrRecord, '2018-09-01/generated/azure_mgmt_privatedns/models/ptr_record.rb' + autoload :SoaRecord, '2018-09-01/generated/azure_mgmt_privatedns/models/soa_record.rb' + autoload :PrivateZoneListResult, '2018-09-01/generated/azure_mgmt_privatedns/models/private_zone_list_result.rb' + autoload :SrvRecord, '2018-09-01/generated/azure_mgmt_privatedns/models/srv_record.rb' + autoload :SubResource, '2018-09-01/generated/azure_mgmt_privatedns/models/sub_resource.rb' + autoload :VirtualNetworkLinkListResult, '2018-09-01/generated/azure_mgmt_privatedns/models/virtual_network_link_list_result.rb' + autoload :AaaaRecord, '2018-09-01/generated/azure_mgmt_privatedns/models/aaaa_record.rb' + autoload :TxtRecord, '2018-09-01/generated/azure_mgmt_privatedns/models/txt_record.rb' + autoload :MxRecord, '2018-09-01/generated/azure_mgmt_privatedns/models/mx_record.rb' + autoload :ARecord, '2018-09-01/generated/azure_mgmt_privatedns/models/arecord.rb' + autoload :RecordSetListResult, '2018-09-01/generated/azure_mgmt_privatedns/models/record_set_list_result.rb' + autoload :CnameRecord, '2018-09-01/generated/azure_mgmt_privatedns/models/cname_record.rb' + autoload :Resource, '2018-09-01/generated/azure_mgmt_privatedns/models/resource.rb' + autoload :TrackedResource, '2018-09-01/generated/azure_mgmt_privatedns/models/tracked_resource.rb' + autoload :PrivateZone, '2018-09-01/generated/azure_mgmt_privatedns/models/private_zone.rb' + autoload :VirtualNetworkLink, '2018-09-01/generated/azure_mgmt_privatedns/models/virtual_network_link.rb' + autoload :ProxyResource, '2018-09-01/generated/azure_mgmt_privatedns/models/proxy_resource.rb' + autoload :RecordSet, '2018-09-01/generated/azure_mgmt_privatedns/models/record_set.rb' + autoload :ProvisioningState, '2018-09-01/generated/azure_mgmt_privatedns/models/provisioning_state.rb' + autoload :VirtualNetworkLinkState, '2018-09-01/generated/azure_mgmt_privatedns/models/virtual_network_link_state.rb' + autoload :RecordType, '2018-09-01/generated/azure_mgmt_privatedns/models/record_type.rb' + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/aaaa_record.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/aaaa_record.rb new file mode 100644 index 0000000000..a0c87a1d20 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/aaaa_record.rb @@ -0,0 +1,44 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # An AAAA record. + # + class AaaaRecord + + include MsRestAzure + + # @return [String] The IPv6 address of this AAAA record. + attr_accessor :ipv6address + + + # + # Mapper for AaaaRecord class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'AaaaRecord', + type: { + name: 'Composite', + class_name: 'AaaaRecord', + model_properties: { + ipv6address: { + required: false, + serialized_name: 'ipv6Address', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/arecord.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/arecord.rb new file mode 100644 index 0000000000..7a37ea69c2 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/arecord.rb @@ -0,0 +1,44 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # An A record. + # + class ARecord + + include MsRestAzure + + # @return [String] The IPv4 address of this A record. + attr_accessor :ipv4address + + + # + # Mapper for ARecord class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ARecord', + type: { + name: 'Composite', + class_name: 'ARecord', + model_properties: { + ipv4address: { + required: false, + serialized_name: 'ipv4Address', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/cname_record.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/cname_record.rb new file mode 100644 index 0000000000..a6100779da --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/cname_record.rb @@ -0,0 +1,44 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # A CNAME record. + # + class CnameRecord + + include MsRestAzure + + # @return [String] The canonical name for this CNAME record. + attr_accessor :cname + + + # + # Mapper for CnameRecord class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'CnameRecord', + type: { + name: 'Composite', + class_name: 'CnameRecord', + model_properties: { + cname: { + required: false, + serialized_name: 'cname', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/mx_record.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/mx_record.rb new file mode 100644 index 0000000000..cf3225db48 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/mx_record.rb @@ -0,0 +1,54 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # An MX record. + # + class MxRecord + + include MsRestAzure + + # @return [Integer] The preference value for this MX record. + attr_accessor :preference + + # @return [String] The domain name of the mail host for this MX record. + attr_accessor :exchange + + + # + # Mapper for MxRecord class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'MxRecord', + type: { + name: 'Composite', + class_name: 'MxRecord', + model_properties: { + preference: { + required: false, + serialized_name: 'preference', + type: { + name: 'Number' + } + }, + exchange: { + required: false, + serialized_name: 'exchange', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/private_zone.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/private_zone.rb new file mode 100644 index 0000000000..726cb2acde --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/private_zone.rb @@ -0,0 +1,181 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # Describes a Private DNS zone. + # + class PrivateZone < TrackedResource + + include MsRestAzure + + # @return [String] The ETag of the zone. + attr_accessor :etag + + # @return [Integer] The maximum number of record sets that can be created + # in this Private DNS zone. This is a read-only property and any attempt + # to set this value will be ignored. + attr_accessor :max_number_of_record_sets + + # @return [Integer] The current number of record sets in this Private DNS + # zone. This is a read-only property and any attempt to set this value + # will be ignored. + attr_accessor :number_of_record_sets + + # @return [Integer] The maximum number of virtual networks that can be + # linked to this Private DNS zone. This is a read-only property and any + # attempt to set this value will be ignored. + attr_accessor :max_number_of_virtual_network_links + + # @return [Integer] The current number of virtual networks that are + # linked to this Private DNS zone. This is a read-only property and any + # attempt to set this value will be ignored. + attr_accessor :number_of_virtual_network_links + + # @return [Integer] The maximum number of virtual networks that can be + # linked to this Private DNS zone with registration enabled. This is a + # read-only property and any attempt to set this value will be ignored. + attr_accessor :max_number_of_virtual_network_links_with_registration + + # @return [Integer] The current number of virtual networks that are + # linked to this Private DNS zone with registration enabled. This is a + # read-only property and any attempt to set this value will be ignored. + attr_accessor :number_of_virtual_network_links_with_registration + + # @return [ProvisioningState] The provisioning state of the resource. + # This is a read-only property and any attempt to set this value will be + # ignored. Possible values include: 'Creating', 'Updating', 'Deleting', + # 'Succeeded', 'Failed', 'Canceled' + attr_accessor :provisioning_state + + + # + # Mapper for PrivateZone class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'PrivateZone', + type: { + name: 'Composite', + class_name: 'PrivateZone', + model_properties: { + id: { + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + }, + tags: { + required: false, + serialized_name: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: false, + serialized_name: 'location', + type: { + name: 'String' + } + }, + etag: { + required: false, + serialized_name: 'etag', + type: { + name: 'String' + } + }, + max_number_of_record_sets: { + required: false, + read_only: true, + serialized_name: 'properties.maxNumberOfRecordSets', + type: { + name: 'Number' + } + }, + number_of_record_sets: { + required: false, + read_only: true, + serialized_name: 'properties.numberOfRecordSets', + type: { + name: 'Number' + } + }, + max_number_of_virtual_network_links: { + required: false, + read_only: true, + serialized_name: 'properties.maxNumberOfVirtualNetworkLinks', + type: { + name: 'Number' + } + }, + number_of_virtual_network_links: { + required: false, + read_only: true, + serialized_name: 'properties.numberOfVirtualNetworkLinks', + type: { + name: 'Number' + } + }, + max_number_of_virtual_network_links_with_registration: { + required: false, + read_only: true, + serialized_name: 'properties.maxNumberOfVirtualNetworkLinksWithRegistration', + type: { + name: 'Number' + } + }, + number_of_virtual_network_links_with_registration: { + required: false, + read_only: true, + serialized_name: 'properties.numberOfVirtualNetworkLinksWithRegistration', + type: { + name: 'Number' + } + }, + provisioning_state: { + required: false, + read_only: true, + serialized_name: 'properties.provisioningState', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/private_zone_list_result.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/private_zone_list_result.rb new file mode 100644 index 0000000000..2d096f8f2e --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/private_zone_list_result.rb @@ -0,0 +1,95 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # The response to a Private DNS zone list operation. + # + class PrivateZoneListResult + + include MsRestAzure + + include MsRest::JSONable + # @return [Array] Information about the Private DNS zones. + attr_accessor :value + + # @return [String] The continuation token for the next page of results. + attr_accessor :next_link + + # return [Proc] with next page method call. + attr_accessor :next_method + + # + # Gets the rest of the items for the request, enabling auto-pagination. + # + # @return [Array] operation results. + # + def get_all_items + items = @value + page = self + while page.next_link != nil do + page = page.get_next_page + items.concat(page.value) + end + items + end + + # + # Gets the next page of results. + # + # @return [PrivateZoneListResult] with next page content. + # + def get_next_page + response = @next_method.call(@next_link).value! unless @next_method.nil? + unless response.nil? + @next_link = response.body.next_link + @value = response.body.value + self + end + end + + # + # Mapper for PrivateZoneListResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'PrivateZoneListResult', + type: { + name: 'Composite', + class_name: 'PrivateZoneListResult', + model_properties: { + value: { + required: false, + serialized_name: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'PrivateZoneElementType', + type: { + name: 'Composite', + class_name: 'PrivateZone' + } + } + } + }, + next_link: { + required: false, + read_only: true, + serialized_name: 'nextLink', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/provisioning_state.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/provisioning_state.rb new file mode 100644 index 0000000000..12bf24e91f --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/provisioning_state.rb @@ -0,0 +1,20 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # Defines values for ProvisioningState + # + module ProvisioningState + Creating = "Creating" + Updating = "Updating" + Deleting = "Deleting" + Succeeded = "Succeeded" + Failed = "Failed" + Canceled = "Canceled" + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/proxy_resource.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/proxy_resource.rb new file mode 100644 index 0000000000..ca5b476415 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/proxy_resource.rb @@ -0,0 +1,58 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # The resource model definition for an ARM proxy resource. + # + class ProxyResource < Resource + + include MsRestAzure + + + # + # Mapper for ProxyResource class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ProxyResource', + type: { + name: 'Composite', + class_name: 'ProxyResource', + model_properties: { + id: { + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/ptr_record.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/ptr_record.rb new file mode 100644 index 0000000000..c51d9d8ffa --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/ptr_record.rb @@ -0,0 +1,44 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # A PTR record. + # + class PtrRecord + + include MsRestAzure + + # @return [String] The PTR target domain name for this PTR record. + attr_accessor :ptrdname + + + # + # Mapper for PtrRecord class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'PtrRecord', + type: { + name: 'Composite', + class_name: 'PtrRecord', + model_properties: { + ptrdname: { + required: false, + serialized_name: 'ptrdname', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/record_set.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/record_set.rb new file mode 100644 index 0000000000..070ba8ae4a --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/record_set.rb @@ -0,0 +1,251 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # Describes a DNS record set (a collection of DNS records with the same + # name and type) in a Private DNS zone. + # + class RecordSet < ProxyResource + + include MsRestAzure + + # @return [String] The ETag of the record set. + attr_accessor :etag + + # @return [Hash{String => String}] The metadata attached to the record + # set. + attr_accessor :metadata + + # @return [Integer] The TTL (time-to-live) of the records in the record + # set. + attr_accessor :ttl + + # @return [String] Fully qualified domain name of the record set. + attr_accessor :fqdn + + # @return [Boolean] Is the record set auto-registered in the Private DNS + # zone through a virtual network link? + attr_accessor :is_auto_registered + + # @return [Array] The list of A records in the record set. + attr_accessor :a_records + + # @return [Array] The list of AAAA records in the record set. + attr_accessor :aaaa_records + + # @return [CnameRecord] The CNAME record in the record set. + attr_accessor :cname_record + + # @return [Array] The list of MX records in the record set. + attr_accessor :mx_records + + # @return [Array] The list of PTR records in the record set. + attr_accessor :ptr_records + + # @return [SoaRecord] The SOA record in the record set. + attr_accessor :soa_record + + # @return [Array] The list of SRV records in the record set. + attr_accessor :srv_records + + # @return [Array] The list of TXT records in the record set. + attr_accessor :txt_records + + + # + # Mapper for RecordSet class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'RecordSet', + type: { + name: 'Composite', + class_name: 'RecordSet', + model_properties: { + id: { + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + }, + etag: { + required: false, + serialized_name: 'etag', + type: { + name: 'String' + } + }, + metadata: { + required: false, + serialized_name: 'properties.metadata', + type: { + name: 'Dictionary', + value: { + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + ttl: { + required: false, + serialized_name: 'properties.ttl', + type: { + name: 'Number' + } + }, + fqdn: { + required: false, + read_only: true, + serialized_name: 'properties.fqdn', + type: { + name: 'String' + } + }, + is_auto_registered: { + required: false, + read_only: true, + serialized_name: 'properties.isAutoRegistered', + type: { + name: 'Boolean' + } + }, + a_records: { + required: false, + serialized_name: 'properties.aRecords', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'ARecordElementType', + type: { + name: 'Composite', + class_name: 'ARecord' + } + } + } + }, + aaaa_records: { + required: false, + serialized_name: 'properties.aaaaRecords', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'AaaaRecordElementType', + type: { + name: 'Composite', + class_name: 'AaaaRecord' + } + } + } + }, + cname_record: { + required: false, + serialized_name: 'properties.cnameRecord', + type: { + name: 'Composite', + class_name: 'CnameRecord' + } + }, + mx_records: { + required: false, + serialized_name: 'properties.mxRecords', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'MxRecordElementType', + type: { + name: 'Composite', + class_name: 'MxRecord' + } + } + } + }, + ptr_records: { + required: false, + serialized_name: 'properties.ptrRecords', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'PtrRecordElementType', + type: { + name: 'Composite', + class_name: 'PtrRecord' + } + } + } + }, + soa_record: { + required: false, + serialized_name: 'properties.soaRecord', + type: { + name: 'Composite', + class_name: 'SoaRecord' + } + }, + srv_records: { + required: false, + serialized_name: 'properties.srvRecords', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'SrvRecordElementType', + type: { + name: 'Composite', + class_name: 'SrvRecord' + } + } + } + }, + txt_records: { + required: false, + serialized_name: 'properties.txtRecords', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'TxtRecordElementType', + type: { + name: 'Composite', + class_name: 'TxtRecord' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/record_set_list_result.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/record_set_list_result.rb new file mode 100644 index 0000000000..b91dfad29f --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/record_set_list_result.rb @@ -0,0 +1,96 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # The response to a record set list operation. + # + class RecordSetListResult + + include MsRestAzure + + include MsRest::JSONable + # @return [Array] Information about the record sets in the + # response. + attr_accessor :value + + # @return [String] The continuation token for the next page of results. + attr_accessor :next_link + + # return [Proc] with next page method call. + attr_accessor :next_method + + # + # Gets the rest of the items for the request, enabling auto-pagination. + # + # @return [Array] operation results. + # + def get_all_items + items = @value + page = self + while page.next_link != nil do + page = page.get_next_page + items.concat(page.value) + end + items + end + + # + # Gets the next page of results. + # + # @return [RecordSetListResult] with next page content. + # + def get_next_page + response = @next_method.call(@next_link).value! unless @next_method.nil? + unless response.nil? + @next_link = response.body.next_link + @value = response.body.value + self + end + end + + # + # Mapper for RecordSetListResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'RecordSetListResult', + type: { + name: 'Composite', + class_name: 'RecordSetListResult', + model_properties: { + value: { + required: false, + serialized_name: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'RecordSetElementType', + type: { + name: 'Composite', + class_name: 'RecordSet' + } + } + } + }, + next_link: { + required: false, + read_only: true, + serialized_name: 'nextLink', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/record_type.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/record_type.rb new file mode 100644 index 0000000000..35b78e2c8b --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/record_type.rb @@ -0,0 +1,22 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # Defines values for RecordType + # + module RecordType + A = "A" + AAAA = "AAAA" + CNAME = "CNAME" + MX = "MX" + PTR = "PTR" + SOA = "SOA" + SRV = "SRV" + TXT = "TXT" + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/resource.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/resource.rb new file mode 100644 index 0000000000..7832323270 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/resource.rb @@ -0,0 +1,70 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # The core properties of ARM resources + # + class Resource + + include MsRestAzure + + # @return [String] Fully qualified resource Id for the resource. Example + # - + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + attr_accessor :id + + # @return [String] The name of the resource + attr_accessor :name + + # @return [String] The type of the resource. Example - + # 'Microsoft.Network/privateDnsZones'. + attr_accessor :type + + + # + # Mapper for Resource class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'Resource', + type: { + name: 'Composite', + class_name: 'Resource', + model_properties: { + id: { + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/soa_record.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/soa_record.rb new file mode 100644 index 0000000000..032d528e0b --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/soa_record.rb @@ -0,0 +1,106 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # An SOA record. + # + class SoaRecord + + include MsRestAzure + + # @return [String] The domain name of the authoritative name server for + # this SOA record. + attr_accessor :host + + # @return [String] The email contact for this SOA record. + attr_accessor :email + + # @return [Integer] The serial number for this SOA record. + attr_accessor :serial_number + + # @return [Integer] The refresh value for this SOA record. + attr_accessor :refresh_time + + # @return [Integer] The retry time for this SOA record. + attr_accessor :retry_time + + # @return [Integer] The expire time for this SOA record. + attr_accessor :expire_time + + # @return [Integer] The minimum value for this SOA record. By convention + # this is used to determine the negative caching duration. + attr_accessor :minimum_ttl + + + # + # Mapper for SoaRecord class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'SoaRecord', + type: { + name: 'Composite', + class_name: 'SoaRecord', + model_properties: { + host: { + required: false, + serialized_name: 'host', + type: { + name: 'String' + } + }, + email: { + required: false, + serialized_name: 'email', + type: { + name: 'String' + } + }, + serial_number: { + required: false, + serialized_name: 'serialNumber', + type: { + name: 'Number' + } + }, + refresh_time: { + required: false, + serialized_name: 'refreshTime', + type: { + name: 'Number' + } + }, + retry_time: { + required: false, + serialized_name: 'retryTime', + type: { + name: 'Number' + } + }, + expire_time: { + required: false, + serialized_name: 'expireTime', + type: { + name: 'Number' + } + }, + minimum_ttl: { + required: false, + serialized_name: 'minimumTtl', + type: { + name: 'Number' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/srv_record.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/srv_record.rb new file mode 100644 index 0000000000..50c58120fa --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/srv_record.rb @@ -0,0 +1,74 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # An SRV record. + # + class SrvRecord + + include MsRestAzure + + # @return [Integer] The priority value for this SRV record. + attr_accessor :priority + + # @return [Integer] The weight value for this SRV record. + attr_accessor :weight + + # @return [Integer] The port value for this SRV record. + attr_accessor :port + + # @return [String] The target domain name for this SRV record. + attr_accessor :target + + + # + # Mapper for SrvRecord class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'SrvRecord', + type: { + name: 'Composite', + class_name: 'SrvRecord', + model_properties: { + priority: { + required: false, + serialized_name: 'priority', + type: { + name: 'Number' + } + }, + weight: { + required: false, + serialized_name: 'weight', + type: { + name: 'Number' + } + }, + port: { + required: false, + serialized_name: 'port', + type: { + name: 'Number' + } + }, + target: { + required: false, + serialized_name: 'target', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/sub_resource.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/sub_resource.rb new file mode 100644 index 0000000000..5e20614d16 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/sub_resource.rb @@ -0,0 +1,44 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # Reference to another subresource. + # + class SubResource + + include MsRestAzure + + # @return [String] Resource ID. + attr_accessor :id + + + # + # Mapper for SubResource class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'SubResource', + type: { + name: 'Composite', + class_name: 'SubResource', + model_properties: { + id: { + required: false, + serialized_name: 'id', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/tracked_resource.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/tracked_resource.rb new file mode 100644 index 0000000000..58fb679b2a --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/tracked_resource.rb @@ -0,0 +1,85 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # The resource model definition for a ARM tracked top level resource + # + class TrackedResource < Resource + + include MsRestAzure + + # @return [Hash{String => String}] Resource tags. + attr_accessor :tags + + # @return [String] The Azure Region where the resource lives + attr_accessor :location + + + # + # Mapper for TrackedResource class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'TrackedResource', + type: { + name: 'Composite', + class_name: 'TrackedResource', + model_properties: { + id: { + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + }, + tags: { + required: false, + serialized_name: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: false, + serialized_name: 'location', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/txt_record.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/txt_record.rb new file mode 100644 index 0000000000..c545bcb6c4 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/txt_record.rb @@ -0,0 +1,51 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # A TXT record. + # + class TxtRecord + + include MsRestAzure + + # @return [Array] The text value of this TXT record. + attr_accessor :value + + + # + # Mapper for TxtRecord class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'TxtRecord', + type: { + name: 'Composite', + class_name: 'TxtRecord', + model_properties: { + value: { + required: false, + serialized_name: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/virtual_network_link.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/virtual_network_link.rb new file mode 100644 index 0000000000..fce498d981 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/virtual_network_link.rb @@ -0,0 +1,139 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # Describes a link to virtual network for a Private DNS zone. + # + class VirtualNetworkLink < TrackedResource + + include MsRestAzure + + # @return [String] The ETag of the virtual network link. + attr_accessor :etag + + # @return [SubResource] The reference of the virtual network. + attr_accessor :virtual_network + + # @return [Boolean] Is auto-registration of virtual machine records in + # the virtual network in the Private DNS zone enabled? + attr_accessor :registration_enabled + + # @return [VirtualNetworkLinkState] The status of the virtual network + # link to the Private DNS zone. Possible values are 'InProgress' and + # 'Done'. This is a read-only property and any attempt to set this value + # will be ignored. Possible values include: 'InProgress', 'Completed' + attr_accessor :virtual_network_link_state + + # @return [ProvisioningState] The provisioning state of the resource. + # This is a read-only property and any attempt to set this value will be + # ignored. Possible values include: 'Creating', 'Updating', 'Deleting', + # 'Succeeded', 'Failed', 'Canceled' + attr_accessor :provisioning_state + + + # + # Mapper for VirtualNetworkLink class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'VirtualNetworkLink', + type: { + name: 'Composite', + class_name: 'VirtualNetworkLink', + model_properties: { + id: { + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + }, + tags: { + required: false, + serialized_name: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: false, + serialized_name: 'location', + type: { + name: 'String' + } + }, + etag: { + required: false, + serialized_name: 'etag', + type: { + name: 'String' + } + }, + virtual_network: { + required: false, + serialized_name: 'properties.virtualNetwork', + type: { + name: 'Composite', + class_name: 'SubResource' + } + }, + registration_enabled: { + required: false, + serialized_name: 'properties.registrationEnabled', + type: { + name: 'Boolean' + } + }, + virtual_network_link_state: { + required: false, + read_only: true, + serialized_name: 'properties.virtualNetworkLinkState', + type: { + name: 'String' + } + }, + provisioning_state: { + required: false, + read_only: true, + serialized_name: 'properties.provisioningState', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/virtual_network_link_list_result.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/virtual_network_link_list_result.rb new file mode 100644 index 0000000000..6193c5ace7 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/virtual_network_link_list_result.rb @@ -0,0 +1,97 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # The response to a list virtual network link to Private DNS zone + # operation. + # + class VirtualNetworkLinkListResult + + include MsRestAzure + + include MsRest::JSONable + # @return [Array] Information about the virtual + # network links to the Private DNS zones. + attr_accessor :value + + # @return [String] The continuation token for the next page of results. + attr_accessor :next_link + + # return [Proc] with next page method call. + attr_accessor :next_method + + # + # Gets the rest of the items for the request, enabling auto-pagination. + # + # @return [Array] operation results. + # + def get_all_items + items = @value + page = self + while page.next_link != nil do + page = page.get_next_page + items.concat(page.value) + end + items + end + + # + # Gets the next page of results. + # + # @return [VirtualNetworkLinkListResult] with next page content. + # + def get_next_page + response = @next_method.call(@next_link).value! unless @next_method.nil? + unless response.nil? + @next_link = response.body.next_link + @value = response.body.value + self + end + end + + # + # Mapper for VirtualNetworkLinkListResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'VirtualNetworkLinkListResult', + type: { + name: 'Composite', + class_name: 'VirtualNetworkLinkListResult', + model_properties: { + value: { + required: false, + serialized_name: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'VirtualNetworkLinkElementType', + type: { + name: 'Composite', + class_name: 'VirtualNetworkLink' + } + } + } + }, + next_link: { + required: false, + read_only: true, + serialized_name: 'nextLink', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/virtual_network_link_state.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/virtual_network_link_state.rb new file mode 100644 index 0000000000..6ad1aae807 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/models/virtual_network_link_state.rb @@ -0,0 +1,16 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + module Models + # + # Defines values for VirtualNetworkLinkState + # + module VirtualNetworkLinkState + InProgress = "InProgress" + Completed = "Completed" + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/module_definition.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/module_definition.rb new file mode 100644 index 0000000000..cd107d06e2 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/module_definition.rb @@ -0,0 +1,9 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure end +module Azure::PrivateDns end +module Azure::PrivateDns::Mgmt end +module Azure::PrivateDns::Mgmt::V2018_09_01 end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/private_dns_management_client.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/private_dns_management_client.rb new file mode 100644 index 0000000000..b1259d3d7e --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/private_dns_management_client.rb @@ -0,0 +1,139 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + # + # A service client - single point of access to the REST API. + # + class PrivateDnsManagementClient < MsRestAzure::AzureServiceClient + include MsRestAzure + include MsRestAzure::Serialization + + # @return [String] the base URI of the service. + attr_accessor :base_url + + # @return Credentials needed for the client to connect to Azure. + attr_reader :credentials + + # @return [String] Gets subscription credentials which uniquely identify + # Microsoft Azure subscription. The subscription ID forms part of the URI + # for every service call. + attr_accessor :subscription_id + + # @return [String] Client Api Version. + attr_reader :api_version + + # @return [String] Gets or sets the preferred language for the response. + attr_accessor :accept_language + + # @return [Integer] Gets or sets the retry timeout in seconds for Long + # Running Operations. Default value is 30. + attr_accessor :long_running_operation_retry_timeout + + # @return [Boolean] When set to true a unique x-ms-client-request-id value + # is generated and included in each request. Default is true. + attr_accessor :generate_client_request_id + + # @return [PrivateZones] private_zones + attr_reader :private_zones + + # @return [VirtualNetworkLinks] virtual_network_links + attr_reader :virtual_network_links + + # @return [RecordSets] record_sets + attr_reader :record_sets + + # + # Creates initializes a new instance of the PrivateDnsManagementClient class. + # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. + # @param base_url [String] the base URI of the service. + # @param options [Array] filters to be applied to the HTTP requests. + # + def initialize(credentials = nil, base_url = nil, options = nil) + super(credentials, options) + @base_url = base_url || 'https://management.azure.com' + + fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? + @credentials = credentials + + @private_zones = PrivateZones.new(self) + @virtual_network_links = VirtualNetworkLinks.new(self) + @record_sets = RecordSets.new(self) + @api_version = '2018-09-01' + @accept_language = 'en-US' + @long_running_operation_retry_timeout = 30 + @generate_client_request_id = true + add_telemetry + end + + # + # Makes a request and returns the body of the response. + # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. + # @param path [String] the path, relative to {base_url}. + # @param options [Hash{String=>String}] specifying any request options like :body. + # @return [Hash{String=>String}] containing the body of the response. + # Example: + # + # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}" + # path = "/path" + # options = { + # body: request_content, + # query_params: {'api-version' => '2016-02-01'} + # } + # result = @client.make_request(:put, path, options) + # + def make_request(method, path, options = {}) + result = make_request_with_http_info(method, path, options) + result.body unless result.nil? + end + + # + # Makes a request and returns the operation response. + # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. + # @param path [String] the path, relative to {base_url}. + # @param options [Hash{String=>String}] specifying any request options like :body. + # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status. + # + def make_request_with_http_info(method, path, options = {}) + result = make_request_async(method, path, options).value! + result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body) + result + end + + # + # Makes a request asynchronously. + # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. + # @param path [String] the path, relative to {base_url}. + # @param options [Hash{String=>String}] specifying any request options like :body. + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def make_request_async(method, path, options = {}) + fail ArgumentError, 'method is nil' if method.nil? + fail ArgumentError, 'path is nil' if path.nil? + + request_url = options[:base_url] || @base_url + + request_headers = @request_headers + request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil? + options.merge!({headers: request_headers.merge(options[:headers] || {})}) + options.merge!({credentials: @credentials}) unless @credentials.nil? + + super(request_url, method, path, options) + end + + + private + # + # Adds telemetry information. + # + def add_telemetry + sdk_information = 'azure_mgmt_privatedns' + if defined? Azure::PrivateDns::Mgmt::V2018_09_01::VERSION + sdk_information = "#{sdk_information}/#{Azure::PrivateDns::Mgmt::V2018_09_01::VERSION}" + end + add_user_agent_information(sdk_information) + end + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/private_zones.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/private_zones.rb new file mode 100644 index 0000000000..f3f2695470 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/private_zones.rb @@ -0,0 +1,1047 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + # + # The Private DNS Management Client. + # + class PrivateZones + include MsRestAzure + + # + # Creates and initializes a new instance of the PrivateZones class. + # @param client service class for accessing basic functionality. + # + def initialize(client) + @client = client + end + + # @return [PrivateDnsManagementClient] reference to the PrivateDnsManagementClient + attr_reader :client + + # + # Creates or updates a Private DNS zone. Does not modify Links to virtual + # networks or DNS records within the zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param parameters [PrivateZone] Parameters supplied to the CreateOrUpdate + # operation. + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always overwrite the current zone. Specify the last-seen ETag value to + # prevent accidentally overwriting any concurrent changes. + # @param if_none_match [String] Set to '*' to allow a new Private DNS zone to + # be created, but to prevent updating an existing zone. Other values will be + # ignored. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [PrivateZone] operation results. + # + def create_or_update(resource_group_name, private_zone_name, parameters, if_match = nil, if_none_match = nil, custom_headers = nil) + response = create_or_update_async(resource_group_name, private_zone_name, parameters, if_match, if_none_match, custom_headers).value! + response.body unless response.nil? + end + + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param parameters [PrivateZone] Parameters supplied to the CreateOrUpdate + # operation. + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always overwrite the current zone. Specify the last-seen ETag value to + # prevent accidentally overwriting any concurrent changes. + # @param if_none_match [String] Set to '*' to allow a new Private DNS zone to + # be created, but to prevent updating an existing zone. Other values will be + # ignored. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Concurrent::Promise] promise which provides async access to http + # response. + # + def create_or_update_async(resource_group_name, private_zone_name, parameters, if_match = nil, if_none_match = nil, custom_headers = nil) + # Send request + promise = begin_create_or_update_async(resource_group_name, private_zone_name, parameters, if_match, if_none_match, custom_headers) + + promise = promise.then do |response| + # Defining deserialization method. + deserialize_method = lambda do |parsed_response| + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::PrivateZone.mapper() + parsed_response = @client.deserialize(result_mapper, parsed_response) + end + + # Waiting for response. + @client.get_long_running_operation_result(response, deserialize_method) + end + + promise + end + + # + # Updates a Private DNS zone. Does not modify virtual network links or DNS + # records within the zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param parameters [PrivateZone] Parameters supplied to the Update operation. + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always overwrite the current zone. Specify the last-seen ETag value to + # prevent accidentally overwriting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [PrivateZone] operation results. + # + def update(resource_group_name, private_zone_name, parameters, if_match = nil, custom_headers = nil) + response = update_async(resource_group_name, private_zone_name, parameters, if_match, custom_headers).value! + response.body unless response.nil? + end + + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param parameters [PrivateZone] Parameters supplied to the Update operation. + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always overwrite the current zone. Specify the last-seen ETag value to + # prevent accidentally overwriting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Concurrent::Promise] promise which provides async access to http + # response. + # + def update_async(resource_group_name, private_zone_name, parameters, if_match = nil, custom_headers = nil) + # Send request + promise = begin_update_async(resource_group_name, private_zone_name, parameters, if_match, custom_headers) + + promise = promise.then do |response| + # Defining deserialization method. + deserialize_method = lambda do |parsed_response| + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::PrivateZone.mapper() + parsed_response = @client.deserialize(result_mapper, parsed_response) + end + + # Waiting for response. + @client.get_long_running_operation_result(response, deserialize_method) + end + + promise + end + + # + # Deletes a Private DNS zone. WARNING: All DNS records in the zone will also be + # deleted. This operation cannot be undone. Private DNS zone cannot be deleted + # unless all virtual network links to it are removed. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always delete the current zone. Specify the last-seen ETag value to prevent + # accidentally deleting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + def delete(resource_group_name, private_zone_name, if_match = nil, custom_headers = nil) + response = delete_async(resource_group_name, private_zone_name, if_match, custom_headers).value! + nil + end + + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always delete the current zone. Specify the last-seen ETag value to prevent + # accidentally deleting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Concurrent::Promise] promise which provides async access to http + # response. + # + def delete_async(resource_group_name, private_zone_name, if_match = nil, custom_headers = nil) + # Send request + promise = begin_delete_async(resource_group_name, private_zone_name, if_match, custom_headers) + + promise = promise.then do |response| + # Defining deserialization method. + deserialize_method = lambda do |parsed_response| + end + + # Waiting for response. + @client.get_long_running_operation_result(response, deserialize_method) + end + + promise + end + + # + # Gets a Private DNS zone. Retrieves the zone properties, but not the virtual + # networks links or the record sets within the zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [PrivateZone] operation results. + # + def get(resource_group_name, private_zone_name, custom_headers = nil) + response = get_async(resource_group_name, private_zone_name, custom_headers).value! + response.body unless response.nil? + end + + # + # Gets a Private DNS zone. Retrieves the zone properties, but not the virtual + # networks links or the record sets within the zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def get_with_http_info(resource_group_name, private_zone_name, custom_headers = nil) + get_async(resource_group_name, private_zone_name, custom_headers).value! + end + + # + # Gets a Private DNS zone. Retrieves the zone properties, but not the virtual + # networks links or the record sets within the zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def get_async(resource_group_name, private_zone_name, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::PrivateZone.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Lists the Private DNS zones in all resource groups in a subscription. + # + # @param top [Integer] The maximum number of Private DNS zones to return. If + # not specified, returns up to 100 zones. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Array] operation results. + # + def list(top = nil, custom_headers = nil) + first_page = list_as_lazy(top, custom_headers) + first_page.get_all_items + end + + # + # Lists the Private DNS zones in all resource groups in a subscription. + # + # @param top [Integer] The maximum number of Private DNS zones to return. If + # not specified, returns up to 100 zones. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_with_http_info(top = nil, custom_headers = nil) + list_async(top, custom_headers).value! + end + + # + # Lists the Private DNS zones in all resource groups in a subscription. + # + # @param top [Integer] The maximum number of Private DNS zones to return. If + # not specified, returns up to 100 zones. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_async(top = nil, custom_headers = nil) + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Network/privateDnsZones' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id}, + query_params: {'$top' => top,'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::PrivateZoneListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Lists the Private DNS zones within a resource group. + # + # @param resource_group_name [String] The name of the resource group. + # @param top [Integer] The maximum number of record sets to return. If not + # specified, returns up to 100 record sets. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Array] operation results. + # + def list_by_resource_group(resource_group_name, top = nil, custom_headers = nil) + first_page = list_by_resource_group_as_lazy(resource_group_name, top, custom_headers) + first_page.get_all_items + end + + # + # Lists the Private DNS zones within a resource group. + # + # @param resource_group_name [String] The name of the resource group. + # @param top [Integer] The maximum number of record sets to return. If not + # specified, returns up to 100 record sets. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_by_resource_group_with_http_info(resource_group_name, top = nil, custom_headers = nil) + list_by_resource_group_async(resource_group_name, top, custom_headers).value! + end + + # + # Lists the Private DNS zones within a resource group. + # + # @param resource_group_name [String] The name of the resource group. + # @param top [Integer] The maximum number of record sets to return. If not + # specified, returns up to 100 record sets. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_by_resource_group_async(resource_group_name, top = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id}, + query_params: {'$top' => top,'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::PrivateZoneListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Creates or updates a Private DNS zone. Does not modify Links to virtual + # networks or DNS records within the zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param parameters [PrivateZone] Parameters supplied to the CreateOrUpdate + # operation. + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always overwrite the current zone. Specify the last-seen ETag value to + # prevent accidentally overwriting any concurrent changes. + # @param if_none_match [String] Set to '*' to allow a new Private DNS zone to + # be created, but to prevent updating an existing zone. Other values will be + # ignored. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [PrivateZone] operation results. + # + def begin_create_or_update(resource_group_name, private_zone_name, parameters, if_match = nil, if_none_match = nil, custom_headers = nil) + response = begin_create_or_update_async(resource_group_name, private_zone_name, parameters, if_match, if_none_match, custom_headers).value! + response.body unless response.nil? + end + + # + # Creates or updates a Private DNS zone. Does not modify Links to virtual + # networks or DNS records within the zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param parameters [PrivateZone] Parameters supplied to the CreateOrUpdate + # operation. + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always overwrite the current zone. Specify the last-seen ETag value to + # prevent accidentally overwriting any concurrent changes. + # @param if_none_match [String] Set to '*' to allow a new Private DNS zone to + # be created, but to prevent updating an existing zone. Other values will be + # ignored. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def begin_create_or_update_with_http_info(resource_group_name, private_zone_name, parameters, if_match = nil, if_none_match = nil, custom_headers = nil) + begin_create_or_update_async(resource_group_name, private_zone_name, parameters, if_match, if_none_match, custom_headers).value! + end + + # + # Creates or updates a Private DNS zone. Does not modify Links to virtual + # networks or DNS records within the zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param parameters [PrivateZone] Parameters supplied to the CreateOrUpdate + # operation. + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always overwrite the current zone. Specify the last-seen ETag value to + # prevent accidentally overwriting any concurrent changes. + # @param if_none_match [String] Set to '*' to allow a new Private DNS zone to + # be created, but to prevent updating an existing zone. Other values will be + # ignored. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def begin_create_or_update_async(resource_group_name, private_zone_name, parameters, if_match = nil, if_none_match = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, 'parameters is nil' if parameters.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['If-Match'] = if_match unless if_match.nil? + request_headers['If-None-Match'] = if_none_match unless if_none_match.nil? + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::PrivateZone.mapper() + request_content = @client.serialize(request_mapper, parameters) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:put, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 201 || status_code == 200 || status_code == 202 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 201 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::PrivateZone.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::PrivateZone.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Updates a Private DNS zone. Does not modify virtual network links or DNS + # records within the zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param parameters [PrivateZone] Parameters supplied to the Update operation. + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always overwrite the current zone. Specify the last-seen ETag value to + # prevent accidentally overwriting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [PrivateZone] operation results. + # + def begin_update(resource_group_name, private_zone_name, parameters, if_match = nil, custom_headers = nil) + response = begin_update_async(resource_group_name, private_zone_name, parameters, if_match, custom_headers).value! + response.body unless response.nil? + end + + # + # Updates a Private DNS zone. Does not modify virtual network links or DNS + # records within the zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param parameters [PrivateZone] Parameters supplied to the Update operation. + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always overwrite the current zone. Specify the last-seen ETag value to + # prevent accidentally overwriting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def begin_update_with_http_info(resource_group_name, private_zone_name, parameters, if_match = nil, custom_headers = nil) + begin_update_async(resource_group_name, private_zone_name, parameters, if_match, custom_headers).value! + end + + # + # Updates a Private DNS zone. Does not modify virtual network links or DNS + # records within the zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param parameters [PrivateZone] Parameters supplied to the Update operation. + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always overwrite the current zone. Specify the last-seen ETag value to + # prevent accidentally overwriting any concurrent changes. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def begin_update_async(resource_group_name, private_zone_name, parameters, if_match = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, 'parameters is nil' if parameters.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['If-Match'] = if_match unless if_match.nil? + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::PrivateZone.mapper() + request_content = @client.serialize(request_mapper, parameters) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:patch, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 || status_code == 202 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::PrivateZone.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Deletes a Private DNS zone. WARNING: All DNS records in the zone will also be + # deleted. This operation cannot be undone. Private DNS zone cannot be deleted + # unless all virtual network links to it are removed. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always delete the current zone. Specify the last-seen ETag value to prevent + # accidentally deleting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # + def begin_delete(resource_group_name, private_zone_name, if_match = nil, custom_headers = nil) + response = begin_delete_async(resource_group_name, private_zone_name, if_match, custom_headers).value! + nil + end + + # + # Deletes a Private DNS zone. WARNING: All DNS records in the zone will also be + # deleted. This operation cannot be undone. Private DNS zone cannot be deleted + # unless all virtual network links to it are removed. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always delete the current zone. Specify the last-seen ETag value to prevent + # accidentally deleting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def begin_delete_with_http_info(resource_group_name, private_zone_name, if_match = nil, custom_headers = nil) + begin_delete_async(resource_group_name, private_zone_name, if_match, custom_headers).value! + end + + # + # Deletes a Private DNS zone. WARNING: All DNS records in the zone will also be + # deleted. This operation cannot be undone. Private DNS zone cannot be deleted + # unless all virtual network links to it are removed. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param if_match [String] The ETag of the Private DNS zone. Omit this value to + # always delete the current zone. Specify the last-seen ETag value to prevent + # accidentally deleting any concurrent changes. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def begin_delete_async(resource_group_name, private_zone_name, if_match = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['If-Match'] = if_match unless if_match.nil? + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:delete, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 || status_code == 202 || status_code == 204 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + + result + end + + promise.execute + end + + # + # Lists the Private DNS zones in all resource groups in a subscription. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [PrivateZoneListResult] operation results. + # + def list_next(next_page_link, custom_headers = nil) + response = list_next_async(next_page_link, custom_headers).value! + response.body unless response.nil? + end + + # + # Lists the Private DNS zones in all resource groups in a subscription. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_next_with_http_info(next_page_link, custom_headers = nil) + list_next_async(next_page_link, custom_headers).value! + end + + # + # Lists the Private DNS zones in all resource groups in a subscription. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_next_async(next_page_link, custom_headers = nil) + fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = '{nextLink}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + skip_encoding_path_params: {'nextLink' => next_page_link}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::PrivateZoneListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Lists the Private DNS zones within a resource group. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [PrivateZoneListResult] operation results. + # + def list_by_resource_group_next(next_page_link, custom_headers = nil) + response = list_by_resource_group_next_async(next_page_link, custom_headers).value! + response.body unless response.nil? + end + + # + # Lists the Private DNS zones within a resource group. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil) + list_by_resource_group_next_async(next_page_link, custom_headers).value! + end + + # + # Lists the Private DNS zones within a resource group. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_by_resource_group_next_async(next_page_link, custom_headers = nil) + fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = '{nextLink}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + skip_encoding_path_params: {'nextLink' => next_page_link}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::PrivateZoneListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Lists the Private DNS zones in all resource groups in a subscription. + # + # @param top [Integer] The maximum number of Private DNS zones to return. If + # not specified, returns up to 100 zones. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [PrivateZoneListResult] which provide lazy access to pages of the + # response. + # + def list_as_lazy(top = nil, custom_headers = nil) + response = list_async(top, custom_headers).value! + unless response.nil? + page = response.body + page.next_method = Proc.new do |next_page_link| + list_next_async(next_page_link, custom_headers) + end + page + end + end + + # + # Lists the Private DNS zones within a resource group. + # + # @param resource_group_name [String] The name of the resource group. + # @param top [Integer] The maximum number of record sets to return. If not + # specified, returns up to 100 record sets. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [PrivateZoneListResult] which provide lazy access to pages of the + # response. + # + def list_by_resource_group_as_lazy(resource_group_name, top = nil, custom_headers = nil) + response = list_by_resource_group_async(resource_group_name, top, custom_headers).value! + unless response.nil? + page = response.body + page.next_method = Proc.new do |next_page_link| + list_by_resource_group_next_async(next_page_link, custom_headers) + end + page + end + end + + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/record_sets.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/record_sets.rb new file mode 100644 index 0000000000..392aed5263 --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/record_sets.rb @@ -0,0 +1,1019 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + # + # The Private DNS Management Client. + # + class RecordSets + include MsRestAzure + + # + # Creates and initializes a new instance of the RecordSets class. + # @param client service class for accessing basic functionality. + # + def initialize(client) + @client = client + end + + # @return [PrivateDnsManagementClient] reference to the PrivateDnsManagementClient + attr_reader :client + + # + # Creates or updates a record set within a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of DNS record in this record set. + # Record sets of type SOA can be updated but not created (they are created when + # the Private DNS zone is created). Possible values include: 'A', 'AAAA', + # 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', 'TXT' + # @param relative_record_set_name [String] The name of the record set, relative + # to the name of the zone. + # @param parameters [RecordSet] Parameters supplied to the CreateOrUpdate + # operation. + # @param if_match [String] The ETag of the record set. Omit this value to + # always overwrite the current record set. Specify the last-seen ETag value to + # prevent accidentally overwriting any concurrent changes. + # @param if_none_match [String] Set to '*' to allow a new record set to be + # created, but to prevent updating an existing record set. Other values will be + # ignored. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [RecordSet] operation results. + # + def create_or_update(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match = nil, if_none_match = nil, custom_headers = nil) + response = create_or_update_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match, if_none_match, custom_headers).value! + response.body unless response.nil? + end + + # + # Creates or updates a record set within a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of DNS record in this record set. + # Record sets of type SOA can be updated but not created (they are created when + # the Private DNS zone is created). Possible values include: 'A', 'AAAA', + # 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', 'TXT' + # @param relative_record_set_name [String] The name of the record set, relative + # to the name of the zone. + # @param parameters [RecordSet] Parameters supplied to the CreateOrUpdate + # operation. + # @param if_match [String] The ETag of the record set. Omit this value to + # always overwrite the current record set. Specify the last-seen ETag value to + # prevent accidentally overwriting any concurrent changes. + # @param if_none_match [String] Set to '*' to allow a new record set to be + # created, but to prevent updating an existing record set. Other values will be + # ignored. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def create_or_update_with_http_info(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match = nil, if_none_match = nil, custom_headers = nil) + create_or_update_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match, if_none_match, custom_headers).value! + end + + # + # Creates or updates a record set within a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of DNS record in this record set. + # Record sets of type SOA can be updated but not created (they are created when + # the Private DNS zone is created). Possible values include: 'A', 'AAAA', + # 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', 'TXT' + # @param relative_record_set_name [String] The name of the record set, relative + # to the name of the zone. + # @param parameters [RecordSet] Parameters supplied to the CreateOrUpdate + # operation. + # @param if_match [String] The ETag of the record set. Omit this value to + # always overwrite the current record set. Specify the last-seen ETag value to + # prevent accidentally overwriting any concurrent changes. + # @param if_none_match [String] Set to '*' to allow a new record set to be + # created, but to prevent updating an existing record set. Other values will be + # ignored. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def create_or_update_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match = nil, if_none_match = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, 'record_type is nil' if record_type.nil? + fail ArgumentError, 'relative_record_set_name is nil' if relative_record_set_name.nil? + fail ArgumentError, 'parameters is nil' if parameters.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['If-Match'] = if_match unless if_match.nil? + request_headers['If-None-Match'] = if_none_match unless if_none_match.nil? + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::RecordSet.mapper() + request_content = @client.serialize(request_mapper, parameters) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'recordType' => record_type,'subscriptionId' => @client.subscription_id}, + skip_encoding_path_params: {'relativeRecordSetName' => relative_record_set_name}, + query_params: {'api-version' => @client.api_version}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:put, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 201 || status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 201 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::RecordSet.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::RecordSet.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Updates a record set within a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of DNS record in this record set. + # Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', + # 'TXT' + # @param relative_record_set_name [String] The name of the record set, relative + # to the name of the zone. + # @param parameters [RecordSet] Parameters supplied to the Update operation. + # @param if_match [String] The ETag of the record set. Omit this value to + # always overwrite the current record set. Specify the last-seen ETag value to + # prevent accidentally overwriting concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [RecordSet] operation results. + # + def update(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match = nil, custom_headers = nil) + response = update_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match, custom_headers).value! + response.body unless response.nil? + end + + # + # Updates a record set within a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of DNS record in this record set. + # Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', + # 'TXT' + # @param relative_record_set_name [String] The name of the record set, relative + # to the name of the zone. + # @param parameters [RecordSet] Parameters supplied to the Update operation. + # @param if_match [String] The ETag of the record set. Omit this value to + # always overwrite the current record set. Specify the last-seen ETag value to + # prevent accidentally overwriting concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def update_with_http_info(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match = nil, custom_headers = nil) + update_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match, custom_headers).value! + end + + # + # Updates a record set within a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of DNS record in this record set. + # Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', + # 'TXT' + # @param relative_record_set_name [String] The name of the record set, relative + # to the name of the zone. + # @param parameters [RecordSet] Parameters supplied to the Update operation. + # @param if_match [String] The ETag of the record set. Omit this value to + # always overwrite the current record set. Specify the last-seen ETag value to + # prevent accidentally overwriting concurrent changes. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def update_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, 'record_type is nil' if record_type.nil? + fail ArgumentError, 'relative_record_set_name is nil' if relative_record_set_name.nil? + fail ArgumentError, 'parameters is nil' if parameters.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['If-Match'] = if_match unless if_match.nil? + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::RecordSet.mapper() + request_content = @client.serialize(request_mapper, parameters) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'recordType' => record_type,'subscriptionId' => @client.subscription_id}, + skip_encoding_path_params: {'relativeRecordSetName' => relative_record_set_name}, + query_params: {'api-version' => @client.api_version}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:patch, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::RecordSet.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Deletes a record set from a Private DNS zone. This operation cannot be + # undone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of DNS record in this record set. + # Record sets of type SOA cannot be deleted (they are deleted when the Private + # DNS zone is deleted). Possible values include: 'A', 'AAAA', 'CNAME', 'MX', + # 'PTR', 'SOA', 'SRV', 'TXT' + # @param relative_record_set_name [String] The name of the record set, relative + # to the name of the zone. + # @param if_match [String] The ETag of the record set. Omit this value to + # always delete the current record set. Specify the last-seen ETag value to + # prevent accidentally deleting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # + def delete(resource_group_name, private_zone_name, record_type, relative_record_set_name, if_match = nil, custom_headers = nil) + response = delete_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, if_match, custom_headers).value! + nil + end + + # + # Deletes a record set from a Private DNS zone. This operation cannot be + # undone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of DNS record in this record set. + # Record sets of type SOA cannot be deleted (they are deleted when the Private + # DNS zone is deleted). Possible values include: 'A', 'AAAA', 'CNAME', 'MX', + # 'PTR', 'SOA', 'SRV', 'TXT' + # @param relative_record_set_name [String] The name of the record set, relative + # to the name of the zone. + # @param if_match [String] The ETag of the record set. Omit this value to + # always delete the current record set. Specify the last-seen ETag value to + # prevent accidentally deleting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def delete_with_http_info(resource_group_name, private_zone_name, record_type, relative_record_set_name, if_match = nil, custom_headers = nil) + delete_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, if_match, custom_headers).value! + end + + # + # Deletes a record set from a Private DNS zone. This operation cannot be + # undone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of DNS record in this record set. + # Record sets of type SOA cannot be deleted (they are deleted when the Private + # DNS zone is deleted). Possible values include: 'A', 'AAAA', 'CNAME', 'MX', + # 'PTR', 'SOA', 'SRV', 'TXT' + # @param relative_record_set_name [String] The name of the record set, relative + # to the name of the zone. + # @param if_match [String] The ETag of the record set. Omit this value to + # always delete the current record set. Specify the last-seen ETag value to + # prevent accidentally deleting any concurrent changes. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def delete_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, if_match = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, 'record_type is nil' if record_type.nil? + fail ArgumentError, 'relative_record_set_name is nil' if relative_record_set_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['If-Match'] = if_match unless if_match.nil? + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'recordType' => record_type,'subscriptionId' => @client.subscription_id}, + skip_encoding_path_params: {'relativeRecordSetName' => relative_record_set_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:delete, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 || status_code == 204 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + + result + end + + promise.execute + end + + # + # Gets a record set. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of DNS record in this record set. + # Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', + # 'TXT' + # @param relative_record_set_name [String] The name of the record set, relative + # to the name of the zone. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [RecordSet] operation results. + # + def get(resource_group_name, private_zone_name, record_type, relative_record_set_name, custom_headers = nil) + response = get_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, custom_headers).value! + response.body unless response.nil? + end + + # + # Gets a record set. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of DNS record in this record set. + # Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', + # 'TXT' + # @param relative_record_set_name [String] The name of the record set, relative + # to the name of the zone. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def get_with_http_info(resource_group_name, private_zone_name, record_type, relative_record_set_name, custom_headers = nil) + get_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, custom_headers).value! + end + + # + # Gets a record set. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of DNS record in this record set. + # Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', + # 'TXT' + # @param relative_record_set_name [String] The name of the record set, relative + # to the name of the zone. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def get_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, 'record_type is nil' if record_type.nil? + fail ArgumentError, 'relative_record_set_name is nil' if relative_record_set_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'recordType' => record_type,'subscriptionId' => @client.subscription_id}, + skip_encoding_path_params: {'relativeRecordSetName' => relative_record_set_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::RecordSet.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Lists the record sets of a specified type in a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of record sets to enumerate. + # Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', + # 'TXT' + # @param top [Integer] The maximum number of record sets to return. If not + # specified, returns up to 100 record sets. + # @param recordsetnamesuffix [String] The suffix label of the record set name + # to be used to filter the record set enumeration. If this parameter is + # specified, the returned enumeration will only contain records that end with + # ".". + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Array] operation results. + # + def list_by_type(resource_group_name, private_zone_name, record_type, top = nil, recordsetnamesuffix = nil, custom_headers = nil) + first_page = list_by_type_as_lazy(resource_group_name, private_zone_name, record_type, top, recordsetnamesuffix, custom_headers) + first_page.get_all_items + end + + # + # Lists the record sets of a specified type in a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of record sets to enumerate. + # Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', + # 'TXT' + # @param top [Integer] The maximum number of record sets to return. If not + # specified, returns up to 100 record sets. + # @param recordsetnamesuffix [String] The suffix label of the record set name + # to be used to filter the record set enumeration. If this parameter is + # specified, the returned enumeration will only contain records that end with + # ".". + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_by_type_with_http_info(resource_group_name, private_zone_name, record_type, top = nil, recordsetnamesuffix = nil, custom_headers = nil) + list_by_type_async(resource_group_name, private_zone_name, record_type, top, recordsetnamesuffix, custom_headers).value! + end + + # + # Lists the record sets of a specified type in a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of record sets to enumerate. + # Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', + # 'TXT' + # @param top [Integer] The maximum number of record sets to return. If not + # specified, returns up to 100 record sets. + # @param recordsetnamesuffix [String] The suffix label of the record set name + # to be used to filter the record set enumeration. If this parameter is + # specified, the returned enumeration will only contain records that end with + # ".". + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_by_type_async(resource_group_name, private_zone_name, record_type, top = nil, recordsetnamesuffix = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, 'record_type is nil' if record_type.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'recordType' => record_type,'subscriptionId' => @client.subscription_id}, + query_params: {'$top' => top,'$recordsetnamesuffix' => recordsetnamesuffix,'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::RecordSetListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Lists all record sets in a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param top [Integer] The maximum number of record sets to return. If not + # specified, returns up to 100 record sets. + # @param recordsetnamesuffix [String] The suffix label of the record set name + # to be used to filter the record set enumeration. If this parameter is + # specified, the returned enumeration will only contain records that end with + # ".". + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Array] operation results. + # + def list(resource_group_name, private_zone_name, top = nil, recordsetnamesuffix = nil, custom_headers = nil) + first_page = list_as_lazy(resource_group_name, private_zone_name, top, recordsetnamesuffix, custom_headers) + first_page.get_all_items + end + + # + # Lists all record sets in a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param top [Integer] The maximum number of record sets to return. If not + # specified, returns up to 100 record sets. + # @param recordsetnamesuffix [String] The suffix label of the record set name + # to be used to filter the record set enumeration. If this parameter is + # specified, the returned enumeration will only contain records that end with + # ".". + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_with_http_info(resource_group_name, private_zone_name, top = nil, recordsetnamesuffix = nil, custom_headers = nil) + list_async(resource_group_name, private_zone_name, top, recordsetnamesuffix, custom_headers).value! + end + + # + # Lists all record sets in a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param top [Integer] The maximum number of record sets to return. If not + # specified, returns up to 100 record sets. + # @param recordsetnamesuffix [String] The suffix label of the record set name + # to be used to filter the record set enumeration. If this parameter is + # specified, the returned enumeration will only contain records that end with + # ".". + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_async(resource_group_name, private_zone_name, top = nil, recordsetnamesuffix = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/ALL' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'subscriptionId' => @client.subscription_id}, + query_params: {'$top' => top,'$recordsetnamesuffix' => recordsetnamesuffix,'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::RecordSetListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Lists the record sets of a specified type in a Private DNS zone. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [RecordSetListResult] operation results. + # + def list_by_type_next(next_page_link, custom_headers = nil) + response = list_by_type_next_async(next_page_link, custom_headers).value! + response.body unless response.nil? + end + + # + # Lists the record sets of a specified type in a Private DNS zone. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_by_type_next_with_http_info(next_page_link, custom_headers = nil) + list_by_type_next_async(next_page_link, custom_headers).value! + end + + # + # Lists the record sets of a specified type in a Private DNS zone. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_by_type_next_async(next_page_link, custom_headers = nil) + fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = '{nextLink}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + skip_encoding_path_params: {'nextLink' => next_page_link}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::RecordSetListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Lists all record sets in a Private DNS zone. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [RecordSetListResult] operation results. + # + def list_next(next_page_link, custom_headers = nil) + response = list_next_async(next_page_link, custom_headers).value! + response.body unless response.nil? + end + + # + # Lists all record sets in a Private DNS zone. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_next_with_http_info(next_page_link, custom_headers = nil) + list_next_async(next_page_link, custom_headers).value! + end + + # + # Lists all record sets in a Private DNS zone. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_next_async(next_page_link, custom_headers = nil) + fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = '{nextLink}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + skip_encoding_path_params: {'nextLink' => next_page_link}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::RecordSetListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Lists the record sets of a specified type in a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param record_type [RecordType] The type of record sets to enumerate. + # Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', + # 'TXT' + # @param top [Integer] The maximum number of record sets to return. If not + # specified, returns up to 100 record sets. + # @param recordsetnamesuffix [String] The suffix label of the record set name + # to be used to filter the record set enumeration. If this parameter is + # specified, the returned enumeration will only contain records that end with + # ".". + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [RecordSetListResult] which provide lazy access to pages of the + # response. + # + def list_by_type_as_lazy(resource_group_name, private_zone_name, record_type, top = nil, recordsetnamesuffix = nil, custom_headers = nil) + response = list_by_type_async(resource_group_name, private_zone_name, record_type, top, recordsetnamesuffix, custom_headers).value! + unless response.nil? + page = response.body + page.next_method = Proc.new do |next_page_link| + list_by_type_next_async(next_page_link, custom_headers) + end + page + end + end + + # + # Lists all record sets in a Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param top [Integer] The maximum number of record sets to return. If not + # specified, returns up to 100 record sets. + # @param recordsetnamesuffix [String] The suffix label of the record set name + # to be used to filter the record set enumeration. If this parameter is + # specified, the returned enumeration will only contain records that end with + # ".". + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [RecordSetListResult] which provide lazy access to pages of the + # response. + # + def list_as_lazy(resource_group_name, private_zone_name, top = nil, recordsetnamesuffix = nil, custom_headers = nil) + response = list_async(resource_group_name, private_zone_name, top, recordsetnamesuffix, custom_headers).value! + unless response.nil? + page = response.body + page.next_method = Proc.new do |next_page_link| + list_next_async(next_page_link, custom_headers) + end + page + end + end + + end +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/version.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/version.rb new file mode 100644 index 0000000000..f0b61644ad --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/version.rb @@ -0,0 +1,8 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + VERSION = '0.16.0' +end diff --git a/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/virtual_network_links.rb b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/virtual_network_links.rb new file mode 100644 index 0000000000..5d7ceacdbb --- /dev/null +++ b/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/virtual_network_links.rb @@ -0,0 +1,906 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::PrivateDns::Mgmt::V2018_09_01 + # + # The Private DNS Management Client. + # + class VirtualNetworkLinks + include MsRestAzure + + # + # Creates and initializes a new instance of the VirtualNetworkLinks class. + # @param client service class for accessing basic functionality. + # + def initialize(client) + @client = client + end + + # @return [PrivateDnsManagementClient] reference to the PrivateDnsManagementClient + attr_reader :client + + # + # Creates or updates a virtual network link to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param parameters [VirtualNetworkLink] Parameters supplied to the + # CreateOrUpdate operation. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always overwrite the current virtual network + # link. Specify the last-seen ETag value to prevent accidentally overwriting + # any concurrent changes. + # @param if_none_match [String] Set to '*' to allow a new virtual network link + # to the Private DNS zone to be created, but to prevent updating an existing + # link. Other values will be ignored. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [VirtualNetworkLink] operation results. + # + def create_or_update(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match = nil, if_none_match = nil, custom_headers = nil) + response = create_or_update_async(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match, if_none_match, custom_headers).value! + response.body unless response.nil? + end + + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param parameters [VirtualNetworkLink] Parameters supplied to the + # CreateOrUpdate operation. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always overwrite the current virtual network + # link. Specify the last-seen ETag value to prevent accidentally overwriting + # any concurrent changes. + # @param if_none_match [String] Set to '*' to allow a new virtual network link + # to the Private DNS zone to be created, but to prevent updating an existing + # link. Other values will be ignored. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Concurrent::Promise] promise which provides async access to http + # response. + # + def create_or_update_async(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match = nil, if_none_match = nil, custom_headers = nil) + # Send request + promise = begin_create_or_update_async(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match, if_none_match, custom_headers) + + promise = promise.then do |response| + # Defining deserialization method. + deserialize_method = lambda do |parsed_response| + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::VirtualNetworkLink.mapper() + parsed_response = @client.deserialize(result_mapper, parsed_response) + end + + # Waiting for response. + @client.get_long_running_operation_result(response, deserialize_method) + end + + promise + end + + # + # Updates a virtual network link to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param parameters [VirtualNetworkLink] Parameters supplied to the Update + # operation. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always overwrite the current virtual network + # link. Specify the last-seen ETag value to prevent accidentally overwriting + # any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [VirtualNetworkLink] operation results. + # + def update(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match = nil, custom_headers = nil) + response = update_async(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match, custom_headers).value! + response.body unless response.nil? + end + + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param parameters [VirtualNetworkLink] Parameters supplied to the Update + # operation. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always overwrite the current virtual network + # link. Specify the last-seen ETag value to prevent accidentally overwriting + # any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Concurrent::Promise] promise which provides async access to http + # response. + # + def update_async(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match = nil, custom_headers = nil) + # Send request + promise = begin_update_async(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match, custom_headers) + + promise = promise.then do |response| + # Defining deserialization method. + deserialize_method = lambda do |parsed_response| + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::VirtualNetworkLink.mapper() + parsed_response = @client.deserialize(result_mapper, parsed_response) + end + + # Waiting for response. + @client.get_long_running_operation_result(response, deserialize_method) + end + + promise + end + + # + # Deletes a virtual network link to the specified Private DNS zone. WARNING: In + # case of a registration virtual network, all auto-registered DNS records in + # the zone for the virtual network will also be deleted. This operation cannot + # be undone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always delete the current zone. Specify the + # last-seen ETag value to prevent accidentally deleting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + def delete(resource_group_name, private_zone_name, virtual_network_link_name, if_match = nil, custom_headers = nil) + response = delete_async(resource_group_name, private_zone_name, virtual_network_link_name, if_match, custom_headers).value! + nil + end + + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always delete the current zone. Specify the + # last-seen ETag value to prevent accidentally deleting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Concurrent::Promise] promise which provides async access to http + # response. + # + def delete_async(resource_group_name, private_zone_name, virtual_network_link_name, if_match = nil, custom_headers = nil) + # Send request + promise = begin_delete_async(resource_group_name, private_zone_name, virtual_network_link_name, if_match, custom_headers) + + promise = promise.then do |response| + # Defining deserialization method. + deserialize_method = lambda do |parsed_response| + end + + # Waiting for response. + @client.get_long_running_operation_result(response, deserialize_method) + end + + promise + end + + # + # Gets a virtual network link to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [VirtualNetworkLink] operation results. + # + def get(resource_group_name, private_zone_name, virtual_network_link_name, custom_headers = nil) + response = get_async(resource_group_name, private_zone_name, virtual_network_link_name, custom_headers).value! + response.body unless response.nil? + end + + # + # Gets a virtual network link to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def get_with_http_info(resource_group_name, private_zone_name, virtual_network_link_name, custom_headers = nil) + get_async(resource_group_name, private_zone_name, virtual_network_link_name, custom_headers).value! + end + + # + # Gets a virtual network link to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def get_async(resource_group_name, private_zone_name, virtual_network_link_name, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, 'virtual_network_link_name is nil' if virtual_network_link_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'virtualNetworkLinkName' => virtual_network_link_name,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::VirtualNetworkLink.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Lists the virtual network links to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param top [Integer] The maximum number of virtual network links to return. + # If not specified, returns up to 100 virtual network links. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Array] operation results. + # + def list(resource_group_name, private_zone_name, top = nil, custom_headers = nil) + first_page = list_as_lazy(resource_group_name, private_zone_name, top, custom_headers) + first_page.get_all_items + end + + # + # Lists the virtual network links to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param top [Integer] The maximum number of virtual network links to return. + # If not specified, returns up to 100 virtual network links. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_with_http_info(resource_group_name, private_zone_name, top = nil, custom_headers = nil) + list_async(resource_group_name, private_zone_name, top, custom_headers).value! + end + + # + # Lists the virtual network links to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param top [Integer] The maximum number of virtual network links to return. + # If not specified, returns up to 100 virtual network links. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_async(resource_group_name, private_zone_name, top = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'subscriptionId' => @client.subscription_id}, + query_params: {'$top' => top,'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::VirtualNetworkLinkListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Creates or updates a virtual network link to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param parameters [VirtualNetworkLink] Parameters supplied to the + # CreateOrUpdate operation. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always overwrite the current virtual network + # link. Specify the last-seen ETag value to prevent accidentally overwriting + # any concurrent changes. + # @param if_none_match [String] Set to '*' to allow a new virtual network link + # to the Private DNS zone to be created, but to prevent updating an existing + # link. Other values will be ignored. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [VirtualNetworkLink] operation results. + # + def begin_create_or_update(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match = nil, if_none_match = nil, custom_headers = nil) + response = begin_create_or_update_async(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match, if_none_match, custom_headers).value! + response.body unless response.nil? + end + + # + # Creates or updates a virtual network link to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param parameters [VirtualNetworkLink] Parameters supplied to the + # CreateOrUpdate operation. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always overwrite the current virtual network + # link. Specify the last-seen ETag value to prevent accidentally overwriting + # any concurrent changes. + # @param if_none_match [String] Set to '*' to allow a new virtual network link + # to the Private DNS zone to be created, but to prevent updating an existing + # link. Other values will be ignored. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def begin_create_or_update_with_http_info(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match = nil, if_none_match = nil, custom_headers = nil) + begin_create_or_update_async(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match, if_none_match, custom_headers).value! + end + + # + # Creates or updates a virtual network link to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param parameters [VirtualNetworkLink] Parameters supplied to the + # CreateOrUpdate operation. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always overwrite the current virtual network + # link. Specify the last-seen ETag value to prevent accidentally overwriting + # any concurrent changes. + # @param if_none_match [String] Set to '*' to allow a new virtual network link + # to the Private DNS zone to be created, but to prevent updating an existing + # link. Other values will be ignored. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def begin_create_or_update_async(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match = nil, if_none_match = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, 'virtual_network_link_name is nil' if virtual_network_link_name.nil? + fail ArgumentError, 'parameters is nil' if parameters.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['If-Match'] = if_match unless if_match.nil? + request_headers['If-None-Match'] = if_none_match unless if_none_match.nil? + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::VirtualNetworkLink.mapper() + request_content = @client.serialize(request_mapper, parameters) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'virtualNetworkLinkName' => virtual_network_link_name,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:put, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 201 || status_code == 200 || status_code == 202 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 201 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::VirtualNetworkLink.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::VirtualNetworkLink.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Updates a virtual network link to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param parameters [VirtualNetworkLink] Parameters supplied to the Update + # operation. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always overwrite the current virtual network + # link. Specify the last-seen ETag value to prevent accidentally overwriting + # any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [VirtualNetworkLink] operation results. + # + def begin_update(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match = nil, custom_headers = nil) + response = begin_update_async(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match, custom_headers).value! + response.body unless response.nil? + end + + # + # Updates a virtual network link to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param parameters [VirtualNetworkLink] Parameters supplied to the Update + # operation. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always overwrite the current virtual network + # link. Specify the last-seen ETag value to prevent accidentally overwriting + # any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def begin_update_with_http_info(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match = nil, custom_headers = nil) + begin_update_async(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match, custom_headers).value! + end + + # + # Updates a virtual network link to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param parameters [VirtualNetworkLink] Parameters supplied to the Update + # operation. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always overwrite the current virtual network + # link. Specify the last-seen ETag value to prevent accidentally overwriting + # any concurrent changes. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def begin_update_async(resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, 'virtual_network_link_name is nil' if virtual_network_link_name.nil? + fail ArgumentError, 'parameters is nil' if parameters.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['If-Match'] = if_match unless if_match.nil? + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::VirtualNetworkLink.mapper() + request_content = @client.serialize(request_mapper, parameters) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'virtualNetworkLinkName' => virtual_network_link_name,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:patch, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 || status_code == 202 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::VirtualNetworkLink.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Deletes a virtual network link to the specified Private DNS zone. WARNING: In + # case of a registration virtual network, all auto-registered DNS records in + # the zone for the virtual network will also be deleted. This operation cannot + # be undone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always delete the current zone. Specify the + # last-seen ETag value to prevent accidentally deleting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # + def begin_delete(resource_group_name, private_zone_name, virtual_network_link_name, if_match = nil, custom_headers = nil) + response = begin_delete_async(resource_group_name, private_zone_name, virtual_network_link_name, if_match, custom_headers).value! + nil + end + + # + # Deletes a virtual network link to the specified Private DNS zone. WARNING: In + # case of a registration virtual network, all auto-registered DNS records in + # the zone for the virtual network will also be deleted. This operation cannot + # be undone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always delete the current zone. Specify the + # last-seen ETag value to prevent accidentally deleting any concurrent changes. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def begin_delete_with_http_info(resource_group_name, private_zone_name, virtual_network_link_name, if_match = nil, custom_headers = nil) + begin_delete_async(resource_group_name, private_zone_name, virtual_network_link_name, if_match, custom_headers).value! + end + + # + # Deletes a virtual network link to the specified Private DNS zone. WARNING: In + # case of a registration virtual network, all auto-registered DNS records in + # the zone for the virtual network will also be deleted. This operation cannot + # be undone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param virtual_network_link_name [String] The name of the virtual network + # link. + # @param if_match [String] The ETag of the virtual network link to the Private + # DNS zone. Omit this value to always delete the current zone. Specify the + # last-seen ETag value to prevent accidentally deleting any concurrent changes. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def begin_delete_async(resource_group_name, private_zone_name, virtual_network_link_name, if_match = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'private_zone_name is nil' if private_zone_name.nil? + fail ArgumentError, 'virtual_network_link_name is nil' if virtual_network_link_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['If-Match'] = if_match unless if_match.nil? + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'privateZoneName' => private_zone_name,'virtualNetworkLinkName' => virtual_network_link_name,'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:delete, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 || status_code == 202 || status_code == 204 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + + result + end + + promise.execute + end + + # + # Lists the virtual network links to the specified Private DNS zone. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [VirtualNetworkLinkListResult] operation results. + # + def list_next(next_page_link, custom_headers = nil) + response = list_next_async(next_page_link, custom_headers).value! + response.body unless response.nil? + end + + # + # Lists the virtual network links to the specified Private DNS zone. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_next_with_http_info(next_page_link, custom_headers = nil) + list_next_async(next_page_link, custom_headers).value! + end + + # + # Lists the virtual network links to the specified Private DNS zone. + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_next_async(next_page_link, custom_headers = nil) + fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = '{nextLink}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + skip_encoding_path_params: {'nextLink' => next_page_link}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::PrivateDns::Mgmt::V2018_09_01::Models::VirtualNetworkLinkListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Lists the virtual network links to the specified Private DNS zone. + # + # @param resource_group_name [String] The name of the resource group. + # @param private_zone_name [String] The name of the Private DNS zone (without a + # terminating dot). + # @param top [Integer] The maximum number of virtual network links to return. + # If not specified, returns up to 100 virtual network links. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [VirtualNetworkLinkListResult] which provide lazy access to pages of + # the response. + # + def list_as_lazy(resource_group_name, private_zone_name, top = nil, custom_headers = nil) + response = list_async(resource_group_name, private_zone_name, top, custom_headers).value! + unless response.nil? + page = response.body + page.next_method = Proc.new do |next_page_link| + list_next_async(next_page_link, custom_headers) + end + page + end + end + + end +end