Class: Morpheus::APIClient
- Inherits:
-
Object
- Object
- Morpheus::APIClient
show all
- Defined in:
- lib/morpheus/api/api_client.rb
Overview
Direct Known Subclasses
AccountGroupsInterface, ActivityInterface, ApplianceSettingsInterface, ApprovalsInterface, AppsInterface, ArchiveBucketsInterface, ArchiveFilesInterface, AuthInterface, BackupRestoresInterface, BackupResultsInterface, BackupSettingsInterface, BillingInterface, BlueprintsInterface, BudgetsInterface, ClientsInterface, CloudDatastoresInterface, CloudFoldersInterface, CloudPoliciesInterface, CloudResourcePoolsInterface, CloudsInterface, ClustersInterface, ContainersInterface, CustomInstanceTypesInterface, CypherInterface, DashboardInterface, DatastoresInterface, DeployInterface, EmailTemplatesInterface, EnvironmentsInterface, ExecuteSchedulesInterface, ExecutionRequestInterface, FileCopyRequestInterface, ForgotPasswordInterface, GroupPoliciesInterface, GroupsInterface, GuidanceInterface, GuidanceSettingsInterface, HealthInterface, HubInterface, ImageBuilderBootScriptsInterface, ImageBuilderImageBuildsInterface, ImageBuilderInterface, ImageBuilderPreseedScriptsInterface, InstanceTypesInterface, InstancesInterface, InvoicesInterface, JobsInterface, KeyPairsInterface, LibraryClusterLayoutsInterface, LibraryClusterPackagesInterface, LibraryContainerScriptsInterface, LibraryContainerTemplatesInterface, LibraryContainerTypesInterface, LibraryContainerUpgradesInterface, LibraryInstanceTypesInterface, LibraryLayoutsInterface, LibraryOperatingSystemsInterface, LibrarySpecTemplateTypesInterface, LibrarySpecTemplatesInterface, LicenseInterface, LogSettingsInterface, LogsInterface, MonitoringAlertsInterface, MonitoringAppsInterface, MonitoringChecksInterface, MonitoringContactsInterface, MonitoringGroupsInterface, MonitoringIncidentsInterface, MonitoringInterface, MonitoringSettingsInterface, NetworkDomainRecordsInterface, NetworkDomainsInterface, NetworkFloatingIpsInterface, NetworkGroupsInterface, NetworkPoolIpsInterface, NetworkPoolServersInterface, NetworkPoolsInterface, NetworkProxiesInterface, NetworkRoutersInterface, NetworkSecurityServersInterface, NetworkServicesInterface, NetworkSubnetsInterface, NetworkTypesInterface, NetworksInterface, OptionTypeListsInterface, OptionTypesInterface, OptionsInterface, PackagesInterface, PingInterface, PoliciesInterface, PowerSchedulesInterface, PriceSetsInterface, PricesInterface, ProcessesInterface, ProjectsInterface, ProvisionTypesInterface, ProvisioningLicenseTypesInterface, ProvisioningLicensesInterface, ProvisioningSettingsInterface, ReadInterface, ReportsInterface, ResourcePoolGroupsInterface, RestInterface, RolesInterface, SearchInterface, SecondaryReadInterface, SecondaryRestInterface, SecurityGroupRulesInterface, SecurityGroupsInterface, ServerTypesInterface, ServersInterface, ServiceCatalogInterface, ServicePlansInterface, SetupInterface, SnapshotsInterface, StorageProvidersInterface, SubnetTypesInterface, SubnetsInterface, TaskSetsInterface, TasksInterface, UsageInterface, UserGroupsInterface, UserSettingsInterface, UserSourcesInterface, VdiInterface, VirtualImagesInterface, WhitelabelSettingsInterface, WhoamiInterface, WikiInterface
Constant Summary
collapse
- CLIENT_ID =
'morph-cli'
Instance Method Summary
collapse
-
#account_groups ⇒ Object
-
#account_users ⇒ Object
-
#accounts ⇒ Object
-
#activity ⇒ Object
-
#appliance_settings ⇒ Object
-
#approvals ⇒ Object
-
#apps ⇒ Object
-
#archive_buckets ⇒ Object
-
#archive_files ⇒ Object
-
#audit ⇒ Object
-
#auth ⇒ Object
-
#authorization_required? ⇒ Boolean
Authorization is required, except for a couple commands like Ping and Setup.
-
#backup_jobs ⇒ Object
-
#backup_restores ⇒ Object
-
#backup_results ⇒ Object
-
#backup_service_types ⇒ Object
-
#backup_services ⇒ Object
-
#backup_settings ⇒ Object
-
#backup_types ⇒ Object
-
#backups ⇒ Object
-
#billing ⇒ Object
-
#blueprints ⇒ Object
-
#budgets ⇒ Object
-
#catalog ⇒ Object
-
#catalog_item_types ⇒ Object
-
#certificate_types ⇒ Object
-
#certificates ⇒ Object
-
#client_id ⇒ Object
-
#client_id=(val) ⇒ Object
-
#clients ⇒ Object
-
#cloud_datastores ⇒ Object
-
#cloud_folders ⇒ Object
-
#cloud_policies ⇒ Object
-
#cloud_resource_pools ⇒ Object
-
#clouds ⇒ Object
-
#clusters ⇒ Object
-
#common_interface_options ⇒ Object
-
#containers ⇒ Object
-
#credential_types ⇒ Object
-
#credentials ⇒ Object
-
#cypher ⇒ Object
-
#dashboard ⇒ Object
-
#datastores ⇒ Object
-
#default_content_type ⇒ Object
set this in your interface, eg.
-
#default_timeout ⇒ Object
set default seconds for interface to timeout after or let it use system default? none, it should not timeout by default..
-
#deploy ⇒ Object
-
#deployments ⇒ Object
-
#dry ⇒ Object
-
#dry_run(val = true) ⇒ Object
-
#email_templates ⇒ Object
-
#environments ⇒ Object
-
#execute(opts, options = {}) ⇒ Object
Execute an HTTP request with this client.
-
#execute_schedules ⇒ Object
-
#execution_request ⇒ Object
-
#file_copy_request ⇒ Object
-
#forgot ⇒ Object
-
#group_policies ⇒ Object
-
#groups ⇒ Object
-
#guidance ⇒ Object
-
#guidance_settings ⇒ Object
-
#health ⇒ Object
-
#hub ⇒ Object
-
#image_builder ⇒ Object
-
#initialize(access_token, refresh_token = nil, expires_in = nil, base_url = nil, verify_ssl = true, options = {}) ⇒ APIClient
constructor
Initialize a new APIClient client = APIClient.new(url:“morpheus.yourcompany.com”, verify_ssl:false) This old method signature is being deprecated: client = APIClient.new(access_token, refresh_token, expires_in, base_url, verify_ssl, options={}).
-
#inspect ⇒ Object
-
#instance_types ⇒ Object
-
#instances ⇒ Object
-
#integration_types ⇒ Object
-
#integrations ⇒ Object
-
#interface(type) ⇒ Object
(also: #get_interface)
-
#invoice_line_items ⇒ Object
-
#invoices ⇒ Object
-
#jobs ⇒ Object
-
#key_pairs ⇒ Object
-
#library_cluster_layouts ⇒ Object
-
#library_cluster_packages ⇒ Object
-
#library_container_scripts ⇒ Object
-
#library_container_templates ⇒ Object
-
#library_container_types ⇒ Object
-
#library_container_upgrades ⇒ Object
-
#library_instance_types ⇒ Object
-
#library_layouts ⇒ Object
-
#library_operating_systems ⇒ Object
-
#library_spec_template_types ⇒ Object
-
#library_spec_templates ⇒ Object
-
#license ⇒ Object
-
#load_balancer_monitors ⇒ Object
-
#load_balancer_pool_nodes ⇒ Object
-
#load_balancer_pools ⇒ Object
-
#load_balancer_pools_secondary ⇒ Object
-
#load_balancer_profiles ⇒ Object
-
#load_balancer_types ⇒ Object
-
#load_balancer_virtual_servers ⇒ Object
-
#load_balancers ⇒ Object
-
#log_settings ⇒ Object
-
#logged_in? ⇒ Boolean
-
#login(username, password, use_client_id = nil) ⇒ Object
-
#logout ⇒ Object
-
#logs ⇒ Object
-
#monitoring ⇒ Object
-
#monitoring_settings ⇒ Object
-
#network_dhcp_relays ⇒ Object
-
#network_dhcp_servers ⇒ Object
-
#network_domain_records ⇒ Object
-
#network_domains ⇒ Object
-
#network_edge_clusters ⇒ Object
-
#network_floating_ips ⇒ Object
-
#network_groups ⇒ Object
-
#network_pool_ips ⇒ Object
-
#network_pool_server_types ⇒ Object
-
#network_pool_servers ⇒ Object
-
#network_pools ⇒ Object
-
#network_proxies ⇒ Object
-
#network_resource_types ⇒ Object
-
#network_routers ⇒ Object
-
#network_security_server_types ⇒ Object
-
#network_security_servers ⇒ Object
def network_service_types Morpheus::NetworkServiceTypesInterface.new(common_interface_options).setopts(@options) end.
-
#network_server_groups ⇒ Object
-
#network_server_services ⇒ Object
-
#network_server_types ⇒ Object
-
#network_servers ⇒ Object
-
#network_services ⇒ Object
-
#network_static_routes ⇒ Object
-
#network_types ⇒ Object
-
#networks ⇒ Object
-
#old_cypher ⇒ Object
-
#option_type_forms ⇒ Object
-
#option_type_lists ⇒ Object
-
#option_types ⇒ Object
-
#options ⇒ Object
-
#packages ⇒ Object
-
#ping ⇒ Object
-
#plugins ⇒ Object
-
#policies ⇒ Object
def incidents # Morpheus::MonitoringIncidentsInterface.new(common_interface_options).setopts(@options) monitoring.incidents end.
-
#power_schedules ⇒ Object
-
#price_sets ⇒ Object
-
#prices ⇒ Object
-
#processes ⇒ Object
-
#projects ⇒ Object
-
#provision_types ⇒ Object
-
#provisioning_license_types ⇒ Object
-
#provisioning_licenses ⇒ Object
-
#provisioning_settings ⇒ Object
-
#reports ⇒ Object
-
#resource_pool_groups ⇒ Object
-
#rest(endpoint) ⇒ Object
-
#roles ⇒ Object
-
#scale_thresholds ⇒ Object
-
#search ⇒ Object
-
#security_group_rules ⇒ Object
-
#security_groups ⇒ Object
-
#security_package_types ⇒ Object
-
#security_packages ⇒ Object
-
#security_scans ⇒ Object
-
#server_types ⇒ Object
-
#servers ⇒ Object
-
#service_plans ⇒ Object
-
#set_ssl_verification_enabled(val) ⇒ Object
-
#setopts(new_options) ⇒ Object
(also: #set_options)
set common global @options for use with all requests meant for inline use just like dry(), set_options(dry_run:true) can be used in place of dry() Example: Prints curl -XGET …/whoami -H “Bearer” instead of actually request APIClient.new(token).whoami.setopts(curl:true).get({}).
-
#setup ⇒ Object
-
#snapshots ⇒ Object
-
#ssl_verification_enabled? ⇒ Boolean
-
#storage_providers ⇒ Object
-
#storage_server_types ⇒ Object
-
#storage_servers ⇒ Object
-
#storage_volume_types ⇒ Object
-
#storage_volumes ⇒ Object
-
#subnet_types ⇒ Object
-
#subnets ⇒ Object
-
#task_sets ⇒ Object
-
#tasks ⇒ Object
-
#to_s ⇒ Object
-
#url ⇒ Object
-
#usage ⇒ Object
-
#use_refresh_token(t = nil) ⇒ Object
-
#user_groups ⇒ Object
-
#user_settings ⇒ Object
-
#user_sources ⇒ Object
-
#users ⇒ Object
-
#vdi ⇒ Object
-
#vdi_allocations ⇒ Object
-
#vdi_apps ⇒ Object
-
#vdi_gateways ⇒ Object
-
#vdi_pools ⇒ Object
-
#virtual_images ⇒ Object
-
#whitelabel_settings ⇒ Object
-
#whoami ⇒ Object
-
#wiki ⇒ Object
-
#withopts(tmp_options, &block) ⇒ Object
(also: #with_options)
with_options sets common global @options for the duration of the block only then returns the options to their prior values.
Constructor Details
#initialize(access_token, refresh_token = nil, expires_in = nil, base_url = nil, verify_ssl = true, options = {}) ⇒ APIClient
Initialize a new APIClient
client = APIClient.new(url:"https://morpheus.yourcompany.com", verify_ssl:false)
This old method signature is being deprecated:
client = APIClient.new(access_token, refresh_token, expires_in, base_url, verify_ssl, options={})
def initialize(attrs={}, options={})
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/morpheus/api/api_client.rb', line 18
def initialize(access_token, refresh_token=nil,expires_in = nil, base_url=nil, verify_ssl=true, options={})
self.client_id = CLIENT_ID
attrs = {}
if access_token.is_a?(Hash)
attrs = access_token.clone()
access_token = attrs[:access_token]
refresh_token = attrs[:refresh_token]
base_url = attrs[:url] || attrs[:base_url]
expires_in = attrs[:expires_in]
verify_ssl = attrs.key?(:verify_ssl) ? attrs[:verify_ssl] : true
self.client_id = attrs[:client_id] ? attrs[:client_id] : CLIENT_ID
if attrs[:client_id]
self.client_id = attrs[:client_id]
end
options = refresh_token.is_a?(Hash) ? refresh_token.clone() : {}
end
@access_token = access_token
@refresh_token = refresh_token
@base_url = base_url
if @base_url.to_s.empty?
raise "#{self.class} initialized without a required option :url"
end
@base_url = @base_url.chomp("/")
@expires_at = nil
if expires_in != nil
@expires_at = Time.now + expires_in
end
@dry_run = false
set_ssl_verification_enabled(verify_ssl)
setopts(options)
end
|
Instance Method Details
#account_groups ⇒ Object
383
384
385
|
# File 'lib/morpheus/api/api_client.rb', line 383
def account_groups
Morpheus::AccountGroupsInterface.new(common_interface_options).setopts(@options)
end
|
#account_users ⇒ Object
559
560
561
|
# File 'lib/morpheus/api/api_client.rb', line 559
def account_users
Morpheus::AccountUsersInterface.new(common_interface_options).setopts(@options)
end
|
#accounts ⇒ Object
547
548
549
|
# File 'lib/morpheus/api/api_client.rb', line 547
def accounts
Morpheus::AccountsInterface.new(common_interface_options).setopts(@options)
end
|
#activity ⇒ Object
371
372
373
|
# File 'lib/morpheus/api/api_client.rb', line 371
def activity
Morpheus::ActivityInterface.new(common_interface_options).setopts(@options)
end
|
#appliance_settings ⇒ Object
419
420
421
|
# File 'lib/morpheus/api/api_client.rb', line 419
def appliance_settings
Morpheus::ApplianceSettingsInterface.new(common_interface_options).setopts(@options)
end
|
#approvals ⇒ Object
551
552
553
|
# File 'lib/morpheus/api/api_client.rb', line 551
def approvals
Morpheus::ApprovalsInterface.new(common_interface_options).setopts(@options)
end
|
#apps ⇒ Object
519
520
521
|
# File 'lib/morpheus/api/api_client.rb', line 519
def apps
Morpheus::AppsInterface.new(common_interface_options).setopts(@options)
end
|
#archive_buckets ⇒ Object
713
714
715
|
# File 'lib/morpheus/api/api_client.rb', line 713
def archive_buckets
Morpheus::ArchiveBucketsInterface.new(common_interface_options).setopts(@options)
end
|
#archive_files ⇒ Object
717
718
719
|
# File 'lib/morpheus/api/api_client.rb', line 717
def archive_files
Morpheus::ArchiveFilesInterface.new(common_interface_options).setopts(@options)
end
|
#audit ⇒ Object
853
854
855
|
# File 'lib/morpheus/api/api_client.rb', line 853
def audit
Morpheus::AuditInterface.new(common_interface_options).setopts(@options)
end
|
#auth ⇒ Object
347
348
349
|
# File 'lib/morpheus/api/api_client.rb', line 347
def auth
Morpheus::AuthInterface.new({url: @base_url, client_id: @client_id, verify_ssl: @verify_ssl}).setopts(@options)
end
|
#authorization_required? ⇒ Boolean
Authorization is required, except for a couple commands like Ping and Setup
95
96
97
|
# File 'lib/morpheus/api/api_client.rb', line 95
def authorization_required?
true
end
|
#backup_jobs ⇒ Object
881
882
883
|
# File 'lib/morpheus/api/api_client.rb', line 881
def backup_jobs
Morpheus::BackupJobsInterface.new(common_interface_options).setopts(@options)
end
|
#backup_restores ⇒ Object
889
890
891
|
# File 'lib/morpheus/api/api_client.rb', line 889
def backup_restores
Morpheus::BackupRestoresInterface.new(common_interface_options).setopts(@options)
end
|
#backup_results ⇒ Object
885
886
887
|
# File 'lib/morpheus/api/api_client.rb', line 885
def backup_results
Morpheus::BackupResultsInterface.new(common_interface_options).setopts(@options)
end
|
#backup_service_types ⇒ Object
897
898
899
|
# File 'lib/morpheus/api/api_client.rb', line 897
def backup_service_types
Morpheus::BackupServiceTypesInterface.new(common_interface_options).setopts(@options)
end
|
#backup_services ⇒ Object
893
894
895
|
# File 'lib/morpheus/api/api_client.rb', line 893
def backup_services
Morpheus::BackupServicesInterface.new(common_interface_options).setopts(@options)
end
|
#backup_settings ⇒ Object
821
822
823
|
# File 'lib/morpheus/api/api_client.rb', line 821
def backup_settings
Morpheus::BackupSettingsInterface.new(common_interface_options).setopts(@options)
end
|
#backup_types ⇒ Object
901
902
903
|
# File 'lib/morpheus/api/api_client.rb', line 901
def backup_types
Morpheus::BackupTypesInterface.new(common_interface_options).setopts(@options)
end
|
#backups ⇒ Object
877
878
879
|
# File 'lib/morpheus/api/api_client.rb', line 877
def backups
Morpheus::BackupsInterface.new(common_interface_options).setopts(@options)
end
|
#billing ⇒ Object
917
918
919
|
# File 'lib/morpheus/api/api_client.rb', line 917
def billing
Morpheus::BillingInterface.new(common_interface_options).setopts(@options)
end
|
#blueprints ⇒ Object
523
524
525
|
# File 'lib/morpheus/api/api_client.rb', line 523
def blueprints
Morpheus::BlueprintsInterface.new(common_interface_options).setopts(@options)
end
|
#budgets ⇒ Object
857
858
859
|
# File 'lib/morpheus/api/api_client.rb', line 857
def budgets
Morpheus::BudgetsInterface.new(common_interface_options).setopts(@options)
end
|
#catalog ⇒ Object
909
910
911
|
# File 'lib/morpheus/api/api_client.rb', line 909
def catalog
Morpheus::ServiceCatalogInterface.new(common_interface_options).setopts(@options)
end
|
#catalog_item_types ⇒ Object
905
906
907
|
# File 'lib/morpheus/api/api_client.rb', line 905
def catalog_item_types
Morpheus::CatalogItemTypesInterface.new(common_interface_options).setopts(@options)
end
|
#certificate_types ⇒ Object
587
588
589
|
# File 'lib/morpheus/api/api_client.rb', line 587
def certificate_types
Morpheus::CertificateTypesInterface.new(common_interface_options).setopts(@options)
end
|
#certificates ⇒ Object
583
584
585
|
# File 'lib/morpheus/api/api_client.rb', line 583
def certificates
Morpheus::CertificatesInterface.new(common_interface_options).setopts(@options)
end
|
#client_id ⇒ Object
280
281
282
|
# File 'lib/morpheus/api/api_client.rb', line 280
def client_id
@client_id
end
|
#client_id=(val) ⇒ Object
284
285
286
|
# File 'lib/morpheus/api/api_client.rb', line 284
def client_id=(val)
@client_id = val
end
|
#clients ⇒ Object
989
990
991
|
# File 'lib/morpheus/api/api_client.rb', line 989
def clients
Morpheus::ClientsInterface.new(common_interface_options).setopts(@options)
end
|
#cloud_datastores ⇒ Object
391
392
393
|
# File 'lib/morpheus/api/api_client.rb', line 391
def cloud_datastores
Morpheus::CloudDatastoresInterface.new(common_interface_options).setopts(@options)
end
|
#cloud_folders ⇒ Object
403
404
405
|
# File 'lib/morpheus/api/api_client.rb', line 403
def cloud_folders
Morpheus::CloudFoldersInterface.new(common_interface_options).setopts(@options)
end
|
#cloud_policies ⇒ Object
641
642
643
|
# File 'lib/morpheus/api/api_client.rb', line 641
def cloud_policies
Morpheus::CloudPoliciesInterface.new(common_interface_options).setopts(@options)
end
|
#cloud_resource_pools ⇒ Object
395
396
397
|
# File 'lib/morpheus/api/api_client.rb', line 395
def cloud_resource_pools
Morpheus::CloudResourcePoolsInterface.new(common_interface_options).setopts(@options)
end
|
#clouds ⇒ Object
387
388
389
|
# File 'lib/morpheus/api/api_client.rb', line 387
def clouds
Morpheus::CloudsInterface.new(common_interface_options).setopts(@options)
end
|
#clusters ⇒ Object
543
544
545
|
# File 'lib/morpheus/api/api_client.rb', line 543
def clusters
Morpheus::ClustersInterface.new(common_interface_options).setopts(@options)
end
|
#common_interface_options ⇒ Object
328
329
330
331
332
333
334
335
336
337
|
# File 'lib/morpheus/api/api_client.rb', line 328
def common_interface_options
{
url: @base_url,
access_token: @access_token,
refresh_token: @refresh_token,
expires_at: @expires_at,
client_id: @client_id,
verify_ssl: @verify_ssl
}
end
|
#containers ⇒ Object
435
436
437
|
# File 'lib/morpheus/api/api_client.rb', line 435
def containers
Morpheus::ContainersInterface.new(common_interface_options).setopts(@options)
end
|
#credential_types ⇒ Object
985
986
987
|
# File 'lib/morpheus/api/api_client.rb', line 985
def credential_types
Morpheus::CredentialTypesInterface.new(common_interface_options).setopts(@options)
end
|
#credentials ⇒ Object
981
982
983
|
# File 'lib/morpheus/api/api_client.rb', line 981
def credentials
Morpheus::CredentialsInterface.new(common_interface_options).setopts(@options)
end
|
#cypher ⇒ Object
793
794
795
|
# File 'lib/morpheus/api/api_client.rb', line 793
def cypher
Morpheus::CypherInterface.new(common_interface_options).setopts(@options)
end
|
#dashboard ⇒ Object
367
368
369
|
# File 'lib/morpheus/api/api_client.rb', line 367
def dashboard
Morpheus::DashboardInterface.new(common_interface_options).setopts(@options)
end
|
#datastores ⇒ Object
407
408
409
|
# File 'lib/morpheus/api/api_client.rb', line 407
def datastores
Morpheus::DatastoresInterface.new(common_interface_options).setopts(@options)
end
|
#default_content_type ⇒ Object
set this in your interface, eg. to ‘application/json’ or let it it default to json when payload is present.
82
83
84
|
# File 'lib/morpheus/api/api_client.rb', line 82
def default_content_type
nil
end
|
#default_timeout ⇒ Object
set default seconds for interface to timeout after or let it use system default? none, it should not timeout by default.. I think execute() may use 30 seconds for get by default. and it should remove timeout when method is post, put, or delete
90
91
92
|
# File 'lib/morpheus/api/api_client.rb', line 90
def default_timeout
nil
end
|
#deploy ⇒ Object
527
528
529
|
# File 'lib/morpheus/api/api_client.rb', line 527
def deploy
Morpheus::DeployInterface.new(common_interface_options).setopts(@options)
end
|
#deployments ⇒ Object
531
532
533
|
# File 'lib/morpheus/api/api_client.rb', line 531
def deployments
Morpheus::DeploymentsInterface.new(common_interface_options).setopts(@options)
end
|
#dry ⇒ Object
68
69
70
|
# File 'lib/morpheus/api/api_client.rb', line 68
def dry()
dry_run(true)
end
|
#dry_run(val = true) ⇒ Object
63
64
65
66
|
# File 'lib/morpheus/api/api_client.rb', line 63
def dry_run(val=true)
@dry_run = !!val
self
end
|
#email_templates ⇒ Object
1009
1010
1011
|
# File 'lib/morpheus/api/api_client.rb', line 1009
def email_templates
Morpheus::EmailTemplatesInterface.new(common_interface_options).setopts(@options)
end
|
#environments ⇒ Object
817
818
819
|
# File 'lib/morpheus/api/api_client.rb', line 817
def environments
Morpheus::EnvironmentsInterface.new(common_interface_options).setopts(@options)
end
|
#execute(opts, options = {}) ⇒ Object
Execute an HTTP request with this client. opts - Hash of options for HTTP Request.
:url - The full url
:method - The default method is :get (GET)
:headers - Hash of to include in the request.
eg. {'Content-Type' => 'application/json'}. :params is a special key for query parameters.
:params - query parameters
:payload - The body of the request.
:timeout - A custom timeout in seconds for api requests. The default is 30. todo: separate timeout options
options - Hash of common global options that commands parse. eg. :headers, :timeout, :dry_run, :curl, etc
:headers - to add. This expects a Hash like {'Content-Type' => 'application/json'}.
:timeout - A custom timeout in seconds for api requests. The default is 30. todo: separate timeout options
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
# File 'lib/morpheus/api/api_client.rb', line 152
def execute(opts, options={})
if opts[:url]
if !opts[:url].include?(@base_url)
opts[:url] = "#{@base_url}#{opts[:url]}"
end
end
if @options
options = options.merge(@options)
else
options = options.clone
end
if opts[:method].nil?
opts[:method] = :get
else
opts[:method] = opts[:method].to_s.downcase.to_sym
end
opts[:headers] ||= {}
is_multipart = (opts[:payload].is_a?(Hash) && opts[:payload][:multipart] == true)
if authorization_required?
if @access_token
if opts[:headers][:authorization].nil? && opts[:headers]['Authorization'].nil?
opts[:headers][:authorization] = "Bearer #{@access_token}"
else
end
end
end
if opts[:method] == :post || opts[:method] == :put
if opts[:headers]['Content-Type'].nil? && opts[:payload] && is_multipart != true && opts[:form_data] != true
opts[:headers]['Content-Type'] = (default_content_type || 'application/json')
end
if opts[:headers]['Content-Type'] == 'application/json' && !opts[:payload].is_a?(String)
opts[:payload] = opts[:payload].to_json
end
end
if opts[:timeout].nil?
if options[:timeout]
opts[:timeout] = options[:timeout].to_f
elsif default_timeout && opts[:method] == :get
opts[:timeout] = default_timeout.to_f
end
end
if options[:headers]
opts[:headers] = opts[:headers].merge(options[:headers])
end
if @verify_ssl == false
opts[:verify_ssl] = OpenSSL::SSL::VERIFY_NONE
end
if @dry_run
opts[:command_options] = options
return opts
end
response = Morpheus::RestClient.execute(opts)
if opts[:parse_json] != false && options[:parse_json] != false
return JSON.parse(response.to_s)
else
return response
end
end
|
#execute_schedules ⇒ Object
615
616
617
|
# File 'lib/morpheus/api/api_client.rb', line 615
def execute_schedules
Morpheus::ExecuteSchedulesInterface.new(common_interface_options).setopts(@options)
end
|
#execution_request ⇒ Object
801
802
803
|
# File 'lib/morpheus/api/api_client.rb', line 801
def execution_request
Morpheus::ExecutionRequestInterface.new(common_interface_options).setopts(@options)
end
|
#file_copy_request ⇒ Object
805
806
807
|
# File 'lib/morpheus/api/api_client.rb', line 805
def file_copy_request
Morpheus::FileCopyRequestInterface.new(common_interface_options).setopts(@options)
end
|
#forgot ⇒ Object
351
352
353
|
# File 'lib/morpheus/api/api_client.rb', line 351
def forgot
Morpheus::ForgotPasswordInterface.new(common_interface_options).setopts(@options)
end
|
#group_policies ⇒ Object
637
638
639
|
# File 'lib/morpheus/api/api_client.rb', line 637
def group_policies
Morpheus::GroupPoliciesInterface.new(common_interface_options).setopts(@options)
end
|
#groups ⇒ Object
379
380
381
|
# File 'lib/morpheus/api/api_client.rb', line 379
def groups
Morpheus::GroupsInterface.new(common_interface_options).setopts(@options)
end
|
#guidance ⇒ Object
869
870
871
|
# File 'lib/morpheus/api/api_client.rb', line 869
def guidance
Morpheus::GuidanceInterface.new(common_interface_options).setopts(@options)
end
|
#guidance_settings ⇒ Object
825
826
827
|
# File 'lib/morpheus/api/api_client.rb', line 825
def guidance_settings
Morpheus::GuidanceSettingsInterface.new(common_interface_options).setopts(@options)
end
|
#health ⇒ Object
845
846
847
|
# File 'lib/morpheus/api/api_client.rb', line 845
def health
Morpheus::HealthInterface.new(common_interface_options).setopts(@options)
end
|
#hub ⇒ Object
849
850
851
|
# File 'lib/morpheus/api/api_client.rb', line 849
def hub
Morpheus::HubInterface.new(common_interface_options).setopts(@options)
end
|
#image_builder ⇒ Object
721
722
723
|
# File 'lib/morpheus/api/api_client.rb', line 721
def image_builder
Morpheus::ImageBuilderInterface.new(common_interface_options).setopts(@options)
end
|
#inspect ⇒ Object
59
60
61
|
# File 'lib/morpheus/api/api_client.rb', line 59
def inspect
to_s
end
|
#instance_types ⇒ Object
439
440
441
|
# File 'lib/morpheus/api/api_client.rb', line 439
def instance_types
Morpheus::InstanceTypesInterface.new(common_interface_options).setopts(@options)
end
|
#instances ⇒ Object
415
416
417
|
# File 'lib/morpheus/api/api_client.rb', line 415
def instances
Morpheus::InstancesInterface.new(common_interface_options).setopts(@options)
end
|
#integration_types ⇒ Object
447
448
449
|
# File 'lib/morpheus/api/api_client.rb', line 447
def integration_types
Morpheus::IntegrationTypesInterface.new(common_interface_options).setopts(@options)
end
|
#integrations ⇒ Object
443
444
445
|
# File 'lib/morpheus/api/api_client.rb', line 443
def integrations
Morpheus::IntegrationsInterface.new(common_interface_options).setopts(@options)
end
|
#interface(type) ⇒ Object
Also known as:
get_interface
1021
1022
1023
1024
1025
1026
1027
1028
|
# File 'lib/morpheus/api/api_client.rb', line 1021
def interface(type)
type = type.to_s.singularize.underscore
interface_name = type.pluralize
if !respond_to?(interface_name)
raise "#{self.class} has not defined an interface method named '#{interface_name}'"
end
return send(interface_name)
end
|
#invoice_line_items ⇒ Object
865
866
867
|
# File 'lib/morpheus/api/api_client.rb', line 865
def invoice_line_items
Morpheus::InvoiceLineItemsInterface.new(common_interface_options).setopts(@options)
end
|
#invoices ⇒ Object
861
862
863
|
# File 'lib/morpheus/api/api_client.rb', line 861
def invoices
Morpheus::InvoicesInterface.new(common_interface_options).setopts(@options)
end
|
#jobs ⇒ Object
451
452
453
|
# File 'lib/morpheus/api/api_client.rb', line 451
def jobs
Morpheus::JobsInterface.new(common_interface_options).setopts(@options)
end
|
#key_pairs ⇒ Object
579
580
581
|
# File 'lib/morpheus/api/api_client.rb', line 579
def key_pairs
Morpheus::KeyPairsInterface.new(common_interface_options).setopts(@options)
end
|
#library_cluster_layouts ⇒ Object
769
770
771
|
# File 'lib/morpheus/api/api_client.rb', line 769
def library_cluster_layouts
Morpheus::LibraryClusterLayoutsInterface.new(common_interface_options).setopts(@options)
end
|
#library_cluster_packages ⇒ Object
773
774
775
|
# File 'lib/morpheus/api/api_client.rb', line 773
def library_cluster_packages
Morpheus::LibraryClusterPackagesInterface.new(common_interface_options).setopts(@options)
end
|
#library_container_scripts ⇒ Object
761
762
763
|
# File 'lib/morpheus/api/api_client.rb', line 761
def library_container_scripts
Morpheus::LibraryContainerScriptsInterface.new(common_interface_options).setopts(@options)
end
|
#library_container_templates ⇒ Object
765
766
767
|
# File 'lib/morpheus/api/api_client.rb', line 765
def library_container_templates
Morpheus::LibraryContainerTemplatesInterface.new(common_interface_options).setopts(@options)
end
|
#library_container_types ⇒ Object
757
758
759
|
# File 'lib/morpheus/api/api_client.rb', line 757
def library_container_types
Morpheus::LibraryContainerTypesInterface.new(common_interface_options).setopts(@options)
end
|
#library_container_upgrades ⇒ Object
753
754
755
|
# File 'lib/morpheus/api/api_client.rb', line 753
def library_container_upgrades
Morpheus::LibraryContainerUpgradesInterface.new(common_interface_options).setopts(@options)
end
|
#library_instance_types ⇒ Object
745
746
747
|
# File 'lib/morpheus/api/api_client.rb', line 745
def library_instance_types
Morpheus::LibraryInstanceTypesInterface.new(common_interface_options).setopts(@options)
end
|
#library_layouts ⇒ Object
749
750
751
|
# File 'lib/morpheus/api/api_client.rb', line 749
def library_layouts
Morpheus::LibraryLayoutsInterface.new(common_interface_options).setopts(@options)
end
|
#library_operating_systems ⇒ Object
1013
1014
1015
|
# File 'lib/morpheus/api/api_client.rb', line 1013
def library_operating_systems
Morpheus::LibraryOperatingSystemsInterface.new(common_interface_options).setopts(@options)
end
|
#library_spec_template_types ⇒ Object
781
782
783
|
# File 'lib/morpheus/api/api_client.rb', line 781
def library_spec_template_types
Morpheus::LibrarySpecTemplateTypesInterface.new(common_interface_options).setopts(@options)
end
|
#library_spec_templates ⇒ Object
777
778
779
|
# File 'lib/morpheus/api/api_client.rb', line 777
def library_spec_templates
Morpheus::LibrarySpecTemplatesInterface.new(common_interface_options).setopts(@options)
end
|
#license ⇒ Object
591
592
593
|
# File 'lib/morpheus/api/api_client.rb', line 591
def license
Morpheus::LicenseInterface.new(common_interface_options).setopts(@options)
end
|
#load_balancer_monitors ⇒ Object
499
500
501
|
# File 'lib/morpheus/api/api_client.rb', line 499
def load_balancer_monitors
Morpheus::LoadBalancerMonitorsInterface.new(common_interface_options).setopts(@options)
end
|
#load_balancer_pool_nodes ⇒ Object
503
504
505
|
# File 'lib/morpheus/api/api_client.rb', line 503
def load_balancer_pool_nodes
Morpheus::LoadBalancerPoolNodesInterface.new(common_interface_options).setopts(@options)
end
|
#load_balancer_pools ⇒ Object
487
488
489
|
# File 'lib/morpheus/api/api_client.rb', line 487
def load_balancer_pools
Morpheus::LoadBalancerPoolsInterface.new(common_interface_options).setopts(@options)
end
|
#load_balancer_pools_secondary ⇒ Object
491
492
493
|
# File 'lib/morpheus/api/api_client.rb', line 491
def load_balancer_pools_secondary
Morpheus::LoadBalancerPoolsSecondaryInterface.new(common_interface_options).setopts(@options)
end
|
#load_balancer_profiles ⇒ Object
495
496
497
|
# File 'lib/morpheus/api/api_client.rb', line 495
def load_balancer_profiles
Morpheus::LoadBalancerProfilesInterface.new(common_interface_options).setopts(@options)
end
|
#load_balancer_types ⇒ Object
479
480
481
|
# File 'lib/morpheus/api/api_client.rb', line 479
def load_balancer_types
Morpheus::LoadBalancerTypesInterface.new(common_interface_options).setopts(@options)
end
|
#load_balancer_virtual_servers ⇒ Object
483
484
485
|
# File 'lib/morpheus/api/api_client.rb', line 483
def load_balancer_virtual_servers
Morpheus::LoadBalancerVirtualServersInterface.new(common_interface_options).setopts(@options)
end
|
#load_balancers ⇒ Object
475
476
477
|
# File 'lib/morpheus/api/api_client.rb', line 475
def load_balancers
Morpheus::LoadBalancersInterface.new(common_interface_options).setopts(@options)
end
|
#log_settings ⇒ Object
829
830
831
|
# File 'lib/morpheus/api/api_client.rb', line 829
def log_settings
Morpheus::LogSettingsInterface.new(common_interface_options).setopts(@options)
end
|
#logged_in? ⇒ Boolean
276
277
278
|
# File 'lib/morpheus/api/api_client.rb', line 276
def logged_in?
!!@access_token
end
|
#login(username, password, use_client_id = nil) ⇒ Object
288
289
290
291
292
293
294
295
296
297
298
299
300
301
|
# File 'lib/morpheus/api/api_client.rb', line 288
def login(username, password, use_client_id=nil)
if use_client_id
self.client_id = use_client_id
end
@access_token, @refresh_token, @expires_at = nil, nil, nil
response = auth.login(username, password, self.client_id)
@access_token = response['access_token']
@refresh_token = response['refresh_token']
if response['expires_in'] != nil
@expires_at = Time.now + response['expires_in']
end
return self
end
|
#logout ⇒ Object
321
322
323
324
325
326
|
# File 'lib/morpheus/api/api_client.rb', line 321
def logout
@access_token = nil
@refresh_token = nil
@expires_at = nil
return self
end
|
#logs ⇒ Object
571
572
573
|
# File 'lib/morpheus/api/api_client.rb', line 571
def logs
Morpheus::LogsInterface.new(common_interface_options).setopts(@options)
end
|
#monitoring ⇒ Object
619
620
621
|
# File 'lib/morpheus/api/api_client.rb', line 619
def monitoring
Morpheus::MonitoringInterface.new(common_interface_options).setopts(@options)
end
|
#monitoring_settings ⇒ Object
833
834
835
|
# File 'lib/morpheus/api/api_client.rb', line 833
def monitoring_settings
Morpheus::MonitoringSettingsInterface.new(common_interface_options).setopts(@options)
end
|
#network_dhcp_relays ⇒ Object
969
970
971
|
# File 'lib/morpheus/api/api_client.rb', line 969
def network_dhcp_relays
Morpheus::NetworkDhcpRelaysInterface.new(common_interface_options).setopts(@options)
end
|
#network_dhcp_servers ⇒ Object
965
966
967
|
# File 'lib/morpheus/api/api_client.rb', line 965
def network_dhcp_servers
Morpheus::NetworkDhcpServersInterface.new(common_interface_options).setopts(@options)
end
|
#network_domain_records ⇒ Object
705
706
707
|
# File 'lib/morpheus/api/api_client.rb', line 705
def network_domain_records
Morpheus::NetworkDomainRecordsInterface.new(common_interface_options).setopts(@options)
end
|
#network_domains ⇒ Object
701
702
703
|
# File 'lib/morpheus/api/api_client.rb', line 701
def network_domains
Morpheus::NetworkDomainsInterface.new(common_interface_options).setopts(@options)
end
|
#network_edge_clusters ⇒ Object
961
962
963
|
# File 'lib/morpheus/api/api_client.rb', line 961
def network_edge_clusters
Morpheus::NetworkEdgeClustersInterface.new(common_interface_options).setopts(@options)
end
|
#network_floating_ips ⇒ Object
1005
1006
1007
|
# File 'lib/morpheus/api/api_client.rb', line 1005
def network_floating_ips
Morpheus::NetworkFloatingIpsInterface.new(common_interface_options).setopts(@options)
end
|
#network_groups ⇒ Object
661
662
663
|
# File 'lib/morpheus/api/api_client.rb', line 661
def network_groups
Morpheus::NetworkGroupsInterface.new(common_interface_options).setopts(@options)
end
|
#network_pool_ips ⇒ Object
669
670
671
|
# File 'lib/morpheus/api/api_client.rb', line 669
def network_pool_ips
Morpheus::NetworkPoolIpsInterface.new(common_interface_options).setopts(@options)
end
|
#network_pool_server_types ⇒ Object
697
698
699
|
# File 'lib/morpheus/api/api_client.rb', line 697
def network_pool_server_types
Morpheus::NetworkPoolServerTypesInterface.new(common_interface_options).setopts(@options)
end
|
#network_pool_servers ⇒ Object
693
694
695
|
# File 'lib/morpheus/api/api_client.rb', line 693
def network_pool_servers
Morpheus::NetworkPoolServersInterface.new(common_interface_options).setopts(@options)
end
|
#network_pools ⇒ Object
665
666
667
|
# File 'lib/morpheus/api/api_client.rb', line 665
def network_pools
Morpheus::NetworkPoolsInterface.new(common_interface_options).setopts(@options)
end
|
#network_proxies ⇒ Object
709
710
711
|
# File 'lib/morpheus/api/api_client.rb', line 709
def network_proxies
Morpheus::NetworkProxiesInterface.new(common_interface_options).setopts(@options)
end
|
#network_resource_types ⇒ Object
957
958
959
|
# File 'lib/morpheus/api/api_client.rb', line 957
def network_resource_types
Morpheus::NetworkResourceTypesInterface.new(common_interface_options).setopts(@options)
end
|
#network_routers ⇒ Object
673
674
675
|
# File 'lib/morpheus/api/api_client.rb', line 673
def network_routers
Morpheus::NetworkRoutersInterface.new(common_interface_options).setopts(@options)
end
|
#network_security_server_types ⇒ Object
689
690
691
|
# File 'lib/morpheus/api/api_client.rb', line 689
def network_security_server_types
Morpheus::NetworkSecurityServerTypesInterface.new(common_interface_options).setopts(@options)
end
|
#network_security_servers ⇒ Object
def network_service_types
Morpheus::NetworkServiceTypesInterface.new(common_interface_options).setopts(@options)
end
685
686
687
|
# File 'lib/morpheus/api/api_client.rb', line 685
def network_security_servers
Morpheus::NetworkSecurityServersInterface.new(common_interface_options).setopts(@options)
end
|
#network_server_groups ⇒ Object
949
950
951
|
# File 'lib/morpheus/api/api_client.rb', line 949
def network_server_groups
Morpheus::NetworkServerGroupsInterface.new(common_interface_options).setopts(@options)
end
|
#network_server_services ⇒ Object
953
954
955
|
# File 'lib/morpheus/api/api_client.rb', line 953
def network_server_services
Morpheus::NetworkServerServicesInterface.new(common_interface_options).setopts(@options)
end
|
#network_server_types ⇒ Object
945
946
947
|
# File 'lib/morpheus/api/api_client.rb', line 945
def network_server_types
Morpheus::NetworkServerTypesInterface.new(common_interface_options).setopts(@options)
end
|
#network_servers ⇒ Object
941
942
943
|
# File 'lib/morpheus/api/api_client.rb', line 941
def network_servers
Morpheus::NetworkServersInterface.new(common_interface_options).setopts(@options)
end
|
#network_services ⇒ Object
677
678
679
|
# File 'lib/morpheus/api/api_client.rb', line 677
def network_services
Morpheus::NetworkServicesInterface.new(common_interface_options).setopts(@options)
end
|
#network_static_routes ⇒ Object
973
974
975
|
# File 'lib/morpheus/api/api_client.rb', line 973
def network_static_routes
Morpheus::NetworkStaticRoutesInterface.new(common_interface_options).setopts(@options)
end
|
#network_types ⇒ Object
649
650
651
|
# File 'lib/morpheus/api/api_client.rb', line 649
def network_types
Morpheus::NetworkTypesInterface.new(common_interface_options).setopts(@options)
end
|
#networks ⇒ Object
645
646
647
|
# File 'lib/morpheus/api/api_client.rb', line 645
def networks
Morpheus::NetworksInterface.new(common_interface_options).setopts(@options)
end
|
#old_cypher ⇒ Object
797
798
799
|
# File 'lib/morpheus/api/api_client.rb', line 797
def old_cypher
Morpheus::OldCypherInterface.new(common_interface_options).setopts(@options)
end
|
603
604
605
|
# File 'lib/morpheus/api/api_client.rb', line 603
def option_type_forms
Morpheus::OptionTypeFormsInterface.new(common_interface_options).setopts(@options)
end
|
#option_type_lists ⇒ Object
599
600
601
|
# File 'lib/morpheus/api/api_client.rb', line 599
def option_type_lists
Morpheus::OptionTypeListsInterface.new(common_interface_options).setopts(@options)
end
|
#option_types ⇒ Object
595
596
597
|
# File 'lib/morpheus/api/api_client.rb', line 595
def option_types
Morpheus::OptionTypesInterface.new(common_interface_options).setopts(@options)
end
|
#options ⇒ Object
375
376
377
|
# File 'lib/morpheus/api/api_client.rb', line 375
def options
Morpheus::OptionsInterface.new(common_interface_options).setopts(@options)
end
|
#packages ⇒ Object
785
786
787
|
# File 'lib/morpheus/api/api_client.rb', line 785
def packages
Morpheus::PackagesInterface.new(common_interface_options).setopts(@options)
end
|
#ping ⇒ Object
339
340
341
|
# File 'lib/morpheus/api/api_client.rb', line 339
def ping
Morpheus::PingInterface.new(common_interface_options).setopts(@options)
end
|
#plugins ⇒ Object
789
790
791
|
# File 'lib/morpheus/api/api_client.rb', line 789
def plugins
Morpheus::PluginsInterface.new(common_interface_options).setopts(@options)
end
|
#policies ⇒ Object
def incidents
monitoring.incidents
end
633
634
635
|
# File 'lib/morpheus/api/api_client.rb', line 633
def policies
Morpheus::PoliciesInterface.new(common_interface_options).setopts(@options)
end
|
#power_schedules ⇒ Object
611
612
613
|
# File 'lib/morpheus/api/api_client.rb', line 611
def power_schedules
Morpheus::PowerSchedulesInterface.new(common_interface_options).setopts(@options)
end
|
#price_sets ⇒ Object
467
468
469
|
# File 'lib/morpheus/api/api_client.rb', line 467
def price_sets
Morpheus::PriceSetsInterface.new(common_interface_options).setopts(@options)
end
|
#prices ⇒ Object
471
472
473
|
# File 'lib/morpheus/api/api_client.rb', line 471
def prices
Morpheus::PricesInterface.new(common_interface_options).setopts(@options)
end
|
#processes ⇒ Object
809
810
811
|
# File 'lib/morpheus/api/api_client.rb', line 809
def processes
Morpheus::ProcessesInterface.new(common_interface_options).setopts(@options)
end
|
#projects ⇒ Object
873
874
875
|
# File 'lib/morpheus/api/api_client.rb', line 873
def projects
Morpheus::ProjectsInterface.new(common_interface_options).setopts(@options)
end
|
#provision_types ⇒ Object
459
460
461
|
# File 'lib/morpheus/api/api_client.rb', line 459
def provision_types
Morpheus::ProvisionTypesInterface.new(common_interface_options).setopts(@options)
end
|
#provisioning_license_types ⇒ Object
431
432
433
|
# File 'lib/morpheus/api/api_client.rb', line 431
def provisioning_license_types
Morpheus::ProvisioningLicenseTypesInterface.new(common_interface_options).setopts(@options)
end
|
#provisioning_licenses ⇒ Object
427
428
429
|
# File 'lib/morpheus/api/api_client.rb', line 427
def provisioning_licenses
Morpheus::ProvisioningLicensesInterface.new(common_interface_options).setopts(@options)
end
|
#provisioning_settings ⇒ Object
423
424
425
|
# File 'lib/morpheus/api/api_client.rb', line 423
def provisioning_settings
Morpheus::ProvisioningSettingsInterface.new(common_interface_options).setopts(@options)
end
|
#reports ⇒ Object
813
814
815
|
# File 'lib/morpheus/api/api_client.rb', line 813
def reports
Morpheus::ReportsInterface.new(common_interface_options).setopts(@options)
end
|
#resource_pool_groups ⇒ Object
399
400
401
|
# File 'lib/morpheus/api/api_client.rb', line 399
def resource_pool_groups
Morpheus::ResourcePoolGroupsInterface.new(common_interface_options).setopts(@options)
end
|
#rest(endpoint) ⇒ Object
1017
1018
1019
|
# File 'lib/morpheus/api/api_client.rb', line 1017
def rest(endpoint)
Morpheus::RestInterface.new(common_interface_options).setopts(@options.merge({base_path: "#{@base_url}/api/#{endpoint}"}))
end
|
#roles ⇒ Object
575
576
577
|
# File 'lib/morpheus/api/api_client.rb', line 575
def roles
Morpheus::RolesInterface.new(common_interface_options).setopts(@options)
end
|
#scale_thresholds ⇒ Object
607
608
609
|
# File 'lib/morpheus/api/api_client.rb', line 607
def scale_thresholds
Morpheus::ScaleThresholdsInterface.new(common_interface_options).setopts(@options)
end
|
#search ⇒ Object
359
360
361
|
# File 'lib/morpheus/api/api_client.rb', line 359
def search
Morpheus::SearchInterface.new(common_interface_options).setopts(@options)
end
|
#security_group_rules ⇒ Object
539
540
541
|
# File 'lib/morpheus/api/api_client.rb', line 539
def security_group_rules
Morpheus::SecurityGroupRulesInterface.new(common_interface_options).setopts(@options)
end
|
#security_groups ⇒ Object
535
536
537
|
# File 'lib/morpheus/api/api_client.rb', line 535
def security_groups
Morpheus::SecurityGroupsInterface.new(common_interface_options).setopts(@options)
end
|
#security_package_types ⇒ Object
997
998
999
|
# File 'lib/morpheus/api/api_client.rb', line 997
def security_package_types
Morpheus::SecurityPackageTypesInterface.new(common_interface_options).setopts(@options)
end
|
#security_packages ⇒ Object
993
994
995
|
# File 'lib/morpheus/api/api_client.rb', line 993
def security_packages
Morpheus::SecurityPackagesInterface.new(common_interface_options).setopts(@options)
end
|
#security_scans ⇒ Object
1001
1002
1003
|
# File 'lib/morpheus/api/api_client.rb', line 1001
def security_scans
Morpheus::SecurityScansInterface.new(common_interface_options).setopts(@options)
end
|
#server_types ⇒ Object
455
456
457
|
# File 'lib/morpheus/api/api_client.rb', line 455
def server_types
Morpheus::ServerTypesInterface.new(common_interface_options).setopts(@options)
end
|
#servers ⇒ Object
411
412
413
|
# File 'lib/morpheus/api/api_client.rb', line 411
def servers
Morpheus::ServersInterface.new(common_interface_options).setopts(@options)
end
|
#service_plans ⇒ Object
463
464
465
|
# File 'lib/morpheus/api/api_client.rb', line 463
def service_plans
Morpheus::ServicePlansInterface.new(common_interface_options).setopts(@options)
end
|
#set_ssl_verification_enabled(val) ⇒ Object
76
77
78
|
# File 'lib/morpheus/api/api_client.rb', line 76
def set_ssl_verification_enabled(val)
@verify_ssl = !!val
end
|
#setopts(new_options) ⇒ Object
Also known as:
set_options
set common global @options for use with all requests meant for inline use just like dry(), set_options(dry_run:true) can be used in place of dry() Example: Prints curl -XGET …/whoami -H “Bearer” instead of actually request APIClient.new(token).whoami.setopts(curl:true).get({})
115
116
117
118
119
120
121
|
# File 'lib/morpheus/api/api_client.rb', line 115
def setopts(new_options)
@options = new_options
if @options[:dry_run]
dry_run(true)
end
self
end
|
#setup ⇒ Object
343
344
345
|
# File 'lib/morpheus/api/api_client.rb', line 343
def setup
Morpheus::SetupInterface.new(common_interface_options).setopts(@options)
end
|
#snapshots ⇒ Object
977
978
979
|
# File 'lib/morpheus/api/api_client.rb', line 977
def snapshots
Morpheus::SnapshotsInterface.new(common_interface_options).setopts(@options)
end
|
#ssl_verification_enabled? ⇒ Boolean
72
73
74
|
# File 'lib/morpheus/api/api_client.rb', line 72
def ssl_verification_enabled?
@verify_ssl
end
|
#storage_providers ⇒ Object
725
726
727
|
# File 'lib/morpheus/api/api_client.rb', line 725
def storage_providers
Morpheus::StorageProvidersInterface.new(common_interface_options).setopts(@options)
end
|
#storage_server_types ⇒ Object
733
734
735
|
# File 'lib/morpheus/api/api_client.rb', line 733
def storage_server_types
Morpheus::StorageServerTypesInterface.new(common_interface_options).setopts(@options)
end
|
#storage_servers ⇒ Object
729
730
731
|
# File 'lib/morpheus/api/api_client.rb', line 729
def storage_servers
Morpheus::StorageServersInterface.new(common_interface_options).setopts(@options)
end
|
#storage_volume_types ⇒ Object
741
742
743
|
# File 'lib/morpheus/api/api_client.rb', line 741
def storage_volume_types
Morpheus::StorageVolumeTypesInterface.new(common_interface_options).setopts(@options)
end
|
#storage_volumes ⇒ Object
737
738
739
|
# File 'lib/morpheus/api/api_client.rb', line 737
def storage_volumes
Morpheus::StorageVolumesInterface.new(common_interface_options).setopts(@options)
end
|
#subnet_types ⇒ Object
657
658
659
|
# File 'lib/morpheus/api/api_client.rb', line 657
def subnet_types
Morpheus::SubnetTypesInterface.new(common_interface_options).setopts(@options)
end
|
#subnets ⇒ Object
653
654
655
|
# File 'lib/morpheus/api/api_client.rb', line 653
def subnets
Morpheus::SubnetsInterface.new(common_interface_options).setopts(@options)
end
|
#task_sets ⇒ Object
511
512
513
|
# File 'lib/morpheus/api/api_client.rb', line 511
def task_sets
Morpheus::TaskSetsInterface.new(common_interface_options).setopts(@options)
end
|
#tasks ⇒ Object
507
508
509
|
# File 'lib/morpheus/api/api_client.rb', line 507
def tasks
Morpheus::TasksInterface.new(common_interface_options).setopts(@options)
end
|
#to_s ⇒ Object
55
56
57
|
# File 'lib/morpheus/api/api_client.rb', line 55
def to_s
"<##{self.class}:#{self.object_id.to_s(8)} @url=#{@base_url} @verify_ssl=#{@verify_ssl} @access_token=#{@access_token ? '************' : nil} @refresh_token=#{@access_token ? '************' : nil} @expires_at=#{@expires_at} @client_id=#{@client_id} @options=#{@options}>"
end
|
#url ⇒ Object
51
52
53
|
# File 'lib/morpheus/api/api_client.rb', line 51
def url
@base_url
end
|
#usage ⇒ Object
913
914
915
|
# File 'lib/morpheus/api/api_client.rb', line 913
def usage
Morpheus::UsageInterface.new(common_interface_options).setopts(@options)
end
|
#use_refresh_token(t = nil) ⇒ Object
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
# File 'lib/morpheus/api/api_client.rb', line 303
def use_refresh_token(t=nil)
if t.nil?
t = @refresh_token
end
if t.nil?
raise "#{self.class} does not currently have a refresh_token"
end
response = auth.use_refresh_token(t, self.client_id)
@access_token = response['access_token']
@refresh_token = response['refresh_token']
if response['expires_in'] != nil
@expires_at = Time.now + response['expires_in']
end
@access_token = response['access_token']
return self
end
|
#user_groups ⇒ Object
563
564
565
|
# File 'lib/morpheus/api/api_client.rb', line 563
def user_groups
Morpheus::UserGroupsInterface.new(common_interface_options).setopts(@options)
end
|
#user_settings ⇒ Object
363
364
365
|
# File 'lib/morpheus/api/api_client.rb', line 363
def user_settings
Morpheus::UserSettingsInterface.new(common_interface_options).setopts(@options)
end
|
#user_sources ⇒ Object
567
568
569
|
# File 'lib/morpheus/api/api_client.rb', line 567
def user_sources
Morpheus::UserSourcesInterface.new(common_interface_options).setopts(@options)
end
|
#users ⇒ Object
555
556
557
|
# File 'lib/morpheus/api/api_client.rb', line 555
def users
Morpheus::UsersInterface.new(common_interface_options).setopts(@options)
end
|
#vdi ⇒ Object
921
922
923
|
# File 'lib/morpheus/api/api_client.rb', line 921
def vdi
Morpheus::VdiInterface.new(common_interface_options).setopts(@options)
end
|
#vdi_allocations ⇒ Object
929
930
931
|
# File 'lib/morpheus/api/api_client.rb', line 929
def vdi_allocations
Morpheus::VdiAllocationsInterface.new(common_interface_options).setopts(@options)
end
|
#vdi_apps ⇒ Object
933
934
935
|
# File 'lib/morpheus/api/api_client.rb', line 933
def vdi_apps
Morpheus::VdiAppsInterface.new(common_interface_options).setopts(@options)
end
|
#vdi_gateways ⇒ Object
937
938
939
|
# File 'lib/morpheus/api/api_client.rb', line 937
def vdi_gateways
Morpheus::VdiGatewaysInterface.new(common_interface_options).setopts(@options)
end
|
#vdi_pools ⇒ Object
925
926
927
|
# File 'lib/morpheus/api/api_client.rb', line 925
def vdi_pools
Morpheus::VdiPoolsInterface.new(common_interface_options).setopts(@options)
end
|
#virtual_images ⇒ Object
515
516
517
|
# File 'lib/morpheus/api/api_client.rb', line 515
def virtual_images
Morpheus::VirtualImagesInterface.new(common_interface_options).setopts(@options)
end
|
#whitelabel_settings ⇒ Object
837
838
839
|
# File 'lib/morpheus/api/api_client.rb', line 837
def whitelabel_settings
Morpheus::WhitelabelSettingsInterface.new(common_interface_options).setopts(@options)
end
|
#whoami ⇒ Object
355
356
357
|
# File 'lib/morpheus/api/api_client.rb', line 355
def whoami
Morpheus::WhoamiInterface.new(common_interface_options).setopts(@options)
end
|
#wiki ⇒ Object
841
842
843
|
# File 'lib/morpheus/api/api_client.rb', line 841
def wiki
Morpheus::WikiInterface.new(common_interface_options).setopts(@options)
end
|
#withopts(tmp_options, &block) ⇒ Object
Also known as:
with_options
with_options sets common global @options for the duration of the block only then returns the options to their prior values
127
128
129
130
131
132
133
134
135
136
|
# File 'lib/morpheus/api/api_client.rb', line 127
def withopts(tmp_options, &block)
@_old_options = @options
begin
@options = tmp_options
result = block.call()
ensure
@options = @_old_options
end
return result
end
|