Class: Azure::Batch::Mgmt::V2019_08_01::CertificateOperations

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb

Overview

CertificateOperations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ CertificateOperations

Creates and initializes a new instance of the CertificateOperations class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientBatchManagementClient (readonly)

Returns reference to the BatchManagementClient.

Returns:



22
23
24
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create(resource_group_name, account_name, certificate_name, parameters, if_match: nil, if_none_match: nil, custom_headers: nil) ⇒ Certificate

Creates a new certificate inside the specified account.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. for certificate creation. to update. A value of “*” can be used to apply the operation only if the certificate already exists. If omitted, this operation will always be applied. created, but to prevent updating an existing certificate. Other values will be ignored. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

  • parameters (CertificateCreateOrUpdateParameters)

    Additional parameters

  • if_match (String) (defaults to: nil)

    The entity state (ETag) version of the certificate

  • if_none_match (String) (defaults to: nil)

    Set to ‘*’ to allow a new certificate to be

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

    A hash of custom headers that

Returns:

  • (Certificate)

    operation results.



672
673
674
675
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 672

def begin_create(resource_group_name, , certificate_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
  response = begin_create_async(resource_group_name, , certificate_name, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_async(resource_group_name, account_name, certificate_name, parameters, if_match: nil, if_none_match: nil, custom_headers: nil) ⇒ Concurrent::Promise

Creates a new certificate inside the specified account.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. for certificate creation. to update. A value of “*” can be used to apply the operation only if the certificate already exists. If omitted, this operation will always be applied. created, but to prevent updating an existing certificate. Other values will be ignored. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

  • parameters (CertificateCreateOrUpdateParameters)

    Additional parameters

  • if_match (String) (defaults to: nil)

    The entity state (ETag) version of the certificate

  • if_none_match (String) (defaults to: nil)

    Set to ‘*’ to allow a new certificate to be

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 727

def begin_create_async(resource_group_name, , certificate_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, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !.nil? && .length > 24
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !.nil? && .match(Regexp.new('^^[-\w\._]+$$')).nil?
  fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MaxLength': '45'" if !certificate_name.nil? && certificate_name.length > 45
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MinLength': '5'" if !certificate_name.nil? && certificate_name.length < 5
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[\w]+-[\w]+$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[\w]+-[\w]+$$')).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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?

  # Serialize Request
  request_mapper = Azure::Batch::Mgmt::V2019_08_01::Models::CertificateCreateOrUpdateParameters.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.Batch/batchAccounts/{accountName}/certificates/{certificateName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'certificateName' => certificate_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 == 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?
    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::Batch::Mgmt::V2019_08_01::Models::Certificate.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, account_name, certificate_name, parameters, if_match: nil, if_none_match: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates a new certificate inside the specified account.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. for certificate creation. to update. A value of “*” can be used to apply the operation only if the certificate already exists. If omitted, this operation will always be applied. created, but to prevent updating an existing certificate. Other values will be ignored. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

  • parameters (CertificateCreateOrUpdateParameters)

    Additional parameters

  • if_match (String) (defaults to: nil)

    The entity state (ETag) version of the certificate

  • if_none_match (String) (defaults to: nil)

    Set to ‘*’ to allow a new certificate to be

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



700
701
702
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 700

def begin_create_with_http_info(resource_group_name, , certificate_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
  begin_create_async(resource_group_name, , certificate_name, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value!
end

#begin_delete(resource_group_name, account_name, certificate_name, custom_headers: nil) ⇒ Object

Deletes the specified certificate.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

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

    A hash of custom headers that



812
813
814
815
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 812

def begin_delete(resource_group_name, , certificate_name, custom_headers:nil)
  response = begin_delete_async(resource_group_name, , certificate_name, custom_headers:custom_headers).value!
  nil
end

#begin_delete_async(resource_group_name, account_name, certificate_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes the specified certificate.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 849

def begin_delete_async(resource_group_name, , certificate_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !.nil? && .length > 24
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !.nil? && .match(Regexp.new('^^[-\w\._]+$$')).nil?
  fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MaxLength': '45'" if !certificate_name.nil? && certificate_name.length > 45
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MinLength': '5'" if !certificate_name.nil? && certificate_name.length < 5
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[\w]+-[\w]+$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[\w]+-[\w]+$$')).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 = {}
  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?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'certificateName' => certificate_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 == 204 || 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?

    result
  end

  promise.execute
end

#begin_delete_with_http_info(resource_group_name, account_name, certificate_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes the specified certificate.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



831
832
833
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 831

def begin_delete_with_http_info(resource_group_name, , certificate_name, custom_headers:nil)
  begin_delete_async(resource_group_name, , certificate_name, custom_headers:custom_headers).value!
end

#cancel_deletion(resource_group_name, account_name, certificate_name, custom_headers: nil) ⇒ Certificate

Cancels a failed deletion of a certificate from the specified account.

If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

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

    A hash of custom headers that

Returns:

  • (Certificate)

    operation results.



534
535
536
537
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 534

def cancel_deletion(resource_group_name, , certificate_name, custom_headers:nil)
  response = cancel_deletion_async(resource_group_name, , certificate_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#cancel_deletion_async(resource_group_name, account_name, certificate_name, custom_headers: nil) ⇒ Concurrent::Promise

Cancels a failed deletion of a certificate from the specified account.

If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 587

def cancel_deletion_async(resource_group_name, , certificate_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !.nil? && .length > 24
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !.nil? && .match(Regexp.new('^^[-\w\._]+$$')).nil?
  fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MaxLength': '45'" if !certificate_name.nil? && certificate_name.length > 45
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MinLength': '5'" if !certificate_name.nil? && certificate_name.length < 5
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[\w]+-[\w]+$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[\w]+-[\w]+$$')).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 = {}
  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?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'certificateName' => certificate_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(: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
      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::Batch::Mgmt::V2019_08_01::Models::Certificate.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

#cancel_deletion_with_http_info(resource_group_name, account_name, certificate_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Cancels a failed deletion of a certificate from the specified account.

If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



561
562
563
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 561

def cancel_deletion_with_http_info(resource_group_name, , certificate_name, custom_headers:nil)
  cancel_deletion_async(resource_group_name, , certificate_name, custom_headers:custom_headers).value!
end

#create(resource_group_name, account_name, certificate_name, parameters, if_match: nil, if_none_match: nil, custom_headers: nil) ⇒ Certificate

Creates a new certificate inside the specified account.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. for certificate creation. to update. A value of “*” can be used to apply the operation only if the certificate already exists. If omitted, this operation will always be applied. created, but to prevent updating an existing certificate. Other values will be ignored. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

  • parameters (CertificateCreateOrUpdateParameters)

    Additional parameters

  • if_match (String) (defaults to: nil)

    The entity state (ETag) version of the certificate

  • if_none_match (String) (defaults to: nil)

    Set to ‘*’ to allow a new certificate to be

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

    A hash of custom headers that

Returns:

  • (Certificate)

    operation results.



171
172
173
174
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 171

def create(resource_group_name, , certificate_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
  response = create_async(resource_group_name, , certificate_name, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_async(resource_group_name, account_name, certificate_name, parameters, if_match: nil, if_none_match: nil, custom_headers: nil) ⇒ Concurrent::Promise

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. for certificate creation. to update. A value of “*” can be used to apply the operation only if the certificate already exists. If omitted, this operation will always be applied. created, but to prevent updating an existing certificate. Other values will be ignored. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

  • parameters (CertificateCreateOrUpdateParameters)

    Additional parameters

  • if_match (String) (defaults to: nil)

    The entity state (ETag) version of the certificate

  • if_none_match (String) (defaults to: nil)

    Set to ‘*’ to allow a new certificate to be

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 198

def create_async(resource_group_name, , certificate_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
  # Send request
  promise = begin_create_async(resource_group_name, , certificate_name, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Batch::Mgmt::V2019_08_01::Models::Certificate.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, account_name, certificate_name, custom_headers: nil) ⇒ Object

Deletes the specified certificate.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

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

    A hash of custom headers that



365
366
367
368
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 365

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

#delete_async(resource_group_name, account_name, certificate_name, custom_headers: nil) ⇒ Concurrent::Promise

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 383

def delete_async(resource_group_name, , certificate_name, custom_headers:nil)
  # Send request
  promise = begin_delete_async(resource_group_name, , certificate_name, custom_headers: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

#get(resource_group_name, account_name, certificate_name, custom_headers: nil) ⇒ Certificate

Gets information about the specified certificate.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

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

    A hash of custom headers that

Returns:

  • (Certificate)

    operation results.



413
414
415
416
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 413

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

#get_async(resource_group_name, account_name, certificate_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets information about the specified certificate.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



450
451
452
453
454
455
456
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
509
510
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 450

def get_async(resource_group_name, , certificate_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !.nil? && .length > 24
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !.nil? && .match(Regexp.new('^^[-\w\._]+$$')).nil?
  fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MaxLength': '45'" if !certificate_name.nil? && certificate_name.length > 45
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MinLength': '5'" if !certificate_name.nil? && certificate_name.length < 5
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[\w]+-[\w]+$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[\w]+-[\w]+$$')).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 = {}
  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?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'certificateName' => certificate_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?
    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::Batch::Mgmt::V2019_08_01::Models::Certificate.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_with_http_info(resource_group_name, account_name, certificate_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets information about the specified certificate.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



432
433
434
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 432

def get_with_http_info(resource_group_name, , certificate_name, custom_headers:nil)
  get_async(resource_group_name, , certificate_name, custom_headers:custom_headers).value!
end

#list_by_batch_account(resource_group_name, account_name, maxresults: nil, select: nil, filter: nil, custom_headers: nil) ⇒ Array<Certificate>

Lists all of the certificates in the specified account.

contains the Batch account. response. returned. e.g. “properties/provisioningState”. Only top level properties under properties/ are valid for selection. filtering are “properties/provisioningState”, “properties/provisioningStateTransitionTime”, “name”. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • maxresults (Integer) (defaults to: nil)

    The maximum number of items to return in the

  • select (String) (defaults to: nil)

    Comma separated list of properties that should be

  • filter (String) (defaults to: nil)

    OData filter expression. Valid properties for

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

    A hash of custom headers that

Returns:

  • (Array<Certificate>)

    operation results.



43
44
45
46
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 43

def (resource_group_name, , maxresults:nil, select:nil, filter:nil, custom_headers:nil)
  first_page = (resource_group_name, , maxresults:maxresults, select:select, filter:filter, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_batch_account_as_lazy(resource_group_name, account_name, maxresults: nil, select: nil, filter: nil, custom_headers: nil) ⇒ ListCertificatesResult

Lists all of the certificates in the specified account.

contains the Batch account. response. returned. e.g. “properties/provisioningState”. Only top level properties under properties/ are valid for selection. filtering are “properties/provisioningState”, “properties/provisioningStateTransitionTime”, “name”. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • maxresults (Integer) (defaults to: nil)

    The maximum number of items to return in the

  • select (String) (defaults to: nil)

    Comma separated list of properties that should be

  • filter (String) (defaults to: nil)

    OData filter expression. Valid properties for

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

    A hash of custom headers that

Returns:

  • (ListCertificatesResult)

    which provide lazy access to pages of the



1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 1011

def (resource_group_name, , maxresults:nil, select:nil, filter:nil, custom_headers:nil)
  response = (resource_group_name, , maxresults:maxresults, select:select, filter:filter, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      (next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_batch_account_async(resource_group_name, account_name, maxresults: nil, select: nil, filter: nil, custom_headers: nil) ⇒ Concurrent::Promise

Lists all of the certificates in the specified account.

contains the Batch account. response. returned. e.g. “properties/provisioningState”. Only top level properties under properties/ are valid for selection. filtering are “properties/provisioningState”, “properties/provisioningStateTransitionTime”, “name”. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • maxresults (Integer) (defaults to: nil)

    The maximum number of items to return in the

  • select (String) (defaults to: nil)

    Comma separated list of properties that should be

  • filter (String) (defaults to: nil)

    OData filter expression. Valid properties for

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 90

def (resource_group_name, , maxresults:nil, select:nil, filter:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !.nil? && .length > 24
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !.nil? && .match(Regexp.new('^^[-\w\._]+$$')).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 = {}
  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?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'subscriptionId' => @client.subscription_id},
      query_params: {'maxresults' => maxresults,'$select' => select,'$filter' => filter,'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?
    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::Batch::Mgmt::V2019_08_01::Models::ListCertificatesResult.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_by_batch_account_next(next_page_link, custom_headers: nil) ⇒ ListCertificatesResult

Lists all of the certificates in the specified account.

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:

  • (ListCertificatesResult)

    operation results.



911
912
913
914
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 911

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

#list_by_batch_account_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Lists all of the certificates in the specified account.

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.



940
941
942
943
944
945
946
947
948
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
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 940

def (next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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?
  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?
    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::Batch::Mgmt::V2019_08_01::Models::ListCertificatesResult.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_by_batch_account_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all of the certificates in the specified account.

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.



926
927
928
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 926

def (next_page_link, custom_headers:nil)
  (next_page_link, custom_headers:custom_headers).value!
end

#list_by_batch_account_with_http_info(resource_group_name, account_name, maxresults: nil, select: nil, filter: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all of the certificates in the specified account.

contains the Batch account. response. returned. e.g. “properties/provisioningState”. Only top level properties under properties/ are valid for selection. filtering are “properties/provisioningState”, “properties/provisioningStateTransitionTime”, “name”. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • maxresults (Integer) (defaults to: nil)

    The maximum number of items to return in the

  • select (String) (defaults to: nil)

    Comma separated list of properties that should be

  • filter (String) (defaults to: nil)

    OData filter expression. Valid properties for

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



67
68
69
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 67

def (resource_group_name, , maxresults:nil, select:nil, filter:nil, custom_headers:nil)
  (resource_group_name, , maxresults:maxresults, select:select, filter:filter, custom_headers:custom_headers).value!
end

#update(resource_group_name, account_name, certificate_name, parameters, if_match: nil, custom_headers: nil) ⇒ Certificate

Updates the properties of an existing certificate.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. update. to update. This value can be omitted or set to “*” to apply the operation unconditionally. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

  • parameters (CertificateCreateOrUpdateParameters)

    Certificate entity to

  • if_match (String) (defaults to: nil)

    The entity state (ETag) version of the certificate

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

    A hash of custom headers that

Returns:

  • (Certificate)

    operation results.



235
236
237
238
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 235

def update(resource_group_name, , certificate_name, parameters, if_match:nil, custom_headers:nil)
  response = update_async(resource_group_name, , certificate_name, parameters, if_match:if_match, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_async(resource_group_name, account_name, certificate_name, parameters, if_match: nil, custom_headers: nil) ⇒ Concurrent::Promise

Updates the properties of an existing certificate.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. update. to update. This value can be omitted or set to “*” to apply the operation unconditionally. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

  • parameters (CertificateCreateOrUpdateParameters)

    Certificate entity to

  • if_match (String) (defaults to: nil)

    The entity state (ETag) version of the certificate

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 282

def update_async(resource_group_name, , certificate_name, parameters, if_match:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !.nil? && .length > 24
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !.nil? && .match(Regexp.new('^^[-\w\._]+$$')).nil?
  fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MaxLength': '45'" if !certificate_name.nil? && certificate_name.length > 45
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MinLength': '5'" if !certificate_name.nil? && certificate_name.length < 5
  fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[\w]+-[\w]+$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[\w]+-[\w]+$$')).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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?

  # Serialize Request
  request_mapper = Azure::Batch::Mgmt::V2019_08_01::Models::CertificateCreateOrUpdateParameters.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.Batch/batchAccounts/{accountName}/certificates/{certificateName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'certificateName' => certificate_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
      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::Batch::Mgmt::V2019_08_01::Models::Certificate.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

#update_with_http_info(resource_group_name, account_name, certificate_name, parameters, if_match: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Updates the properties of an existing certificate.

contains the Batch account. must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. update. to update. This value can be omitted or set to “*” to apply the operation unconditionally. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • account_name (String)

    The name of the Batch account.

  • certificate_name (String)

    The identifier for the certificate. This

  • parameters (CertificateCreateOrUpdateParameters)

    Certificate entity to

  • if_match (String) (defaults to: nil)

    The entity state (ETag) version of the certificate

  • 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/2019-08-01/generated/azure_mgmt_batch/certificate_operations.rb', line 259

def update_with_http_info(resource_group_name, , certificate_name, parameters, if_match:nil, custom_headers:nil)
  update_async(resource_group_name, , certificate_name, parameters, if_match:if_match, custom_headers:custom_headers).value!
end