diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 18:40:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 18:40:28 +0300 |
commit | b595cb0c1dec83de5bdee18284abe86614bed33b (patch) | |
tree | 8c3d4540f193c5ff98019352f554e921b3a41a72 /lib/google_api | |
parent | 2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff) |
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'lib/google_api')
-rw-r--r-- | lib/google_api/cloud_platform/client.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/google_api/cloud_platform/client.rb b/lib/google_api/cloud_platform/client.rb index 360c9a6c52f..c46ca2783bf 100644 --- a/lib/google_api/cloud_platform/client.rb +++ b/lib/google_api/cloud_platform/client.rb @@ -8,6 +8,7 @@ require 'google/apis/cloudbilling_v1' require 'google/apis/cloudresourcemanager_v1' require 'google/apis/iam_v1' require 'google/apis/serviceusage_v1' +require 'google/apis/sqladmin_v1beta4' module GoogleApi module CloudPlatform @@ -152,6 +153,22 @@ module GoogleApi Gitlab::HTTP.post(uri, body: { 'token' => access_token }) end + def create_cloudsql_database(gcp_project_id, instance_name, database_name) + database = Google::Apis::SqladminV1beta4::Database.new(name: database_name) + sql_admin_service.insert_database(gcp_project_id, instance_name, database) + end + + def create_cloudsql_user(gcp_project_id, instance_name, username, password) + user = Google::Apis::SqladminV1beta4::User.new + user.name = username + user.password = password + sql_admin_service.insert_user(gcp_project_id, instance_name, user) + end + + def get_cloudsql_instance(gcp_project_id, instance_name) + sql_admin_service.get_instance(gcp_project_id, instance_name) + end + private def enable_service(gcp_project_id, service_name) @@ -219,6 +236,10 @@ module GoogleApi def cloud_resource_manager_service @gpc_service ||= Google::Apis::CloudresourcemanagerV1::CloudResourceManagerService.new.tap { |s| s.authorization = access_token } end + + def sql_admin_service + @sql_admin_service ||= Google::Apis::SqladminV1beta4::SQLAdminService.new.tap { |s| s.authorization = access_token } + end end end end |