Class: IbmCloudResourceController::ResourceControllerV2

Inherits:
IBMCloudSdkCore::BaseService
  • Object
show all
Includes:
Concurrent::Async
Defined in:
lib/ibm_cloud_resource_controller/resource_controller_v2.rb

Overview

The resource_controller V2 service.

Constant Summary collapse

DEFAULT_SERVICE_NAME =
"resource_controller"
DEFAULT_SERVICE_URL =
"https://resource-controller.cloud.ibm.com"

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ ResourceControllerV2

Construct a new client for the resource_controller service.

Parameters:

  • args (Hash)

    The args to initialize with

Options Hash (args):

  • service_url (String)

    The base service URL to use when contacting the service. The base service_url may differ between IBM Cloud regions.

  • authenticator (Object)

    The Authenticator instance to be configured for this service.

  • service_name (String)

    The name of the service to configure. Will be used as the key to load any external configuration, if applicable.



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 47

def initialize(args = {})
  @__async_initialized__ = false
  defaults = {}
  defaults[:service_url] = DEFAULT_SERVICE_URL
  defaults[:service_name] = DEFAULT_SERVICE_NAME
  defaults[:authenticator] = nil
  user_service_url = args[:service_url] unless args[:service_url].nil?
  args = defaults.merge(args)
  super
  @service_url = user_service_url unless user_service_url.nil?
end

Instance Method Details

#create_resource_alias(name: , source: , target: ) ⇒ IBMCloudSdkCore::DetailedResponse

Create a new resource alias. Alias a resource instance into a targeted environment’s (name)space.

Parameters:

  • name (String) (defaults to: )

    The name of the alias. Must be 180 characters or less and cannot include any special characters other than ‘(space) - . _ :`.

  • source (String) (defaults to: )

    The short or long ID of resource instance.

  • target (String) (defaults to: )

    The CRN of target name(space) in a specific environment, e.g. space in Dallas YP, CFEE instance etc.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 772

def create_resource_alias(name:, source:, target:)
  raise ArgumentError.new("name must be provided") if name.nil?

  raise ArgumentError.new("source must be provided") if source.nil?

  raise ArgumentError.new("target must be provided") if target.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "create_resource_alias")
  headers.merge!(sdk_headers)

  data = {
    "name" => name,
    "source" => source,
    "target" => target
  }

  method_url = "/v2/resource_aliases"

  response = request(
    method: "POST",
    url: method_url,
    headers: headers,
    json: data,
    accept_json: true
  )
  response
end

#create_resource_binding(source: , target: , name: nil, parameters: nil, role: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Create a new resource binding. Create a new resource binding.

Parameters:

  • source (String) (defaults to: )

    The short or long ID of resource alias.

  • target (String) (defaults to: )

    The CRN of application to bind to in a specific environment, e.g. Dallas YP, CFEE instance.

  • name (String) (defaults to: nil)

    The name of the binding. Must be 180 characters or less and cannot include any special characters other than ‘(space) - . _ :`.

  • parameters (ResourceBindingPostParameters) (defaults to: nil)

    Configuration options represented as key-value pairs. Service defined options are passed through to the target resource brokers, whereas platform defined options are not.

  • role (String) (defaults to: nil)

    The role name or it’s CRN.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 599

def create_resource_binding(source:, target:, name: nil, parameters: nil, role: nil)
  raise ArgumentError.new("source must be provided") if source.nil?

  raise ArgumentError.new("target must be provided") if target.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "create_resource_binding")
  headers.merge!(sdk_headers)

  data = {
    "source" => source,
    "target" => target,
    "name" => name,
    "parameters" => parameters,
    "role" => role
  }

  method_url = "/v2/resource_bindings"

  response = request(
    method: "POST",
    url: method_url,
    headers: headers,
    json: data,
    accept_json: true
  )
  response
end

#create_resource_instance(name: , target: , resource_group: , resource_plan_id: , tags: nil, allow_cleanup: nil, parameters: nil, entity_lock: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Create (provision) a new resource instance. Provision a new resource in the specified location for the selected plan.

