Method: CPEE::NewInstance#response

Defined in:
lib/cpee/implementation.rb

#responseObject



411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/cpee/implementation.rb', line 411

def response
  opts  = @a[0]
  redis = opts[:redis]
  name  = @p[0].value

  id, uuid = NewInstance::create(opts,redis,name,[])
  content = {
    :state => 'ready',
    :attributes => CPEE::Persistence::extract_list(id,opts,'attributes').to_h
  }
  CPEE::Message::send(:event,'state/change',File.join(opts[:url],'/'),id,uuid,name,content,redis)

  @headers << Riddl::Header.new("CPEE-INSTANCE", id.to_s)
  @headers << Riddl::Header.new("CPEE-INSTANCE-URL", File.join(opts[:url].to_s,id.to_s,'/'))
  @headers << Riddl::Header.new("CPEE-INSTANCE-UUID", uuid)

  Riddl::Parameter::Simple.new("id", id.to_s)
end