Class: Fog::Introspection::OpenStack::Mock
  
  
  
  
  
    - Inherits:
- 
      Object
      
        
          - Object
- Fog::Introspection::OpenStack::Mock
 show all
      - Includes:
- OpenStack::Core
    - Defined in:
- lib/fog/openstack/introspection.rb,
 lib/fog/openstack/requests/introspection/get_rules.rb,
 lib/fog/openstack/requests/introspection/list_rules.rb,
 lib/fog/openstack/requests/introspection/create_rules.rb,
 lib/fog/openstack/requests/introspection/delete_rules.rb,
 lib/fog/openstack/requests/introspection/delete_rules_all.rb,
 lib/fog/openstack/requests/introspection/get_introspection.rb,
 lib/fog/openstack/requests/introspection/abort_introspection.rb,
 lib/fog/openstack/requests/introspection/create_introspection.rb,
 lib/fog/openstack/requests/introspection/get_introspection_details.rb
 
  Instance Attribute Summary
  
  
  #auth_token, #auth_token_expiration, #current_tenant, #current_user, #current_user_id, #openstack_cache_ttl, #openstack_domain_id, #openstack_domain_name, #openstack_identity_prefix, #openstack_project_domain, #openstack_project_domain_id, #openstack_project_id, #openstack_user_domain, #openstack_user_domain_id, #unscoped_token
  
    
      Class Method Summary
      collapse
    
    
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  #credentials, #initialize_identity, not_found_class, #reload
  Constructor Details
  
    
  
  
    #initialize(options = {})  ⇒ Mock 
  
  
  
  
    
Returns a new instance of Mock.
   
 
  
  
    | 
57
58
59
60
61
62 | # File 'lib/fog/openstack/introspection.rb', line 57
def initialize(options = {})
  @auth_token = Fog::Mock.random_base64(64)
  @auth_token_expiration = (Time.now.utc + 86_400).iso8601
  initialize_identity options
end
 | 
 
  
 
  
    Class Method Details
    
      
  
  
    .data  ⇒ Object 
  
  
  
  
    | 
43
44
45
46
47
48
49 | # File 'lib/fog/openstack/introspection.rb', line 43
def self.data
  @data ||= Hash.new do |hash, key|
    
    file = "../../../../tests/fixtures/introspection.yaml"
    hash[key] = YAML.load(File.read(File.expand_path(file, __FILE__)))
  end
end
 | 
 
    
      
  
  
    .reset  ⇒ Object 
  
  
  
  
    | 
51
52
53 | # File 'lib/fog/openstack/introspection.rb', line 51
def self.reset
  @data = nil
end
 | 
 
    
   
  
    Instance Method Details
    
      
  
  
    #abort_introspection(_node_id)  ⇒ Object 
  
  
  
  
    | 
16
17
18
19
20
21 | # File 'lib/fog/openstack/requests/introspection/abort_introspection.rb', line 16
def abort_introspection(_node_id)
  response = Excon::Response.new
  response.status = 202
  response.body = ""
  response
end
 | 
 
    
      
  
  
    #create_introspection(_node_id, _options = {})  ⇒ Object 
  
  
  
  
    | 
26
27
28
29
30
31 | # File 'lib/fog/openstack/requests/introspection/create_introspection.rb', line 26
def create_introspection(_node_id, _options = {})
  response = Excon::Response.new
  response.status = 202
  response.body = ""
  response
end
 | 
 
    
      
  
  
    #create_rules(_)  ⇒ Object 
  
  
  
  
    | 
28
29
30
31
32
33 | # File 'lib/fog/openstack/requests/introspection/create_rules.rb', line 28
def create_rules(_)
  response = Excon::Response.new
  response.status = 200
  response.body = {"rules" => data[:rules].first}
  response
end
 | 
 
    
      
  
  
    #data  ⇒ Object 
  
  
  
  
    | 
64
65
66 | # File 'lib/fog/openstack/introspection.rb', line 64
def data
  self.class.data[@openstack_username]
end
 | 
 
    
      
  
  
    #delete_rules(_rule_id)  ⇒ Object 
  
  
  
  
    | 
15
16
17
18
19 | # File 'lib/fog/openstack/requests/introspection/delete_rules.rb', line 15
def delete_rules(_rule_id)
  response = Excon::Response.new
  response.status = 204
  response
end
 | 
 
    
      
  
  
    #delete_rules_all  ⇒ Object 
  
  
  
  
    | 
15
16
17
18
19 | # File 'lib/fog/openstack/requests/introspection/delete_rules_all.rb', line 15
def delete_rules_all
  response = Excon::Response.new
  response.status = 204
  response
end
 | 
 
    
      
  
  
    #get_introspection(_node_id)  ⇒ Object 
  
  
  
  
    | 
15
16
17
18
19
20 | # File 'lib/fog/openstack/requests/introspection/get_introspection.rb', line 15
def get_introspection(_node_id)
  response = Excon::Response.new
  response.status = 200
  response.body = {"error" => "null", "finished" => "true"}
  response
end
 | 
 
    
      
  
  
    #get_introspection_details(_node_id)  ⇒ Object 
  
  
  
  
    | 
15
16
17
18
19
20 | # File 'lib/fog/openstack/requests/introspection/get_introspection_details.rb', line 15
def get_introspection_details(_node_id)
  response = Excon::Response.new
  response.status = 200
  response.body = {"data" => data[:introspection_data]}
  response
end
 | 
 
    
      
  
  
    #get_rules(_rule_id)  ⇒ Object 
  
  
  
  
    | 
15
16
17
18
19
20 | # File 'lib/fog/openstack/requests/introspection/get_rules.rb', line 15
def get_rules(_rule_id)
  response = Excon::Response.new
  response.status = 200
  response.body = {"rules" => data[:rules].first}
  response
end
 | 
 
    
      
  
  
    #list_rules  ⇒ Object 
  
  
  
  
    | 
15
16
17
18
19
20 | # File 'lib/fog/openstack/requests/introspection/list_rules.rb', line 15
def list_rules
  response = Excon::Response.new
  response.status = 200
  response.body = {"rules" => data[:rules].first}
  response
end
 | 
 
    
      
  
  
    #reset_data  ⇒ Object 
  
  
  
  
    | 
68
69
70 | # File 'lib/fog/openstack/introspection.rb', line 68
def reset_data
  self.class.data.delete(@openstack_username)
end
 |