Add Google Cloud client project billing info
This commit is contained in:
parent
596ea9e368
commit
957bedb1c3
|
@ -1,4 +1,5 @@
|
|||
require 'google/apis/container_v1'
|
||||
require 'google/apis/cloudbilling_v1'
|
||||
require 'google/apis/cloudresourcemanager_v1'
|
||||
|
||||
module GoogleApi
|
||||
|
@ -50,6 +51,13 @@ module GoogleApi
|
|||
end
|
||||
end
|
||||
|
||||
def projects_get_billing_info(project_name)
|
||||
service = Google::Apis::CloudbillingV1::CloudbillingService.new
|
||||
service.authorization = access_token
|
||||
|
||||
service.get_project_billing_info(project_name)
|
||||
end
|
||||
|
||||
def projects_zones_clusters_get(project_id, zone, cluster_id)
|
||||
service = Google::Apis::ContainerV1::ContainerService.new
|
||||
service.authorization = access_token
|
||||
|
|
|
@ -62,6 +62,18 @@ describe GoogleApi::CloudPlatform::Client do
|
|||
it { is_expected.to eq(projects) }
|
||||
end
|
||||
|
||||
def projects_get_billing_info
|
||||
subject { client.projects_get_billing_info }
|
||||
let(:billing_info) { double }
|
||||
|
||||
before do
|
||||
allow_any_instance_of(Google::Apis::CloudbillingV1::CloudbillingService)
|
||||
.to receive(:get_project_billing_info).and_return(billing_info)
|
||||
end
|
||||
|
||||
it { is_expected.to eq(billing_info) }
|
||||
end
|
||||
|
||||
describe '#projects_zones_clusters_get' do
|
||||
subject { client.projects_zones_clusters_get(spy, spy, spy) }
|
||||
let(:gke_cluster) { double }
|
||||
|
|
Loading…
Reference in New Issue