Module: ViprServiceCatalog

Included in:
Vipr
Defined in:
lib/vipruby/objects/servicecatalog.rb

Overview

The following Servce Catalog calls will get and execute service catalog items

Instance Method Summary collapse

Instance Method Details

#get_all_sc_services(auth = nil, cert = nil) ⇒ JSON

Get all services

Returns:

  • (JSON)

    The JSON object of all services



33
34
35
# File 'lib/vipruby/objects/servicecatalog.rb', line 33

def get_all_sc_services(auth=nil,cert=nil)
	rest_get("#{base_url}/catalog/services/bulk", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
end

#get_sc_category_categories(cat_id, auth = nil, cert = nil) ⇒ JSON

Get all child categories of a category in ViPR

Parameters:

  • cat_id (urn:id)

    URN of a category. Required Param

Returns:

  • (JSON)

    The JSON object of all children categories



17
18
19
# File 'lib/vipruby/objects/servicecatalog.rb', line 17

def get_sc_category_categories(cat_id,auth=nil, cert=nil)
	rest_get("#{@base_url}/catalog/categories/#{cat_id}/categories", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
end

#get_sc_category_categories_services(cat_id, auth = nil, cert = nil) ⇒ JSON

Get all child services of a category in ViPR

Parameters:

  • cat_id (urn:id)

    URN of a category. Required Param

Returns:

  • (JSON)

    The JSON object of all children services



26
27
28
# File 'lib/vipruby/objects/servicecatalog.rb', line 26

def get_sc_category_categories_services(cat_id,auth=nil,cert=nil)
	rest_get("#{base_url}/catalog/categories/#{cat_id}/services", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
end

#get_sc_category_root(auth = nil, cert = nil) ⇒ json

Get root category

Returns:

  • (json)

    JSON object of all the root children categories



8
9
10
# File 'lib/vipruby/objects/servicecatalog.rb', line 8

def get_sc_category_root(auth=nil, cert=nil)
	rest_get("#{@base_url}/catalog/categories", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
end

#get_sc_service(service_id, auth = nil, cert = nil) ⇒ JSON

Get Service Information

Parameters:

  • service_id (urn:id)

    URN of a service. Required Param

Returns:

  • (JSON)

    The JSON object of all services



42
43
44
# File 'lib/vipruby/objects/servicecatalog.rb', line 42

def get_sc_service(service_id, auth=nil,cert=nil)
	rest_get("#{base_url}/catalog/services/#{service_id}", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
end

#order_service(tenant_id, service_urn, *args) ⇒ Object

Note:

Please read the documentation to know what parameters are needed when passing the JSON object. Every service will have it’s own set of parameters and they are unique to each service



62
63
64
65
66
67
68
69
70
# File 'lib/vipruby/objects/servicecatalog.rb', line 62

def order_service(tenant_id, service_urn, *args)
	payload = {
           tenantId: tenant_id,
           parameters: args,
           catalog_service: service_urn
       }.to_json
       
       post_order_service(payload)
end

#post_order_service(payload, auth = nil, cert = nil) ⇒ json (private)

POST A Service Catalog Order

Parameters:

  • payload (json)

    JSON collection of parameters that will come from order_service. Required Param

Returns:

  • (json)

    JSON object with details of the service executed



78
79
80
# File 'lib/vipruby/objects/servicecatalog.rb', line 78

def post_order_service(payload, auth=nil,cert=nil)
	rest_post(payload, "#{base_url}/catalog/orders", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
end