Parameters:

  • name (String) (defaults to: )

    The name of the instance. Must be 180 characters or less and cannot include any special characters other than ‘(space) - . _ :`.

  • target (String) (defaults to: )

    The deployment location where the instance should be hosted.

  • resource_group (String) (defaults to: )

    Short or long ID of resource group.

  • resource_plan_id (String) (defaults to: )

    The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog.

  • tags (Array[String]) (defaults to: nil)

    Tags that are attached to the instance after provisioning. These tags can be searched and managed through the Tagging API in IBM Cloud.

  • allow_cleanup (Boolean) (defaults to: nil)

    A boolean that dictates if the resource instance should be deleted (cleaned up) during the processing of a region instance delete call.

  • parameters (Hash) (defaults to: nil)

    Configuration options represented as key-value pairs that are passed through to the target resource brokers.

  • entity_lock (Boolean) (defaults to: nil)

    Indicates if the resource instance is locked for further update or delete operations. It does not affect actions performed on child resources like aliases, bindings or keys. False by default.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 133

def create_resource_instance(name:, target:, resource_group:, resource_plan_id:, tags: nil, allow_cleanup: nil, parameters: nil, entity_lock: nil)
  raise ArgumentError.new("name must be provided") if name.nil?

  raise ArgumentError.new("target must be provided") if target.nil?

  raise ArgumentError.new("resource_group must be provided") if resource_group.nil?

  raise ArgumentError.new("resource_plan_id must be provided") if resource_plan_id.nil?

  headers = {
    "Entity-Lock" => entity_lock
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "create_resource_instance")
  headers.merge!(sdk_headers)

  data = {
    "name" => name,
    "target" => target,
    "resource_group" => resource_group,
    "resource_plan_id" => resource_plan_id,
    "tags" => tags,
    "allow_cleanup" => allow_cleanup,
    "parameters" => parameters
  }

  method_url = "/v2/resource_instances"

  response = request(
    method: "POST",
    url: method_url,
    headers: headers,
    json: data,
    accept_json: true
  )
  response
end

#create_resource_key(name: , source: , parameters: nil, role: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Create a new resource key. Create a new resource key.

Parameters:

  • name (String) (defaults to: )

    The name of the key.

  • source (String) (defaults to: )

    The short or long ID of resource instance or alias.

  • parameters (ResourceKeyPostParameters) (defaults to: nil)

    Configuration options represented as key-value pairs. Service defined options are passed through to the target resource brokers, whereas platform defined options are not.

  • role (String) (defaults to: nil)

    The role name or it’s CRN.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 425

def create_resource_key(name:, source:, parameters: nil, role: nil)
  raise ArgumentError.new("name must be provided") if name.nil?

  raise ArgumentError.new("source must be provided") if source.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "create_resource_key")
  headers.merge!(sdk_headers)

  data = {
    "name" => name,
    "source" => source,
    "parameters" => parameters,
    "role" => role
  }

  method_url = "/v2/resource_keys"

  response = request(
    method: "POST",
    url: method_url,
    headers: headers,
    json: data,
    accept_json: true
  )
  response
end

#delete_resource_alias(id: ) ⇒ nil

Delete a resource alias. Delete a resource alias by ID.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the alias.

Returns:

  • (nil)

Raises:

  • (ArgumentError)


833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 833

def delete_resource_alias(id:)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "delete_resource_alias")
  headers.merge!(sdk_headers)

  method_url = "/v2/resource_aliases/%s" % [ERB::Util.url_encode(id)]

  request(
    method: "DELETE",
    url: method_url,
    headers: headers,
    accept_json: false
  )
  nil
end

#delete_resource_binding(id: ) ⇒ nil

Delete a resource binding. Delete a resource binding by ID.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the binding.

Returns:

  • (nil)

Raises:

  • (ArgumentError)


660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 660

def delete_resource_binding(id:)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "delete_resource_binding")
  headers.merge!(sdk_headers)

  method_url = "/v2/resource_bindings/%s" % [ERB::Util.url_encode(id)]

  request(
    method: "DELETE",
    url: method_url,
    headers: headers,
    accept_json: false
  )
  nil
end

#delete_resource_instance(id: , recursive: nil) ⇒ nil

Delete a resource instance. Delete a resource instance by ID.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the instance.

  • recursive (Boolean) (defaults to: nil)

    Will delete resource bindings, keys and aliases associated with the instance.

Returns:

  • (nil)

Raises:

  • (ArgumentError)


202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 202

def delete_resource_instance(id:, recursive: nil)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "delete_resource_instance")
  headers.merge!(sdk_headers)

  params = {
    "recursive" => recursive
  }

  method_url = "/v2/resource_instances/%s" % [ERB::Util.url_encode(id)]

  request(
    method: "DELETE",
    url: method_url,
    headers: headers,
    params: params,
    accept_json: false
  )
  nil
end

#delete_resource_key(id: ) ⇒ nil

Delete a resource key by ID. Delete a resource key by ID.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the key.

Returns:

  • (nil)

Raises:

  • (ArgumentError)


485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 485

def delete_resource_key(id:)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "delete_resource_key")
  headers.merge!(sdk_headers)

  method_url = "/v2/resource_keys/%s" % [ERB::Util.url_encode(id)]

  request(
    method: "DELETE",
    url: method_url,
    headers: headers,
    accept_json: false
  )
  nil
end

#get_resource_alias(id: ) ⇒ IBMCloudSdkCore::DetailedResponse

Get a resource alias. Retrieve a resource alias by ID.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the alias.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 808

def get_resource_alias(id:)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "get_resource_alias")
  headers.merge!(sdk_headers)

  method_url = "/v2/resource_aliases/%s" % [ERB::Util.url_encode(id)]

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    accept_json: true
  )
  response
end

#get_resource_binding(id: ) ⇒ IBMCloudSdkCore::DetailedResponse

Get a resource binding. Retrieve a resource binding by ID.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the binding.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 635

def get_resource_binding(id:)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "get_resource_binding")
  headers.merge!(sdk_headers)

  method_url = "/v2/resource_bindings/%s" % [ERB::Util.url_encode(id)]

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    accept_json: true
  )
  response
end

#get_resource_instance(id: ) ⇒ IBMCloudSdkCore::DetailedResponse

Get a resource instance. Retrieve a resource instance by ID.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the instance.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 176

def get_resource_instance(id:)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "get_resource_instance")
  headers.merge!(sdk_headers)

  method_url = "/v2/resource_instances/%s" % [ERB::Util.url_encode(id)]

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    accept_json: true
  )
  response
end

#get_resource_key(id: ) ⇒ IBMCloudSdkCore::DetailedResponse

Get resource key by ID. Get resource key by ID.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the key.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 460

def get_resource_key(id:)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "get_resource_key")
  headers.merge!(sdk_headers)

  method_url = "/v2/resource_keys/%s" % [ERB::Util.url_encode(id)]

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    accept_json: true
  )
  response
end

#list_reclamations(account_id: nil, resource_instance_id: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Get a list of all reclamations. Get a list of all reclamations.

Parameters:

  • account_id (String) (defaults to: nil)

    An alpha-numeric value identifying the account ID.

  • resource_instance_id (String) (defaults to: nil)

    The short ID of the resource instance.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.



921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 921

def list_reclamations(account_id: nil, resource_instance_id: nil)
  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_reclamations")
  headers.merge!(sdk_headers)

  params = {
    "account_id" => ,
    "resource_instance_id" => resource_instance_id
  }

  method_url = "/v1/reclamations"

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    params: params,
    accept_json: true
  )
  response
end

#list_resource_aliases(guid: nil, name: nil, resource_instance_id: nil, region_instance_id: nil, resource_id: nil, resource_group_id: nil, limit: nil, updated_from: nil, updated_to: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Get a list of all resource aliases. Get a list of all resource aliases.

Parameters:

  • guid (String) (defaults to: nil)

    Short ID of the alias.

  • name (String) (defaults to: nil)

    The human-readable name of the alias.

  • resource_instance_id (String) (defaults to: nil)

    Resource instance short ID.

  • region_instance_id (String) (defaults to: nil)

    Short ID of the instance in a specific targeted environment. For example, ‘service_instance_id` in a given IBM Cloud environment.

  • resource_id (String) (defaults to: nil)

    The unique ID of the offering (service name). This value is provided by and stored in the global catalog.

  • resource_group_id (String) (defaults to: nil)

    Short ID of Resource group.

  • limit (String) (defaults to: nil)

    Limit on how many items should be returned.

  • updated_from (String) (defaults to: nil)

    Start date inclusive filter.

  • updated_to (String) (defaults to: nil)

    End date inclusive filter.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.



