github.com/Venafi/vcert/v5@v5.10.2/aruba/features/support/google_provider.rb (about)

     1  require 'google/cloud/certificate_manager/v1'
     2  
     3  # Set the environment variable for Google Cloud credentials
     4  ENV['GOOGLE_APPLICATION_CREDENTIALS'] = ENV['GCP_AUTH_PATH']
     5  
     6  # Initialize the Certificate Manager Client
     7  def create_google_certificate_manager_client
     8    Google::Cloud::CertificateManager::V1::CertificateManager::Client.new
     9  end
    10  
    11  # Delete a certificate
    12  def delete_gcm_certificate(client, certificate_name)
    13    request = Google::Cloud::CertificateManager::V1::DeleteCertificateRequest.new(
    14      name: certificate_name
    15    )
    16  
    17    operation = client.delete_certificate(request)
    18    operation.wait_until_done!
    19  
    20    if operation.error?
    21      puts "Error deleting certificate: #{operation.error.message}"
    22    else
    23      puts "Certificate deleted successfully."
    24    end
    25  end