Class: Chef::Resource::ChefOrganization
- Inherits:
-
LWRPBase
- Object
- LWRPBase
- Chef::Resource::ChefOrganization
- Defined in:
- lib/chef/resource/chef_organization.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ ChefOrganization
constructor
Grab environment from with_environment.
-
#invites(*users) ⇒ Object
A list of users who must at least be invited to the org (but may already be members).
- #invites_specified? ⇒ Boolean
-
#members(*users) ⇒ Object
A list of users who must be members of the org.
- #members_specified? ⇒ Boolean
-
#remove_members(*users) ⇒ Object
A list of users who must not be members of the org.
Constructor Details
#initialize(*args) ⇒ ChefOrganization
Grab environment from with_environment
14 15 16 17 18 19 20 |
# File 'lib/chef/resource/chef_organization.rb', line 14 def initialize(*args) super chef_server run_context.cheffish.current_chef_server @invites = nil @members = nil @remove_members = [] end |
Instance Method Details
#invites(*users) ⇒ Object
A list of users who must at least be invited to the org (but may already be members). Invites will be sent to users who are not already invited/in the org.
27 28 29 30 31 32 33 34 |
# File 'lib/chef/resource/chef_organization.rb', line 27 def invites(*users) if users.size == 0 @invites || [] else @invites ||= [] @invites |= users.flatten end end |
#invites_specified? ⇒ Boolean
36 37 38 |
# File 'lib/chef/resource/chef_organization.rb', line 36 def invites_specified? !!@invites end |
#members(*users) ⇒ Object
A list of users who must be members of the org. This will use the new Chef 12 POST /organizations/ORG/users endpoint to add them directly to the org. If you do not have permission to perform this operation, and the users are not a part of the org, the resource update will fail.
45 46 47 48 49 50 51 52 |
# File 'lib/chef/resource/chef_organization.rb', line 45 def members(*users) if users.size == 0 @members || [] else @members ||= [] @members |= users.flatten end end |
#members_specified? ⇒ Boolean
54 55 56 |
# File 'lib/chef/resource/chef_organization.rb', line 54 def members_specified? !!@members end |
#remove_members(*users) ⇒ Object
A list of users who must not be members of the org. These users will be removed from the org and invites will be revoked (if any).
60 61 62 |
# File 'lib/chef/resource/chef_organization.rb', line 60 def remove_members(*users) users.size == 0 ? @remove_members : (@remove_members |= users.flatten) end |