732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 732

def list_resource_aliases(guid: nil, name: nil, resource_instance_id: nil, region_instance_id: nil, resource_id: nil, resource_group_id: nil, limit: nil, updated_from: nil, updated_to: nil)
  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_aliases")
  headers.merge!(sdk_headers)

  params = {
    "guid" => guid,
    "name" => name,
    "resource_instance_id" => resource_instance_id,
    "region_instance_id" => region_instance_id,
    "resource_id" => resource_id,
    "resource_group_id" => resource_group_id,
    "limit" => limit,
    "updated_from" => updated_from,
    "updated_to" => updated_to
  }

  method_url = "/v2/resource_aliases"

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    params: params,
    accept_json: true
  )
  response
end

#list_resource_aliases_for_instance(id: ) ⇒ IBMCloudSdkCore::DetailedResponse

Get a list of all resource aliases for the instance. Get a list of all resource aliases for the instance.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the instance.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 272

def list_resource_aliases_for_instance(id:)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_aliases_for_instance")
  headers.merge!(sdk_headers)

  method_url = "/v2/resource_instances/%s/resource_aliases" % [ERB::Util.url_encode(id)]

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    accept_json: true
  )
  response
end

#list_resource_bindings(guid: nil, name: nil, resource_group_id: nil, resource_id: nil, region_binding_id: nil, limit: nil, updated_from: nil, updated_to: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Get a list of all resource bindings. Get a list of all resource bindings.

