Class: Clusters::Gcp::FetchOperationService

Inherits:
Object
  • Object
show all
Defined in:
app/services/clusters/gcp/fetch_operation_service.rb

Instance Method Summary collapse

Instance Method Details

#execute(provider) ⇒ Object


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/services/clusters/gcp/fetch_operation_service.rb', line 6

def execute(provider)
  operation = provider.api_client.projects_zones_operations(
    provider.gcp_project_id,
    provider.zone,
    provider.operation_id)

  yield(operation) if block_given?
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
  logger.error(
    exception: e.class.name,
    service: self.class.name,
    provider_id: provider.id,
    message: e.message
  )

  provider.make_errored!("Failed to request to CloudPlatform; #{e.message}")
end