class Conjur::DSL2::Executor::CreateRecord
Generic ‘create’ implementation which POSTs to a resources URL.
Public Instance Methods
annotate_record()
click to toggle source
# File lib/conjur/dsl2/executor/create.rb, line 22 def annotate_record record end
create_parameters()
click to toggle source
Each record is assumed to have an ‘id’ attribute required for creation. In addition, other create parameters can be specified by the custom_attribute_names
method on the record.
# File lib/conjur/dsl2/executor/create.rb, line 37 def create_parameters { record.id_attribute => record.id }.tap do |params| custom_attrs = record.custom_attribute_names.inject({}) do |memo, attr| value = record.send(attr) memo[attr.to_s] = value if value memo end params.merge! custom_attrs params["ownerid"] = record.owner.roleid if record.owner end end
create_path()
click to toggle source
# File lib/conjur/dsl2/executor/create.rb, line 26 def create_path [ kind_path ].join('/') end
execute()
click to toggle source
# File lib/conjur/dsl2/executor/create.rb, line 13 def execute action({ 'method' => 'post', 'path' => create_path, 'parameters' => create_parameters }) annotate end
kind_path()
click to toggle source
# File lib/conjur/dsl2/executor/create.rb, line 30 def kind_path record.resource_kind.pluralize end