Hello, I would like to add a reserved public IP to...
# getting-started
e
Hello, I would like to add a reserved public IP to an already created instance in Oracle Cloud, but I don't know how to obtain the OCID of the private IP. Any ideas?
b
e
I am trying with the following function but it gives me this error.
def get_private_ip (private_ip,subnet_id): try: private_ips_by_ip_address = oci.core.get_private_ips(ip_address=private_ip,subnet_id=subnet_id) except Exception as error: print("Get Private IP OCID " + str(error))
Get Private IP OCID get can only be used with classes decorated with @input_type or @output_type
"What are @input_type or @output_type?" 😅
b
they are Pulumi constructs for a resource that has returned from an API
you can’t really
try/catch
with Pulumi, that’s an imperative operation
what are the values of
private_ip
and
subnet_id
set to?
Copy code
def get_private_ip (private_ip: str ,subnet_id: str):
   return oci.core.get_private_ips(ip_address=private_ip,subnet_id=subnet_id)
This should work
(untested)