Class: Azure::Batch::Mgmt::V2017_09_01::CertificateOperations

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2017-09-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/2017-09-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/2017-09-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.



664
665
666
667
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 664

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.



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
775
776
777
778
779
780
781
782
783
784
785
786
787
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 719

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::V2017_09_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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Batch::Mgmt::V2017_09_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.



692
693
694
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 692

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



802
803
804
805
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 802

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.



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
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 839

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
  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.



821
822
823
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 821

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.



528
529
530
531
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 528

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.



581
582
583
584
585
586
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
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 581

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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Batch::Mgmt::V2017_09_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.



555
556
557
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 555

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.



169
170
171
172
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 169

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



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 196

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::V2017_09_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



361
362
363
364
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 361

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



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 379

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.



409
410
411
412
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 409

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.



446
447
448
449
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
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 446

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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Batch::Mgmt::V2017_09_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.



428
429
430
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 428

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/2017-09-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



997
998
999
1000
1001
1002
1003
1004
1005
1006
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 997

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
# File 'lib/2017-09-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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Batch::Mgmt::V2017_09_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.



899
900
901
902
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 899

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.



928
929
930
931
932
933
934
935
936
937
938
939
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
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 928

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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Batch::Mgmt::V2017_09_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.



914
915
916
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 914

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/2017-09-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.



233
234
235
236
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 233

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.



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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 280

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::V2017_09_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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Batch::Mgmt::V2017_09_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.



257
258
259
# File 'lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb', line 257

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