Class: OneviewSDK::API500::C7000::Scope
- Inherits:
-
OneviewSDK::API300::C7000::Scope
- Object
- Resource
- OneviewSDK::API300::C7000::Scope
- OneviewSDK::API500::C7000::Scope
- Defined in:
- lib/oneview-sdk/resource/api500/c7000/scope.rb
Overview
Scope resource implementation for API500 C7000
Direct Known Subclasses
Constant Summary
Constants inherited from OneviewSDK::API300::C7000::Scope
OneviewSDK::API300::C7000::Scope::BASE_URI
Constants inherited from Resource
Resource::BASE_URI, Resource::DEFAULT_REQUEST_HEADER, Resource::UNIQUE_IDENTIFIERS
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Instance Method Summary collapse
-
#change_resource_assignments(add_resources: [], remove_resources: []) ⇒ Object
Modifies scope membership by adding or removing resource assignments.
-
#initialize(client, params = {}, api_ver = nil) ⇒ Scope
constructor
Create a resource object, associate it with a client, and set its properties.
-
#patch(operation, path, value = nil) ⇒ Object
Performs a specific patch operation for the given server.
Methods inherited from OneviewSDK::API300::C7000::Scope
#delete, #set_resources, #unset_resources, #update
Methods inherited from Resource
#==, #[], #[]=, build_query, #create, #create!, #deep_merge!, #delete, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, get_all_with_query, #like?, #refresh, #retrieve!, #schema, schema, #set, #set_all, #to_file, #update
Constructor Details
#initialize(client, params = {}, api_ver = nil) ⇒ Scope
Create a resource object, associate it with a client, and set its properties.
24 25 26 27 28 |
# File 'lib/oneview-sdk/resource/api500/c7000/scope.rb', line 24 def initialize(client, params = {}, api_ver = nil) @data ||= {} @data['type'] ||= 'ScopeV2' super end |
Instance Method Details
#change_resource_assignments(add_resources: [], remove_resources: []) ⇒ Object
Modifies scope membership by adding or removing resource assignments
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/oneview-sdk/resource/api500/c7000/scope.rb', line 33 def change_resource_assignments(add_resources: [], remove_resources: []) if !add_resources.empty? || !remove_resources.empty? ensure_uri && ensure_client add_uris = ensure_and_get_uris(add_resources) remove_uris = ensure_and_get_uris(remove_resources) body = [] add_uris.each do |uri| body << { 'op' => 'add', 'path' => '/addedResourceUris/-', 'value' => uri } end body << { 'op' => 'replace', 'path' => '/removedResourceUris', 'value' => remove_uris } response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => body }, @api_version) @client.response_handler(response) end self end |
#patch(operation, path, value = nil) ⇒ Object
This attribute is subject to incompatible changes in future release versions, including redefinition or removal.
Performs a specific patch operation for the given server. If the server supports the particular operation, the operation is performed and a response is returned to the caller with the results.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/oneview-sdk/resource/api500/c7000/scope.rb', line 58 def patch(operation, path, value = nil) ensure_client && ensure_uri body = { 'op' => operation, 'path' => path, 'value' => value } response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version) @client.response_handler(response) end |