Parameters:

  • guid (String) (defaults to: nil)

    The short ID of the binding.

  • name (String) (defaults to: nil)

    The human-readable name of the binding.

  • resource_group_id (String) (defaults to: nil)

    Short ID of the resource group.

  • resource_id (String) (defaults to: nil)

    The unique ID of the offering (service name). This value is provided by and stored in the global catalog.

  • region_binding_id (String) (defaults to: nil)

    Short ID of the binding in the specific targeted environment, e.g. service_binding_id in a given IBM Cloud environment.

  • limit (String) (defaults to: nil)

    Limit on how many items should be returned.

  • updated_from (String) (defaults to: nil)

    Start date inclusive filter.

  • updated_to (String) (defaults to: nil)

    End date inclusive filter.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.



556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 556

def list_resource_bindings(guid: nil, name: nil, resource_group_id: nil, resource_id: nil, region_binding_id: nil, limit: nil, updated_from: nil, updated_to: nil)
  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_bindings")
  headers.merge!(sdk_headers)

  params = {
    "guid" => guid,
    "name" => name,
    "resource_group_id" => resource_group_id,
    "resource_id" => resource_id,
    "region_binding_id" => region_binding_id,
    "limit" => limit,
    "updated_from" => updated_from,
    "updated_to" => updated_to
  }

  method_url = "/v2/resource_bindings"

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    params: params,
    accept_json: true
  )
  response
end

#list_resource_bindings_for_alias(id: ) ⇒ IBMCloudSdkCore::DetailedResponse

Get a list of all resource bindings for the alias. Get a list of all resource bindings for the alias.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the alias.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 892

def list_resource_bindings_for_alias(id:)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_bindings_for_alias")
  headers.merge!(sdk_headers)

  method_url = "/v2/resource_aliases/%s/resource_bindings" % [ERB::Util.url_encode(id)]

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    accept_json: true
  )
  response
end

#list_resource_instances(guid: nil, name: nil, resource_group_id: nil, resource_id: nil, resource_plan_id: nil, type: nil, sub_type: nil, limit: nil, updated_from: nil, updated_to: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Get a list of all resource instances. Get a list of all resource instances.

Parameters:

  • guid (String) (defaults to: nil)

    When you provision a new resource in the specified location for the selected plan, a GUID (globally unique identifier) is created. This is a unique internal GUID managed by Resource controller that corresponds to the instance.

  • name (String) (defaults to: nil)

    The human-readable name of the instance.

  • resource_group_id (String) (defaults to: nil)

    Short ID of a resource group.

  • resource_id (String) (defaults to: nil)

    The unique ID of the offering. This value is provided by and stored in the global catalog.

  • resource_plan_id (String) (defaults to: nil)

    The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog.

  • type (String) (defaults to: nil)

    The type of the instance. For example, ‘service_instance`.

  • sub_type (String) (defaults to: nil)

    The sub-type of instance, e.g. ‘cfaas`.

  • limit (String) (defaults to: nil)

    Limit on how many items should be returned.

  • updated_from (String) (defaults to: nil)

    Start date inclusive filter.

  • updated_to (String) (defaults to: nil)

    End date inclusive filter.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 82

