summaryrefslogtreecommitdiff
path: root/lib/google_api
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2017-12-13 15:16:36 +0100
committerMatija Čupić <matteeyah@gmail.com>2017-12-13 15:16:36 +0100
commitcc9b6091d193f7255aaf90983a2fbeda02061875 (patch)
tree138d809a90ac5f93af0de4fab3762b2d5b1d2746 /lib/google_api
parenteb9f88311b0591586c73ddb35bdb07677464748c (diff)
parentb305a1331c14f819914ef1230bdf184860475045 (diff)
downloadgitlab-ce-cc9b6091d193f7255aaf90983a2fbeda02061875.tar.gz
Merge branch 'master' into 39957-redirect-to-gpc-page-if-users-try-to-create-a-cluster-but-the-account-is-not-enabled
Diffstat (limited to 'lib/google_api')
-rw-r--r--lib/google_api/cloud_platform/client.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/google_api/cloud_platform/client.rb b/lib/google_api/cloud_platform/client.rb
index 9242cbe840c..b0563fb2d69 100644
--- a/lib/google_api/cloud_platform/client.rb
+++ b/lib/google_api/cloud_platform/client.rb
@@ -44,7 +44,7 @@ module GoogleApi
service = Google::Apis::ContainerV1::ContainerService.new
service.authorization = access_token
- service.get_zone_cluster(project_id, zone, cluster_id)
+ service.get_zone_cluster(project_id, zone, cluster_id, options: user_agent_header)
end
def projects_zones_clusters_create(project_id, zone, cluster_name, cluster_size, machine_type:)
@@ -62,14 +62,14 @@ module GoogleApi
}
} )
- service.create_cluster(project_id, zone, request_body)
+ service.create_cluster(project_id, zone, request_body, options: user_agent_header)
end
def projects_zones_operations(project_id, zone, operation_id)
service = Google::Apis::ContainerV1::ContainerService.new
service.authorization = access_token
- service.get_zone_operation(project_id, zone, operation_id)
+ service.get_zone_operation(project_id, zone, operation_id, options: user_agent_header)
end
def parse_operation_id(self_link)
@@ -82,6 +82,12 @@ module GoogleApi
def token_life_time(expires_at)
DateTime.strptime(expires_at, '%s').to_time.utc - Time.now.utc
end
+
+ def user_agent_header
+ Google::Apis::RequestOptions.new.tap do |options|
+ options.header = { 'User-Agent': "GitLab/#{Gitlab::VERSION.match('(\d+\.\d+)').captures.first} (GPN:GitLab;)" }
+ end
+ end
end
end
end