Class: Azure::ServerManagement::Mgmt::V2016_07_01_preview::Gateway

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb

Overview

REST API for Azure Server Management Service.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Gateway

Creates and initializes a new instance of the Gateway class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientServerManagement (readonly)

Returns reference to the ServerManagement.

Returns:



22
23
24
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil) ⇒ GatewayResource

Creates or updates a ManagementService gateway.

identifies the resource group within the user subscriptionId. flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: ‘Manual’, ‘Automatic’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • location (String) (defaults to: nil)

    Location of the resource.

  • tags (defaults to: nil)

    Resource tags.

  • upgrade_mode (UpgradeMode) (defaults to: nil)

    The upgradeMode property gives the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (GatewayResource)

    operation results.



651
652
653
654
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 651

def begin_create(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil)
  response = begin_create_async(resource_group_name, gateway_name, location, tags, upgrade_mode, custom_headers).value!
  response.body unless response.nil?
end

#begin_create_async(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil) ⇒ Concurrent::Promise

Creates or updates a ManagementService gateway.

identifies the resource group within the user subscriptionId. flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: ‘Manual’, ‘Automatic’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • location (String) (defaults to: nil)

    Location of the resource.

  • tags (defaults to: nil)

    Resource tags.

  • upgrade_mode (UpgradeMode) (defaults to: nil)

    The upgradeMode property gives the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 694