def list_resource_instances(guid: nil, name: nil, resource_group_id: nil, resource_id: nil, resource_plan_id: nil, type: nil, sub_type: nil, limit: nil, updated_from: nil, updated_to: nil)
  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_instances")
  headers.merge!(sdk_headers)

  params = {
    "guid" => guid,
    "name" => name,
    "resource_group_id" => resource_group_id,
    "resource_id" => resource_id,
    "resource_plan_id" => resource_plan_id,
    "type" => type,
    "sub_type" => sub_type,
    "limit" => limit,
    "updated_from" => updated_from,
    "updated_to" => updated_to
  }

  method_url = "/v2/resource_instances"

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    params: params,
    accept_json: true
  )
  response
end

#list_resource_keys(guid: nil, name: nil, resource_group_id: nil, resource_id: nil, limit: nil, updated_from: nil, updated_to: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Get a list of all of the resource keys. List all resource keys.

Parameters:

  • guid (String) (defaults to: nil)

    When you create a new key, a GUID (globally unique identifier) is assigned. This is a unique internal GUID managed by Resource controller that corresponds to the key.

  • name (String) (defaults to: nil)

    The human-readable name of the key.

  • resource_group_id (String) (defaults to: nil)

    The short ID of the resource group.

  • resource_id (String) (defaults to: nil)

    The unique ID of the offering. This value is provided by and stored in the global catalog.

  • limit (String) (defaults to: nil)

    Limit on how many items should be returned.

  • updated_from (String) (defaults to: nil)

    Start date inclusive filter.

  • updated_to (String) (defaults to: nil)

    End date inclusive filter.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.



386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 386

def list_resource_keys(guid: nil, name: nil, resource_group_id: nil, resource_id: nil, limit: nil, updated_from: nil, updated_to: nil)
  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_keys")
  headers.merge!(sdk_headers)

  params = {
    "guid" => guid,
    "name" => name,
    "resource_group_id" => resource_group_id,
    "resource_id" => resource_id,
    "limit" => limit,
    "updated_from" => updated_from,
    "updated_to" => updated_to
  }

  method_url = "/v2/resource_keys"

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    params: params,
    accept_json: true
  )
  response
end

#list_resource_keys_for_instance(id: ) ⇒ IBMCloudSdkCore::DetailedResponse

Get a list of all the resource keys for the instance. Get a list of all the resource keys for the instance.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the instance.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 297

def list_resource_keys_for_instance(id:)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_keys_for_instance")
  headers.merge!(sdk_headers)

  method_url = "/v2/resource_instances/%s/resource_keys" % [ERB::Util.url_encode(id)]

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    accept_json: true
  )
  response
end

#lock_resource_instance(id: ) ⇒ IBMCloudSdkCore::DetailedResponse

Lock a resource instance. Locks a resource instance by ID. A locked instance can not be updated or deleted.

It does not affect actions performed on child resources like aliases, bindings or
keys.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the instance.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 324

def lock_resource_instance(id:)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "lock_resource_instance")
  headers.merge!(sdk_headers)

  method_url = "/v2/resource_instances/%s/lock" % [ERB::Util.url_encode(id)]

  response = request(
    method: "POST",
    url: method_url,
    headers: headers,
    accept_json: true
  )
  response
end

#run_reclamation_action(id: , action_name: , request_by: nil, comment: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Perform a reclamation action. Reclaim (provisionally delete) a resource so that it can no longer be used, or

restore a resource so that it's usable again.

Parameters:

  • id (String) (defaults to: )

    The ID associated with the reclamation.

  • action_name (String) (defaults to: )

    The reclamation action name. Specify ‘reclaim` to delete a resource, or `restore` to restore a resource.

  • request_by (String) (defaults to: nil)

    The request initiator, if different from the request token.

  • comment (String) (defaults to: nil)

    A comment to describe the action.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 955

def run_reclamation_action(id:, action_name:, request_by: nil, comment: nil)
  raise ArgumentError.new("id must be provided") if id.nil?

  raise ArgumentError.new("action_name must be provided") if action_name.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "run_reclamation_action")
  headers.merge!(sdk_headers)

  data = {
    "request_by" => request_by,
    "comment" => comment
  }

  method_url = "/v1/reclamations/%s/actions/%s" % [ERB::Util.url_encode(id), ERB::Util.url_encode(action_name)]

  response = request(
    method: "POST",
    url: method_url,
    headers: headers,
    json: data,
    accept_json: true
  )
  response
end

#unlock_resource_instance(id: ) ⇒ IBMCloudSdkCore::DetailedResponse

Unlock a resource instance. Unlocks a resource instance by ID.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the instance.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 349

def unlock_resource_instance(id:)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "unlock_resource_instance")
  headers.merge!(sdk_headers)

  method_url = "/v2/resource_instances/%s/lock" % [ERB::Util.url_encode(id)]

  response = request(
    method: "DELETE",
    url: method_url,
    headers: headers,
    accept_json: true
  )
  response
end

#update_resource_alias(id: , name: ) ⇒ IBMCloudSdkCore::DetailedResponse

Update a resource alias. Update a resource alias by ID.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the alias.

  • name (String) (defaults to: )

    The new name of the alias. Must be 180 characters or less and cannot include any special characters other than ‘(space) - . _ :`.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 860

