Class: Clusters::Aws::AuthorizeRoleService

Inherits:
Object
  • Object
show all
Defined in:
app/services/clusters/aws/authorize_role_service.rb

Defined Under Namespace

Classes: Response

Constant Summary collapse

ERRORS =
[
  ActiveRecord::RecordInvalid,
  ActiveRecord::RecordNotFound,
  Clusters::Aws::FetchCredentialsService::MissingRoleError,
  ::Aws::Errors::MissingCredentialsError,
  ::Aws::STS::Errors::ServiceError
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, params:) ⇒ AuthorizeRoleService

Returns a new instance of AuthorizeRoleService.


18
19
20
21
# File 'app/services/clusters/aws/authorize_role_service.rb', line 18

def initialize(user, params:)
  @user = user
  @params = params
end

Instance Attribute Details

#userObject (readonly)

Returns the value of attribute user


6
7
8
# File 'app/services/clusters/aws/authorize_role_service.rb', line 6

def user
  @user
end

Instance Method Details

#executeObject


23
24
25
26
27
28
29
30
31
32
# File 'app/services/clusters/aws/authorize_role_service.rb', line 23

def execute
  ensure_role_exists!
  update_role_arn!

  Response.new(:ok, credentials)
rescue *ERRORS => e
  Gitlab::ErrorTracking.track_exception(e)

  Response.new(:unprocessable_entity, {})
end