Module: Occi::Api::Dsl

Defined in:
lib/occi/api/dsl.rb

Instance Method Summary collapse

Instance Method Details

#checkObject (private)


139
140
141
142
# File 'lib/occi/api/dsl.rb', line 139

def check
  raise "You have to issue 'connect' first!" if @client.nil?
  raise "Client is disconnected!" unless @client.connected
end

#connect(protocol, *args) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/occi/api/dsl.rb', line 5

def connect(protocol, *args)

  case protocol
  when :http 
    @client = Occi::Api::Client::ClientHttp.new(*args)
  when :amqp
    @client = Occi::Api::Client::ClientAmqp.new(*args)
  else
    raise "Protocol #{protocol.to_s} is not supported!"
  end

  true
end

#create(*args) ⇒ Object


31
32
33
34
35
# File 'lib/occi/api/dsl.rb', line 31

def create(*args)
  check

  @client.create(*args)
end

#delete(*args) ⇒ Object


37
38
39
40
41
# File 'lib/occi/api/dsl.rb', line 37

def delete(*args)
  check

  @client.delete(*args)
end

#describe(*args) ⇒ Object


25
26
27
28
29
# File 'lib/occi/api/dsl.rb', line 25

def describe(*args)
  check

  @client.describe(*args)
end

#entity_type_identifiersObject


93
94
95
96
97
# File 'lib/occi/api/dsl.rb', line 93

def entity_type_identifiers
  check

  @client.get_entity_type_identifiers
end

#entity_typesObject


87
88
89
90
91
# File 'lib/occi/api/dsl.rb', line 87

def entity_types
  check

  @client.get_entity_types
end

99
100
101
102
103
# File 'lib/occi/api/dsl.rb', line 99

def entity_types_related_to(*args)
  check

  @client.get_entity_types_related_to(*args)
end

111
112
113
114
115
# File 'lib/occi/api/dsl.rb', line 111

def link_type_identifiers
  check

  @client.get_link_type_identifiers
end

105
106
107
108
109
# File 'lib/occi/api/dsl.rb', line 105

def link_types
  check

  @client.get_link_types
end

#list(*args) ⇒ Object


19
20
21
22
23
# File 'lib/occi/api/dsl.rb', line 19

def list(*args)
  check

  @client.list(*args)
end

#mixin(*args) ⇒ Object


131
132
133
134
135
# File 'lib/occi/api/dsl.rb', line 131

def mixin(*args)
  check

  @client.find_mixin(*args)
end

#mixin_type_identifiersObject


75
76
77
78
79
# File 'lib/occi/api/dsl.rb', line 75

def mixin_type_identifiers
  check

  @client.get_mixin_type_identifiers
end

#mixin_typesObject


81
82
83
84
85
# File 'lib/occi/api/dsl.rb', line 81

def mixin_types
  check

  @client.get_mixin_types
end

#mixins(*args) ⇒ Object


119
120
121
122
123
# File 'lib/occi/api/dsl.rb', line 119

def mixins(*args)
  check

  @client.get_mixins(*args)
end

#modelObject


55
56
57
58
59
# File 'lib/occi/api/dsl.rb', line 55

def model
  check

  @client.model
end

#refreshObject


49
50
51
52
53
# File 'lib/occi/api/dsl.rb', line 49

def refresh
  check

  @client.refresh
end

#resource(*args) ⇒ Object


125
126
127
128
129
# File 'lib/occi/api/dsl.rb', line 125

def resource(*args)
  check

  @client.get_resource(*args)
end

#resource_type_identifiersObject


69
70
71
72
73
# File 'lib/occi/api/dsl.rb', line 69

def resource_type_identifiers
  check

  @client.get_resource_type_identifiers
end

#resource_typesObject


63
64
65
66
67
# File 'lib/occi/api/dsl.rb', line 63

def resource_types
  check

  @client.get_resource_types
end

#trigger(*args) ⇒ Object


43
44
45
46
47
# File 'lib/occi/api/dsl.rb', line 43

def trigger(*args)
  check

  @client.trigger(*args)
end