Sha256: b1cc5ca78f41cb307fdfd56cd2c226c0b3b3abea290c809a748c7500b91f4e92

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

module Conjur::Policy::Types
  class Create < Base
    attribute :record

    self.description = %(
Create a record of any type.

A record can be a [Role](#reference/role) or a [Resource](#reference/resource).

Creating records can be done explicitly using this node type, or
implicitly. Examples of both are given immediately below.
    
When a record is created explicitly, it's an error if the record already exists.
When a record is created implicitly, the record will be found-or-created, and its
state (owner, fields and annotations) will be updated to match the policy declaration.
)

    self.example = %(
- !user research # implicit record creation
- !create        # explicit record creation
    record: !user research
- !create
    record: !group experiment
- !create
    record: !role control
      kind: experimental_control
      owner: !user research
)
        
    def to_s
      messages = [ "Create #{record}" ]
      if record.resource?
        (record.annotations||{}).each do |k,v|
          messages.push "  Set annotation '#{k}'"
        end
      end
      messages.join("\n")
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
conjur-policy-parser-0.12.0 lib/conjur/policy/types/create.rb
conjur-asset-policy-0.13.0 lib/conjur/policy/types/create.rb
conjur-asset-policy-0.12.0 lib/conjur/policy/types/create.rb
conjur-asset-policy-0.11.0 lib/conjur/policy/types/create.rb