This instance will be upgraded to Heptapod 0.31.0rc on 2022-05-19 at 11:00 UTC+2 (a few minutes of down time)

fetch_gcp_operation_service.rb 556 Bytes
Newer Older
1
2
3
module Ci
  class FetchGcpOperationService
    def execute(cluster)
4
      api_client =
5
6
7
8
9
10
11
12
13
14
15
16
17
        GoogleApi::CloudPlatform::Client.new(cluster.gcp_token, nil)

      operation = api_client.projects_zones_operations(
        cluster.gcp_project_id,
        cluster.gcp_cluster_zone,
        cluster.gcp_operation_id)

      yield(operation) if block_given?
    rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
      return cluster.errored!("Failed to request to CloudPlatform; #{e.message}")
    end
  end
end