Class: Vipr

Inherits:
Object
  • Object
show all
Includes:
ViprBase, ViprHost, ViprStorageSystem, ViprVcenter
Defined in:
lib/vipruby/vipr.rb

Overview

The base class for the gem. Every subsequent method relies on creating an object from this class

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ViprHost

#add_host, #add_host_initiator, #check_host_get, #check_host_post, #check_host_post_initiator, #deactivate_host, #find_host_object, #generate_host_post_json, #generate_initiators_json, #get_all_hosts, #get_host, #host_exists?

Methods included from ViprStorageSystem

#add_emc_block, #add_emc_file, #add_hitachi, #add_isilon, #add_netapp, #add_scaleio, #add_third_party_block, #add_vplex, #check_storage_provider_payload, #storage_provider_payload, #storage_system_payload

Methods included from ViprVcenter

#add_vcenter, #check_vcenter, #check_vcenter_object_hash, #check_vcenter_post, #delete_vcenter, #find_vcenter_object, #get_all_vcenters, #get_vcenter, #get_vcenter_clusters, #get_vcenter_datacenters, #get_vcenter_hosts

Methods included from ViprBase

#generate_base_url, #get_auth_token, #get_tenant_uid, #login, #rest_get, #rest_post, #to_boolean

Constructor Details

#initialize(base_url, user_name, password, verify_cert) ⇒ Object

Note:

Every POST call requires a Tenant UID to create an object. This variable gets the current logged in tenant information. Nothing else needs to be done if there is a single tenant configured for ViPR If resources need to be added to specific tenants, this variable must be overwritten by specifying the tenant_uid

Initializes a Vipr object that all methods can follow.

Examples:

New Vipruby Object

base_url = 'vipr.mydomain.com'
user_name = 'root'
password = 'mypw'
verify_cert = false
vipr = Vipr.new(base_url,user_name,password,verify_cert)

Parameters:

  • base_url (String)

    The IP address or FQDN of the ViPR appliance. Do not include ‘https’ or port numbers

  • user_name (String)

    Username used to log into ViPR

  • password (String)

    Password used to log into ViPR

  • verify_cert (Boolean)

    Should the cert be SSL verified? Setting it to false will work for development purposes. Should be set to true for production



38
39
40
41
42
43
# File 'lib/vipruby/vipr.rb', line 38

def initialize(base_url,user_name,password,verify_cert)
  @base_url = generate_base_url(base_url)
  @verify_cert = to_boolean(verify_cert)
  @auth_token = get_auth_token(user_name,password)
  @tenant_uid = get_tenant_uid['id']
end

Instance Attribute Details

#auth_tokenObject

required params used for almost every single method



15
16
17
# File 'lib/vipruby/vipr.rb', line 15

def auth_token
  @auth_token
end

#base_urlObject

required params used for almost every single method



15
16
17
# File 'lib/vipruby/vipr.rb', line 15

def base_url
  @base_url
end

#tenant_uidObject

required params used for almost every single method



15
16
17
# File 'lib/vipruby/vipr.rb', line 15

def tenant_uid
  @tenant_uid
end

#verify_certObject

required params used for almost every single method



15
16
17
# File 'lib/vipruby/vipr.rb', line 15

def verify_cert
  @verify_cert
end