def begin_create_async(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'gateway_name is nil' if gateway_name.nil?
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MaxLength': '256'" if !gateway_name.nil? && gateway_name.length > 256
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MinLength': '1'" if !gateway_name.nil? && gateway_name.length < 1
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !gateway_name.nil? && gateway_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?

  gateway_parameters = GatewayParameters.new
  unless location.nil? && tags.nil? && upgrade_mode.nil?
    gateway_parameters.location = location
    gateway_parameters.tags = tags
    gateway_parameters.upgrade_mode = upgrade_mode
  end

  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?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayParameters.mapper()
  request_content = @client.serialize(request_mapper,  gateway_parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'gatewayName' => gateway_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 == 200 || status_code == 201
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayResource.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 == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayResource.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

#begin_create_with_http_info(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a ManagementService gateway.

identifies the resource group within the user subscriptionId. flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: ‘Manual’, ‘Automatic’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • location (String) (defaults to: nil)

    Location of the resource.

  • tags (defaults to: nil)

    Resource tags.

  • upgrade_mode (UpgradeMode) (defaults to: nil)

    The upgradeMode property gives the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



673
674
675
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 673

def begin_create_with_http_info(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil)
  begin_create_async(resource_group_name, gateway_name, location, tags, upgrade_mode, custom_headers).value!
end

#begin_get_profile(resource_group_name, gateway_name, custom_headers = nil) ⇒ GatewayProfile

Gets a gateway profile.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (GatewayProfile)

    operation results.



1095
1096
1097
1098
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1095

def begin_get_profile(resource_group_name, gateway_name, custom_headers = nil)
  response = begin_get_profile_async(resource_group_name, gateway_name, custom_headers).value!
  response.body unless response.nil?
end

#begin_get_profile_async(resource_group_name, gateway_name, custom_headers = nil) ⇒ Concurrent::Promise

Gets a gateway profile.

identifies the resource group within the user subscriptionId. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1126

def begin_get_profile_async(resource_group_name, gateway_name, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'gateway_name is nil' if gateway_name.nil?
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MaxLength': '256'" if !gateway_name.nil? && gateway_name.length > 256
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MinLength': '1'" if !gateway_name.nil? && gateway_name.length < 1
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !gateway_name.nil? && gateway_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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.ServerManagement/gateways/{gatewayName}/profile'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'gatewayName' => gateway_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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 MsRest::HttpOperationError.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::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayProfile.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

#begin_get_profile_with_http_info(resource_group_name, gateway_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a gateway profile.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1111
1112
1113
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1111

def begin_get_profile_with_http_info(resource_group_name, gateway_name, custom_headers = nil)
  begin_get_profile_async(resource_group_name, gateway_name, custom_headers).value!
end

#begin_regenerate_profile(resource_group_name, gateway_name, custom_headers = nil) ⇒ Object

Regenerate a gateway’s profile

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



1006
1007
1008
1009
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1006

def begin_regenerate_profile(resource_group_name, gateway_name, custom_headers = nil)
  response = begin_regenerate_profile_async(resource_group_name, gateway_name, custom_headers).value!
  nil
end

#begin_regenerate_profile_async(resource_group_name, gateway_name, custom_headers = nil) ⇒ Concurrent::Promise

Regenerate a gateway’s profile

identifies the resource group within the user subscriptionId. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1037

def begin_regenerate_profile_async(resource_group_name, gateway_name, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'gateway_name is nil' if gateway_name.nil?
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MaxLength': '256'" if !gateway_name.nil? && gateway_name.length > 256
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MinLength': '1'" if !gateway_name.nil? && gateway_name.length < 1
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !gateway_name.nil? && gateway_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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.ServerManagement/gateways/{gatewayName}/regenerateprofile'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'gatewayName' => gateway_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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 MsRest::HttpOperationError.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

#begin_regenerate_profile_with_http_info(resource_group_name, gateway_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Regenerate a gateway’s profile

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1022
1023
1024
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1022

def begin_regenerate_profile_with_http_info(resource_group_name, gateway_name, custom_headers = nil)
  begin_regenerate_profile_async(resource_group_name, gateway_name, custom_headers).value!
end

#begin_update(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil) ⇒ GatewayResource

Updates a gateway belonging to a resource group.

identifies the resource group within the user subscriptionId. flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: ‘Manual’, ‘Automatic’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • location (String) (defaults to: nil)

    Location of the resource.

  • tags (defaults to: nil)

    Resource tags.

  • upgrade_mode (UpgradeMode) (defaults to: nil)

    The upgradeMode property gives the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (GatewayResource)

    operation results.



793
794
795
796
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 793

def begin_update(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil)
  response = begin_update_async(resource_group_name, gateway_name, location, tags, upgrade_mode, custom_headers).value!
  response.body unless response.nil?
end

#begin_update_async(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil) ⇒ Concurrent::Promise

Updates a gateway belonging to a resource group.

identifies the resource group within the user subscriptionId. flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: ‘Manual’, ‘Automatic’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • location (String) (defaults to: nil)

    Location of the resource.

  • tags (defaults to: nil)

    Resource tags.

  • upgrade_mode (UpgradeMode) (defaults to: nil)

    The upgradeMode property gives the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 836

def begin_update_async(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'gateway_name is nil' if gateway_name.nil?
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MaxLength': '256'" if !gateway_name.nil? && gateway_name.length > 256
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MinLength': '1'" if !gateway_name.nil? && gateway_name.length < 1
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !gateway_name.nil? && gateway_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?

  gateway_parameters = GatewayParameters.new
  unless location.nil? && tags.nil? && upgrade_mode.nil?
    gateway_parameters.location = location
    gateway_parameters.tags = tags
    gateway_parameters.upgrade_mode = upgrade_mode
  end

  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?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayParameters.mapper()
  request_content = @client.serialize(request_mapper,  gateway_parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'gatewayName' => gateway_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 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayResource.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

#begin_update_with_http_info(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Updates a gateway belonging to a resource group.

identifies the resource group within the user subscriptionId. flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: ‘Manual’, ‘Automatic’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • location (String) (defaults to: nil)

    Location of the resource.

  • tags (defaults to: nil)

    Resource tags.

  • upgrade_mode (UpgradeMode) (defaults to: nil)

    The upgradeMode property gives the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



815
816
817
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 815

def begin_update_with_http_info(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil)
  begin_update_async(resource_group_name, gateway_name, location, tags, upgrade_mode, custom_headers).value!
end

#begin_upgrade(resource_group_name, gateway_name, custom_headers = nil) ⇒ Object

Upgrades a gateway.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



918
919
920
921
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 918

def begin_upgrade(resource_group_name, gateway_name, custom_headers = nil)
  response = begin_upgrade_async(resource_group_name, gateway_name, custom_headers).value!
  nil
end

#begin_upgrade_async(resource_group_name, gateway_name, custom_headers = nil) ⇒ Concurrent::Promise

Upgrades a gateway.

identifies the resource group within the user subscriptionId. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 949

def begin_upgrade_async(resource_group_name, gateway_name, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'gateway_name is nil' if gateway_name.nil?
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MaxLength': '256'" if !gateway_name.nil? && gateway_name.length > 256
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MinLength': '1'" if !gateway_name.nil? && gateway_name.length < 1
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !gateway_name.nil? && gateway_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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.ServerManagement/gateways/{gatewayName}/upgradetolatest'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'gatewayName' => gateway_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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 MsRest::HttpOperationError.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

#begin_upgrade_with_http_info(resource_group_name, gateway_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Upgrades a gateway.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



934
935
936
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 934

def begin_upgrade_with_http_info(resource_group_name, gateway_name, custom_headers = nil)
  begin_upgrade_async(resource_group_name, gateway_name, custom_headers).value!
end

#create(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil) ⇒ GatewayResource

Creates or updates a ManagementService gateway.

identifies the resource group within the user subscriptionId. flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: ‘Manual’, ‘Automatic’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • location (String) (defaults to: nil)

    Location of the resource.

  • tags (defaults to: nil)

    Resource tags.

  • upgrade_mode (UpgradeMode) (defaults to: nil)

    The upgradeMode property gives the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (GatewayResource)

    operation results.



41
42
43
44
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 41

def create(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil)
  response = create_async(resource_group_name, gateway_name, location, tags, upgrade_mode, custom_headers).value!
  response.body unless response.nil?
end

#create_async(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil) ⇒ Concurrent::Promise

identifies the resource group within the user subscriptionId. flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: ‘Manual’, ‘Automatic’ will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • location (String) (defaults to: nil)

    Location of the resource.

  • tags (defaults to: nil)

    Resource tags.

  • upgrade_mode (UpgradeMode) (defaults to: nil)

    The upgradeMode property gives the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 62

def create_async(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil)
  # Send request
  promise = begin_create_async(resource_group_name, gateway_name, location, tags, upgrade_mode, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayResource.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

#delete(resource_group_name, gateway_name, custom_headers = nil) ⇒ Object

Deletes a gateway from a resource group.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



146
147
148
149
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 146

def delete(resource_group_name, gateway_name, custom_headers = nil)
  response = delete_async(resource_group_name, gateway_name, custom_headers).value!
  nil
end

#delete_async(resource_group_name, gateway_name, custom_headers = nil) ⇒ Concurrent::Promise

Deletes a gateway from a resource group.

identifies the resource group within the user subscriptionId. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 177

def delete_async(resource_group_name, gateway_name, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'gateway_name is nil' if gateway_name.nil?
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MaxLength': '256'" if !gateway_name.nil? && gateway_name.length > 256
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MinLength': '1'" if !gateway_name.nil? && gateway_name.length < 1
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !gateway_name.nil? && gateway_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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.ServerManagement/gateways/{gatewayName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'gatewayName' => gateway_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 MsRest::HttpOperationError.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

#delete_with_http_info(resource_group_name, gateway_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a gateway from a resource group.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



162
163
164
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 162

def delete_with_http_info(resource_group_name, gateway_name, custom_headers = nil)
  delete_async(resource_group_name, gateway_name, custom_headers).value!
end

#get(resource_group_name, gateway_name, expand = nil, custom_headers = nil) ⇒ GatewayResource

Gets a gateway.

identifies the resource group within the user subscriptionId. uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Possible values include: ‘status’, ‘download’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum)

  • expand (GatewayExpandOption) (defaults to: nil)

    Gets subscription credentials which

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (GatewayResource)

    operation results.



239
240
241
242
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 239

def get(resource_group_name, gateway_name, expand = nil, custom_headers = nil)
  response = get_async(resource_group_name, gateway_name, expand, custom_headers).value!
  response.body unless response.nil?
end

#get_async(resource_group_name, gateway_name, expand = nil, custom_headers = nil) ⇒ Concurrent::Promise

Gets a gateway.

identifies the resource group within the user subscriptionId. uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Possible values include: ‘status’, ‘download’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum)

  • expand (GatewayExpandOption) (defaults to: nil)

    Gets subscription credentials which

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 278

def get_async(resource_group_name, gateway_name, expand = nil, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'gateway_name is nil' if gateway_name.nil?
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MaxLength': '256'" if !gateway_name.nil? && gateway_name.length > 256
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'MinLength': '1'" if !gateway_name.nil? && gateway_name.length < 1
  fail ArgumentError, "'gateway_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !gateway_name.nil? && gateway_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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.ServerManagement/gateways/{gatewayName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'gatewayName' => gateway_name},
      query_params: {'api-version' => @client.api_version,'$expand' => expand},
      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 MsRest::HttpOperationError.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::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayResource.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

#get_profile(resource_group_name, gateway_name, custom_headers = nil) ⇒ GatewayProfile

Gets a gateway profile.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (GatewayProfile)

    operation results.



601
602
603
604
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 601

def get_profile(resource_group_name, gateway_name, custom_headers = nil)
  response = get_profile_async(resource_group_name, gateway_name, custom_headers).value!
  response.body unless response.nil?
end

#get_profile_async(resource_group_name, gateway_name, custom_headers = nil) ⇒ Concurrent::Promise

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 616

def get_profile_async(resource_group_name, gateway_name, custom_headers = nil)
  # Send request
  promise = begin_get_profile_async(resource_group_name, gateway_name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayProfile.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

#get_with_http_info(resource_group_name, gateway_name, expand = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a gateway.

identifies the resource group within the user subscriptionId. uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Possible values include: ‘status’, ‘download’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum)

  • expand (GatewayExpandOption) (defaults to: nil)

    Gets subscription credentials which

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



259
260
261
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 259

def get_with_http_info(resource_group_name, gateway_name, expand = nil, custom_headers = nil)
  get_async(resource_group_name, gateway_name, expand, custom_headers).value!
end

#list(custom_headers = nil) ⇒ Array<GatewayResource>

Returns gateways in a subscription.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<GatewayResource>)

    operation results.



343
344
345
346
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 343

def list(custom_headers = nil)
  first_page = list_as_lazy(custom_headers)
  first_page.get_all_items
end

#list_as_lazy(custom_headers = nil) ⇒ GatewayResources

Returns gateways in a subscription.

will be added to the HTTP request.

response.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (GatewayResources)

    which provide lazy access to pages of the



1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1366

def list_as_lazy(custom_headers = nil)
  response = list_async(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

#list_async(custom_headers = nil) ⇒ Concurrent::Promise

Returns gateways in a subscription.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 368

def list_async(custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.ServerManagement/gateways'

  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: {'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 MsRest::HttpOperationError.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::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayResources.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

#list_for_resource_group(resource_group_name, custom_headers = nil) ⇒ Array<GatewayResource>

Returns gateways in a resource group.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<GatewayResource>)

    operation results.



428
429
430
431
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 428

def list_for_resource_group(resource_group_name, custom_headers = nil)
  first_page = list_for_resource_group_as_lazy(resource_group_name, custom_headers)
  first_page.get_all_items
end

#list_for_resource_group_as_lazy(resource_group_name, custom_headers = nil) ⇒ GatewayResources

Returns gateways in a resource group.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (GatewayResources)

    which provide lazy access to pages of the



1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1388

def list_for_resource_group_as_lazy(resource_group_name, custom_headers = nil)
  response = list_for_resource_group_async(resource_group_name, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_for_resource_group_next_async(next_page_link, custom_headers)
    end
    page
  end
end

#list_for_resource_group_async(resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Returns gateways in a resource group.

identifies the resource group within the user subscriptionId. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 457

def list_for_resource_group_async(resource_group_name, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).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.ServerManagement/gateways'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_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 MsRest::HttpOperationError.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::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayResources.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

#list_for_resource_group_next(next_page_link, custom_headers = nil) ⇒ GatewayResources

Returns gateways in a resource group.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (GatewayResources)

    operation results.



1280
1281
1282
1283
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1280

def list_for_resource_group_next(next_page_link, custom_headers = nil)
  response = list_for_resource_group_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

#list_for_resource_group_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

Returns gateways in a resource group.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1309

def list_for_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 MsRest::HttpOperationError.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::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayResources.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

#list_for_resource_group_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Returns gateways in a resource group.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1295
1296
1297
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1295

def list_for_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
  list_for_resource_group_next_async(next_page_link, custom_headers).value!
end

#list_for_resource_group_with_http_info(resource_group_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Returns gateways in a resource group.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



443
444
445
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 443

def list_for_resource_group_with_http_info(resource_group_name, custom_headers = nil)
  list_for_resource_group_async(resource_group_name, custom_headers).value!
end

#list_next(next_page_link, custom_headers = nil) ⇒ GatewayResources

Returns gateways in a subscription.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (GatewayResources)

    operation results.



1193
1194
1195
1196
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1193

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

#list_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

Returns gateways in a subscription.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1222

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 MsRest::HttpOperationError.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::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayResources.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

#list_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Returns gateways in a subscription.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1208
1209
1210
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 1208

def list_next_with_http_info(next_page_link, custom_headers = nil)
  list_next_async(next_page_link, custom_headers).value!
end

#list_with_http_info(custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Returns gateways in a subscription.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



356
357
358
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 356

def list_with_http_info(custom_headers = nil)
  list_async(custom_headers).value!
end

#regenerate_profile(resource_group_name, gateway_name, custom_headers = nil) ⇒ Object

Regenerate a gateway’s profile

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



559
560
561
562
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 559

def regenerate_profile(resource_group_name, gateway_name, custom_headers = nil)
  response = regenerate_profile_async(resource_group_name, gateway_name, custom_headers).value!
  nil
end

#regenerate_profile_async(resource_group_name, gateway_name, custom_headers = nil) ⇒ Concurrent::Promise

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 574

def regenerate_profile_async(resource_group_name, gateway_name, custom_headers = nil)
  # Send request
  promise = begin_regenerate_profile_async(resource_group_name, gateway_name, 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

#update(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil) ⇒ GatewayResource

Updates a gateway belonging to a resource group.

identifies the resource group within the user subscriptionId. flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: ‘Manual’, ‘Automatic’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • location (String) (defaults to: nil)

    Location of the resource.

  • tags (defaults to: nil)

    Resource tags.

  • upgrade_mode (UpgradeMode) (defaults to: nil)

    The upgradeMode property gives the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (GatewayResource)

    operation results.



97
98
99
100
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 97

def update(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil)
  response = update_async(resource_group_name, gateway_name, location, tags, upgrade_mode, custom_headers).value!
  response.body unless response.nil?
end

#update_async(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil) ⇒ Concurrent::Promise

identifies the resource group within the user subscriptionId. flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: ‘Manual’, ‘Automatic’ will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • location (String) (defaults to: nil)

    Location of the resource.

  • tags (defaults to: nil)

    Resource tags.

  • upgrade_mode (UpgradeMode) (defaults to: nil)

    The upgradeMode property gives the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 118

def update_async(resource_group_name, gateway_name, location = nil, tags = nil, upgrade_mode = nil, custom_headers = nil)
  # Send request
  promise = begin_update_async(resource_group_name, gateway_name, location, tags, upgrade_mode, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::GatewayResource.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

#upgrade(resource_group_name, gateway_name, custom_headers = nil) ⇒ Object

Upgrades a gateway.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



519
520
521
522
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 519

def upgrade(resource_group_name, gateway_name, custom_headers = nil)
  response = upgrade_async(resource_group_name, gateway_name, custom_headers).value!
  nil
end

#upgrade_async(resource_group_name, gateway_name, custom_headers = nil) ⇒ Concurrent::Promise

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • gateway_name (String)

    The gateway name (256 characters maximum).

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/gateway.rb', line 534

def upgrade_async(resource_group_name, gateway_name, custom_headers = nil)
  # Send request
  promise = begin_upgrade_async(resource_group_name, gateway_name, 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