Class: Clusters::Providers::Aws

Inherits:
ApplicationRecord show all
Includes:
Concerns::ProviderStatus, Gitlab::Utils::StrongMemoize, IgnorableColumns
Defined in:
app/models/clusters/providers/aws.rb

Constant Summary collapse

DEFAULT_REGION =
'us-east-1'

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods inherited from ApplicationRecord

at_most, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, underscore, without_order

Instance Method Details

#api_clientObject


51
52
53
54
55
# File 'app/models/clusters/providers/aws.rb', line 51

def api_client
  strong_memoize(:api_client) do
    ::Aws::CloudFormation::Client.new(credentials: credentials, region: region)
  end
end

#created_by_userObject


71
72
73
# File 'app/models/clusters/providers/aws.rb', line 71

def created_by_user
  cluster.user
end

#credentialsObject


57
58
59
60
61
# File 'app/models/clusters/providers/aws.rb', line 57

def credentials
  strong_memoize(:credentials) do
    ::Aws::Credentials.new(access_key_id, secret_access_key, session_token)
  end
end

#has_rbac_enabled?Boolean

Returns:

  • (Boolean)

63
64
65
# File 'app/models/clusters/providers/aws.rb', line 63

def has_rbac_enabled?
  true
end

#knative_pre_installed?Boolean

Returns:

  • (Boolean)

67
68
69
# File 'app/models/clusters/providers/aws.rb', line 67

def knative_pre_installed?
  false
end

#nullify_credentialsObject


43
44
45
46
47
48
49
# File 'app/models/clusters/providers/aws.rb', line 43

def nullify_credentials
  assign_attributes(
    access_key_id: nil,
    secret_access_key: nil,
    session_token: nil
  )
end