Class: Azure::Compute::Mgmt::V2020_09_30_preview::GallerySharingProfile
- Inherits:
-
Object
- Object
- Azure::Compute::Mgmt::V2020_09_30_preview::GallerySharingProfile
- Includes:
- MsRestAzure
- Defined in:
- lib/2020-09-30-preview/generated/azure_mgmt_compute/gallery_sharing_profile.rb
Overview
GallerySharingProfile
Instance Attribute Summary collapse
-
#client ⇒ ComputeManagementClient
readonly
Reference to the ComputeManagementClient.
Instance Method Summary collapse
-
#begin_update(resource_group_name, gallery_name, sharing_update, custom_headers: nil) ⇒ SharingUpdate
Update sharing profile of a gallery.
-
#begin_update_async(resource_group_name, gallery_name, sharing_update, custom_headers: nil) ⇒ Concurrent::Promise
Update sharing profile of a gallery.
-
#begin_update_with_http_info(resource_group_name, gallery_name, sharing_update, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Update sharing profile of a gallery.
-
#initialize(client) ⇒ GallerySharingProfile
constructor
Creates and initializes a new instance of the GallerySharingProfile class.
-
#update(resource_group_name, gallery_name, sharing_update, custom_headers: nil) ⇒ SharingUpdate
Update sharing profile of a gallery.
-
#update_async(resource_group_name, gallery_name, sharing_update, custom_headers: nil) ⇒ Concurrent::Promise
gallery sharing profile.
Constructor Details
#initialize(client) ⇒ GallerySharingProfile
Creates and initializes a new instance of the GallerySharingProfile class.
17 18 19 |
# File 'lib/2020-09-30-preview/generated/azure_mgmt_compute/gallery_sharing_profile.rb', line 17 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ ComputeManagementClient (readonly)
Returns reference to the ComputeManagementClient.
22 23 24 |
# File 'lib/2020-09-30-preview/generated/azure_mgmt_compute/gallery_sharing_profile.rb', line 22 def client @client end |
Instance Method Details
#begin_update(resource_group_name, gallery_name, sharing_update, custom_headers: nil) ⇒ SharingUpdate
Update sharing profile of a gallery.
gallery sharing profile. will be added to the HTTP request.
82 83 84 85 |
# File 'lib/2020-09-30-preview/generated/azure_mgmt_compute/gallery_sharing_profile.rb', line 82 def begin_update(resource_group_name, gallery_name, sharing_update, custom_headers:nil) response = begin_update_async(resource_group_name, gallery_name, sharing_update, custom_headers:custom_headers).value! response.body unless response.nil? end |
#begin_update_async(resource_group_name, gallery_name, sharing_update, custom_headers: nil) ⇒ Concurrent::Promise
Update sharing profile of a gallery.
gallery sharing profile. to the HTTP request.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/2020-09-30-preview/generated/azure_mgmt_compute/gallery_sharing_profile.rb', line 115 def begin_update_async(resource_group_name, gallery_name, sharing_update, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'gallery_name is nil' if gallery_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'sharing_update is nil' if sharing_update.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::Compute::Mgmt::V2020_09_30_preview::Models::SharingUpdate.mapper() request_content = @client.serialize(request_mapper, sharing_update) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'galleryName' => gallery_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(:post, path_template, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::Compute::Mgmt::V2020_09_30_preview::Models::SharingUpdate.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end # Deserialize Response if status_code == 202 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::Compute::Mgmt::V2020_09_30_preview::Models::SharingUpdate.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#begin_update_with_http_info(resource_group_name, gallery_name, sharing_update, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Update sharing profile of a gallery.
gallery sharing profile. will be added to the HTTP request.
99 100 101 |
# File 'lib/2020-09-30-preview/generated/azure_mgmt_compute/gallery_sharing_profile.rb', line 99 def begin_update_with_http_info(resource_group_name, gallery_name, sharing_update, custom_headers:nil) begin_update_async(resource_group_name, gallery_name, sharing_update, custom_headers:custom_headers).value! end |
#update(resource_group_name, gallery_name, sharing_update, custom_headers: nil) ⇒ SharingUpdate
Update sharing profile of a gallery.
gallery sharing profile. will be added to the HTTP request.
36 37 38 39 |
# File 'lib/2020-09-30-preview/generated/azure_mgmt_compute/gallery_sharing_profile.rb', line 36 def update(resource_group_name, gallery_name, sharing_update, custom_headers:nil) response = update_async(resource_group_name, gallery_name, sharing_update, custom_headers:custom_headers).value! response.body unless response.nil? end |
#update_async(resource_group_name, gallery_name, sharing_update, custom_headers: nil) ⇒ Concurrent::Promise
gallery sharing profile. will be added to the HTTP request.
response.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/2020-09-30-preview/generated/azure_mgmt_compute/gallery_sharing_profile.rb', line 52 def update_async(resource_group_name, gallery_name, sharing_update, custom_headers:nil) # Send request promise = begin_update_async(resource_group_name, gallery_name, sharing_update, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::Compute::Mgmt::V2020_09_30_preview::Models::SharingUpdate.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 |