summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/google_api/cloud_platform/client.rb8
-rw-r--r--spec/lib/google_api/cloud_platform/client_spec.rb12
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/google_api/cloud_platform/client.rb b/lib/google_api/cloud_platform/client.rb
index f0dabcb1c5d..c107d001bec 100644
--- a/lib/google_api/cloud_platform/client.rb
+++ b/lib/google_api/cloud_platform/client.rb
@@ -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
diff --git a/spec/lib/google_api/cloud_platform/client_spec.rb b/spec/lib/google_api/cloud_platform/client_spec.rb
index 0383b1080dc..2d14c3b1a3a 100644
--- a/spec/lib/google_api/cloud_platform/client_spec.rb
+++ b/spec/lib/google_api/cloud_platform/client_spec.rb
@@ -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 }