Class: Artifactory::Resource::Group
- Defined in:
- lib/artifactory/resources/group.rb
Class Method Summary collapse
-
.all(options = {}) ⇒ Array<Resource::Group>
Get a list of all groups in the system.
-
.find(name, options = {}) ⇒ Resource::Group?
Find (fetch) a group by its name.
Instance Method Summary collapse
-
#auto_join ⇒ Object
Return this object’s
auto_join
. -
#auto_join=(value) ⇒ Object
Set this object’s
auto_join
. -
#auto_join? ⇒ Boolean
Determines if the
auto_join
value exists and is truthy. -
#delete ⇒ Boolean
Delete this group from artifactory, suppressing any
ResourceNotFound
exceptions might occur. -
#description ⇒ Object
Return this object’s
description
. -
#description=(value) ⇒ Object
Set this object’s
description
. -
#description? ⇒ Boolean
Determines if the
description
value exists and is truthy. -
#name ⇒ Object
Return this object’s
name
. -
#name=(value) ⇒ Object
Set this object’s
name
. -
#name? ⇒ Boolean
Determines if the
name
value exists and is truthy. -
#realm ⇒ Object
Return this object’s
realm
. -
#realm=(value) ⇒ Object
Set this object’s
realm
. -
#realm? ⇒ Boolean
Determines if the
realm
value exists and is truthy. -
#realm_attributes ⇒ Object
Return this object’s
realm_attributes
. -
#realm_attributes=(value) ⇒ Object
Set this object’s
realm_attributes
. -
#realm_attributes? ⇒ Boolean
Determines if the
realm_attributes
value exists and is truthy. -
#save ⇒ Boolean
Creates or updates a group configuration depending on if the group configuration previously existed.
Methods inherited from Base
attribute, attributes, #attributes, #client, #client=, #client?, #extract_client!, extract_client!, find_from_config, #format_repos!, format_repos!, from_hash, from_url, has_attribute?, #initialize, #inspect, list_from_config, #set, #to_hash, #to_json, #to_matrix_properties, #to_query_string_parameters, #to_s, #url_safe, url_safe
Constructor Details
This class inherits a constructor from Artifactory::Resource::Base
Class Method Details
.all(options = {}) ⇒ Array<Resource::Group>
Get a list of all groups in the system.
32 33 34 35 36 37 |
# File 'lib/artifactory/resources/group.rb', line 32 def all( = {}) client = extract_client!() client.get('/api/security/groups').map do |hash| from_url(hash['uri'], client: client) end end |
.find(name, options = {}) ⇒ Resource::Group?
Find (fetch) a group by its name.
57 58 59 60 61 62 63 64 65 |
# File 'lib/artifactory/resources/group.rb', line 57 def find(name, = {}) client = extract_client!() response = client.get("/api/security/groups/#{url_safe(name)}") from_hash(response, client: client) rescue Error::HTTPError => e raise unless e.code == 404 nil end |
Instance Method Details
#auto_join ⇒ Object
Return this object’s auto_join
68 |
# File 'lib/artifactory/resources/group.rb', line 68 attribute :auto_join |
#auto_join=(value) ⇒ Object
Set this object’s auto_join
68 |
# File 'lib/artifactory/resources/group.rb', line 68 attribute :auto_join |
#auto_join? ⇒ Boolean
Determines if the auto_join
value exists and is truthy
68 |
# File 'lib/artifactory/resources/group.rb', line 68 attribute :auto_join |
#delete ⇒ Boolean
Delete this group from artifactory, suppressing any ResourceNotFound
exceptions might occur.
81 82 83 84 85 86 |
# File 'lib/artifactory/resources/group.rb', line 81 def delete client.delete(api_path) true rescue Error::HTTPError false end |
#description ⇒ Object
Return this object’s description
69 |
# File 'lib/artifactory/resources/group.rb', line 69 attribute :description |
#description=(value) ⇒ Object
Set this object’s description
69 |
# File 'lib/artifactory/resources/group.rb', line 69 attribute :description |
#description? ⇒ Boolean
Determines if the description
value exists and is truthy
69 |
# File 'lib/artifactory/resources/group.rb', line 69 attribute :description |
#name ⇒ Object
Return this object’s name
70 |
# File 'lib/artifactory/resources/group.rb', line 70 attribute :name, ->{ raise 'Name missing!' } |
#name=(value) ⇒ Object
Set this object’s name
70 |
# File 'lib/artifactory/resources/group.rb', line 70 attribute :name, ->{ raise 'Name missing!' } |
#name? ⇒ Boolean
Determines if the name
value exists and is truthy
70 |
# File 'lib/artifactory/resources/group.rb', line 70 attribute :name, ->{ raise 'Name missing!' } |
#realm ⇒ Object
Return this object’s realm
71 |
# File 'lib/artifactory/resources/group.rb', line 71 attribute :realm |
#realm=(value) ⇒ Object
Set this object’s realm
71 |
# File 'lib/artifactory/resources/group.rb', line 71 attribute :realm |
#realm? ⇒ Boolean
Determines if the realm
value exists and is truthy
71 |
# File 'lib/artifactory/resources/group.rb', line 71 attribute :realm |
#realm_attributes ⇒ Object
Return this object’s realm_attributes
72 |
# File 'lib/artifactory/resources/group.rb', line 72 attribute :realm_attributes |
#realm_attributes=(value) ⇒ Object
Set this object’s realm_attributes
72 |
# File 'lib/artifactory/resources/group.rb', line 72 attribute :realm_attributes |
#realm_attributes? ⇒ Boolean
Determines if the realm_attributes
value exists and is truthy
72 |
# File 'lib/artifactory/resources/group.rb', line 72 attribute :realm_attributes |
#save ⇒ Boolean
Creates or updates a group configuration depending on if the group configuration previously existed.
94 95 96 97 98 99 100 101 |
# File 'lib/artifactory/resources/group.rb', line 94 def save if self.class.find(name, client: client) client.post(api_path, to_json, headers) else client.put(api_path, to_json, headers) end true end |