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
45b3bcc3
Unverified
Commit
45b3bcc3
authored
Mar 16, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add zones_list and machine_types_list to Google Cloud API client
parent
78fb81e6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
client.rb
lib/google_api/cloud_platform/client.rb
+19
-0
client_spec.rb
spec/lib/google_api/cloud_platform/client_spec.rb
+24
-0
No files found.
lib/google_api/cloud_platform/client.rb
View file @
45b3bcc3
require
'google/apis/compute_v1'
require
'google/apis/container_v1'
require
'google/apis/cloudbilling_v1'
require
'google/apis/cloudresourcemanager_v1'
...
...
@@ -58,6 +59,24 @@ module GoogleApi
service
.
get_project_billing_info
(
"projects/
#{
project_id
}
"
,
options:
user_agent_header
)
end
def
projects_zones_list
(
project_id
)
service
=
Google
::
Apis
::
ComputeV1
::
ComputeService
.
new
service
.
authorization
=
access_token
service
.
fetch_all
do
|
token
|
service
.
list_zones
(
project_id
,
page_token:
token
,
options:
user_agent_header
)
end
end
def
projects_zones_machine_types_list
(
project_id
,
zone
)
service
=
Google
::
Apis
::
ComputeV1
::
ComputeService
.
new
service
.
authorization
=
access_token
service
.
fetch_all
do
|
token
|
service
.
list_machine_types
(
project_id
,
zone
,
page_token:
token
,
options:
user_agent_header
)
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 @
45b3bcc3
...
...
@@ -74,6 +74,30 @@ describe GoogleApi::CloudPlatform::Client do
it
{
is_expected
.
to
eq
(
billing_info
)
}
end
describe
'#projects_zones_list'
do
subject
{
client
.
projects_zones_list
(
'project'
)
}
let
(
:zones
)
{
double
}
before
do
allow_any_instance_of
(
Google
::
Apis
::
ComputeV1
::
ComputeService
)
.
to
receive
(
:fetch_all
).
and_return
(
zones
)
end
it
{
is_expected
.
to
eq
(
zones
)
}
end
describe
'#projects_zones_machine_types_list'
do
subject
{
client
.
projects_zones_machine_types_list
(
'project'
,
'zone'
)
}
let
(
:machine_types
)
{
double
}
before
do
allow_any_instance_of
(
Google
::
Apis
::
ComputeV1
::
ComputeService
)
.
to
receive
(
:fetch_all
).
and_return
(
machine_types
)
end
it
{
is_expected
.
to
eq
(
machine_types
)
}
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