def update_resource_alias(id:, name:)
  raise ArgumentError.new("id must be provided") if id.nil?

  raise ArgumentError.new("name must be provided") if name.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "update_resource_alias")
  headers.merge!(sdk_headers)

  data = {
    "name" => name
  }

  method_url = "/v2/resource_aliases/%s" % [ERB::Util.url_encode(id)]

  response = request(
    method: "PATCH",
    url: method_url,
    headers: headers,
    json: data,
    accept_json: true
  )
  response
end

#update_resource_binding(id: , name: ) ⇒ IBMCloudSdkCore::DetailedResponse

Update a resource binding. Update a resource binding by ID.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the binding.

  • name (String) (defaults to: )

    The new name of the binding. Must be 180 characters or less and cannot include any special characters other than ‘(space) - . _ :`.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 687

def update_resource_binding(id:, name:)
  raise ArgumentError.new("id must be provided") if id.nil?

  raise ArgumentError.new("name must be provided") if name.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "update_resource_binding")
  headers.merge!(sdk_headers)

  data = {
    "name" => name
  }

  method_url = "/v2/resource_bindings/%s" % [ERB::Util.url_encode(id)]

  response = request(
    method: "PATCH",
    url: method_url,
    headers: headers,
    json: data,
    accept_json: true
  )
  response
end

#update_resource_instance(id: , name: nil, parameters: nil, resource_plan_id: nil, allow_cleanup: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Update a resource instance. Update a resource instance by ID.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the instance.

  • name (String) (defaults to: nil)

    The new name of the instance. Must be 180 characters or less and cannot include any special characters other than ‘(space) - . _ :`.

  • parameters (Hash) (defaults to: nil)

    The new configuration options for the instance.

  • resource_plan_id (String) (defaults to: nil)

    The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog.

  • allow_cleanup (Boolean) (defaults to: nil)

    A boolean that dictates if the resource instance should be deleted (cleaned up) during the processing of a region instance delete call.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


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
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 239

def update_resource_instance(id:, name: nil, parameters: nil, resource_plan_id: nil, allow_cleanup: nil)
  raise ArgumentError.new("id must be provided") if id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "update_resource_instance")
  headers.merge!(sdk_headers)

  data = {
    "name" => name,
    "parameters" => parameters,
    "resource_plan_id" => resource_plan_id,
    "allow_cleanup" => allow_cleanup
  }

  method_url = "/v2/resource_instances/%s" % [ERB::Util.url_encode(id)]

  response = request(
    method: "PATCH",
    url: method_url,
    headers: headers,
    json: data,
    accept_json: true
  )
  response
end

#update_resource_key(id: , name: ) ⇒ IBMCloudSdkCore::DetailedResponse

Update a resource key. Update a resource key by ID.

Parameters:

  • id (String) (defaults to: )

    The short or long ID of the key.

  • name (String) (defaults to: )

    The new name of the key. Must be 180 characters or less and cannot include any special characters other than ‘(space) - . _ :`.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# File 'lib/ibm_cloud_resource_controller/resource_controller_v2.rb', line 512

def update_resource_key(id:, name:)
  raise ArgumentError.new("id must be provided") if id.nil?

  raise ArgumentError.new("name must be provided") if name.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "update_resource_key")
  headers.merge!(sdk_headers)

  data = {
    "name" => name
  }

  method_url = "/v2/resource_keys/%s" % [ERB::Util.url_encode(id)]

  response = request(
    method: "PATCH",
    url: method_url,
    headers: headers,
    json: data,
    accept_json: true
  )
  response
end