Class: SupportOps::GitLab::SSHKeys
- Defined in:
- lib/support_ops_gitlab/gitlab/ssh_keys.rb
Overview
Get an SSH key for a user > docs.gitlab.com/api/user_keys/#get-an-ssh-key-for-a-user
Add an SSH key for a user > docs.gitlab.com/api/user_keys/#add-an-ssh-key-for-a-user
Delete an SSH key for a user > docs.gitlab.com/api/user_keys/#delete-an-ssh-key-for-a-user
Defines the class SSHKeys within the module SupportOps::GitLab.
Instance Attribute Summary collapse
-
#created_at ⇒ String
Timestamp for when the key was created.
-
#expires_at ⇒ String
Timestamp when the SSH key should auto-remove.
-
#id ⇒ Integer
ID value of the key.
-
#key ⇒ String
Public key value.
-
#title ⇒ String
Title for key.
-
#usage_type ⇒ String
Usage scope for the key; possible values: auth, signing, or auth_and_signing; default value: auth_and_signing.
Class Method Summary collapse
-
.list(key: value) ⇒ Array
Lists all SSH keys for a user.
Methods inherited from Base
#activate!, #approve!, attributes, #badges, #ban!, #block!, client, #client=, #commits, configure, #contributors, #create_support_pin!, #deactivate!, define_attributes, #delete!, #diffs, #disable_2fa!, #discussions, #emails, #encoded_path, #events, #find, #find!, #gpg_keys, #hard_delete!, #impersonations, #initialize, #issues, #jobs, #latest_pipeline, #members, #memberships, #merge_requests, #move!, #notes, #paid?, #pats, #pipeline_variables, #pipelines, #preferences, #projects, readonly_attributes, #reject!, #revoke!, #rotate!, #save!, #ssh_keys, #status, #store_original_attributes, #subscribe!, #support_pin, to_hash, #tokens, #unban!, #unblock!, #unsubscribe!, #webhooks
Constructor Details
This class inherits a constructor from SupportOps::GitLab::Base
Instance Attribute Details
#created_at ⇒ String
Timestamp for when the key was created
21 22 23 |
# File 'lib/support_ops_gitlab/gitlab/ssh_keys.rb', line 21 def created_at @created_at end |
#expires_at ⇒ String
Timestamp when the SSH key should auto-remove
21 22 23 |
# File 'lib/support_ops_gitlab/gitlab/ssh_keys.rb', line 21 def expires_at @expires_at end |
#id ⇒ Integer
ID value of the key
21 22 23 |
# File 'lib/support_ops_gitlab/gitlab/ssh_keys.rb', line 21 def id @id end |
#key ⇒ String
Public key value
21 22 23 |
# File 'lib/support_ops_gitlab/gitlab/ssh_keys.rb', line 21 def key @key end |
#title ⇒ String
Title for key
21 22 23 |
# File 'lib/support_ops_gitlab/gitlab/ssh_keys.rb', line 21 def title @title end |
#usage_type ⇒ String
Usage scope for the key; possible values: auth, signing, or auth_and_signing; default value: auth_and_signing
21 22 23 |
# File 'lib/support_ops_gitlab/gitlab/ssh_keys.rb', line 21 def usage_type @usage_type end |
Class Method Details
.list(key: value) ⇒ Array
Lists all SSH keys for a user
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/support_ops_gitlab/gitlab/ssh_keys.rb', line 51 def self.list(**args) args[:user_id] = nil unless args[:user_id] url = if args[:user_id].nil? 'user/keys' else "users/#{args[:user_id]}/keys" end response = client.connection.get(url) body = Oj.load(response.body) raise "Unable to get SSH keys of user => #{body}" if response.status != 200 body.map { |s| SSHKeys.new(s) } end |