diff options
Diffstat (limited to 'lib/google_api/cloud_platform/client.rb')
-rw-r--r-- | lib/google_api/cloud_platform/client.rb | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/lib/google_api/cloud_platform/client.rb b/lib/google_api/cloud_platform/client.rb index e37bd1f7606..5eef4fd0e4e 100644 --- a/lib/google_api/cloud_platform/client.rb +++ b/lib/google_api/cloud_platform/client.rb @@ -15,13 +15,6 @@ module GoogleApi class Client < GoogleApi::Auth SCOPE = 'https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/service.management' LEAST_TOKEN_LIFE_TIME = 10.minutes - CLUSTER_MASTER_AUTH_USERNAME = 'admin' - CLUSTER_IPV4_CIDR_BLOCK = '/16' - CLUSTER_OAUTH_SCOPES = [ - "https://www.googleapis.com/auth/devstorage.read_only", - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring" - ].freeze ROLES_LIST = %w[roles/iam.serviceAccountUser roles/artifactregistry.admin roles/cloudbuild.builds.builder roles/run.admin roles/storage.admin roles/cloudsql.client roles/browser].freeze REVOKE_URL = 'https://oauth2.googleapis.com/revoke' @@ -59,36 +52,6 @@ module GoogleApi true end - def projects_zones_clusters_get(project_id, zone, cluster_id) - service = Google::Apis::ContainerV1::ContainerService.new - service.authorization = access_token - - 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:, legacy_abac:, enable_addons: []) - service = Google::Apis::ContainerV1beta1::ContainerService.new - service.authorization = access_token - - cluster_options = make_cluster_options(cluster_name, cluster_size, machine_type, legacy_abac, enable_addons) - - request_body = Google::Apis::ContainerV1beta1::CreateClusterRequest.new(**cluster_options) - - 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, options: user_agent_header) - end - - def parse_operation_id(self_link) - m = self_link.match(%r{projects/.*/zones/.*/operations/(.*)}) - m[1] if m - end - def list_projects result = [] @@ -210,38 +173,6 @@ module GoogleApi service.enable_service(name) end - def make_cluster_options(cluster_name, cluster_size, machine_type, legacy_abac, enable_addons) - { - cluster: { - name: cluster_name, - initial_node_count: cluster_size, - node_config: { - machine_type: machine_type, - oauth_scopes: CLUSTER_OAUTH_SCOPES - }, - master_auth: { - client_certificate_config: { - issue_client_certificate: true - } - }, - legacy_abac: { - enabled: legacy_abac - }, - ip_allocation_policy: { - use_ip_aliases: true, - cluster_ipv4_cidr_block: CLUSTER_IPV4_CIDR_BLOCK - }, - addons_config: make_addons_config(enable_addons) - } - } - end - - def make_addons_config(enable_addons) - enable_addons.index_with do |addon| - { disabled: false } - end - end - def token_life_time(expires_at) DateTime.strptime(expires_at, '%s').to_time.utc - Time.now.utc end |