BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
596ea9e3
Unverified
Commit
596ea9e3
authored
Dec 15, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Google Cloud client project list
parent
497a0cd6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
client.rb
lib/google_api/cloud_platform/client.rb
+10
-0
client_spec.rb
spec/lib/google_api/cloud_platform/client_spec.rb
+12
-0
No files found.
lib/google_api/cloud_platform/client.rb
View file @
596ea9e3
require
'google/apis/container_v1'
require
'google/apis/cloudresourcemanager_v1'
module
GoogleApi
module
CloudPlatform
...
...
@@ -40,6 +41,15 @@ module GoogleApi
true
end
def
projects_list
service
=
Google
::
Apis
::
CloudresourcemanagerV1
::
CloudResourceManagerService
.
new
service
.
authorization
=
access_token
service
.
fetch_all
(
items: :projects
)
do
|
token
|
service
.
list_projects
(
page_token:
token
)
end
end
def
projects_zones_clusters_get
(
project_id
,
zone
,
cluster_id
)
service
=
Google
::
Apis
::
ContainerV1
::
ContainerService
.
new
service
.
authorization
=
access_token
...
...
spec/lib/google_api/cloud_platform/client_spec.rb
View file @
596ea9e3
...
...
@@ -50,6 +50,18 @@ describe GoogleApi::CloudPlatform::Client do
end
end
describe
'#projects_list'
do
subject
{
client
.
projects_list
}
let
(
:projects
)
{
double
}
before
do
allow_any_instance_of
(
Google
::
Apis
::
CloudresourcemanagerV1
::
CloudResourceManagerService
)
.
to
receive
(
:fetch_all
).
and_return
(
projects
)
end
it
{
is_expected
.
to
eq
(
projects
)
}
end
describe
'#projects_zones_clusters_get'
do
subject
{
client
.
projects_zones_clusters_get
(
spy
,
spy
,
spy
)
}
let
(
:gke_cluster
)
{
double
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment