lib/oci/core/virtual_network_client.rb
# Updates the specified public IP. You must specify the object's OCID. Use this operation if you want to:
#
# * Assign a reserved public IP in your pool to a private IP.
# * Move a reserved public IP to a different private IP.
# * Unassign a reserved public IP from a private IP (which returns it to your pool
# of reserved public IPs).
# * Change the display name or tags for a public IP.
#
# Assigning, moving, and unassigning a reserved public IP are asynchronous
# operations. Poll the public IP's `lifecycleState` to determine if the operation
# succeeded.
#
# **Note:** When moving a reserved public IP, the target private IP
# must not already have a public IP with `lifecycleState` = ASSIGNING or ASSIGNED. If it
# does, an error is returned. Also, the initial unassignment from the original
# private IP always succeeds, but the assignment to the target private IP is asynchronous and
# could fail silently (for example, if the target private IP is deleted or has a different public IP
# assigned to it in the interim). If that occurs, the public IP remains unassigned and its
# `lifecycleState` switches to AVAILABLE (it is not reassigned to its original private IP).
# You must poll the public IP's `lifecycleState` to determine if the move succeeded.
#
# Regarding ephemeral public IPs:
#
# * If you want to assign an ephemeral public IP to a primary private IP, use
# {#create_public_ip create_public_ip}.
# * You can't move an ephemeral public IP to a different private IP.
# * If you want to unassign an ephemeral public IP from its private IP, use
# {#delete_public_ip delete_public_ip}, which
# unassigns and deletes the ephemeral public IP.
#
# **Note:** If a public IP is assigned to a secondary private
# IP (see {PrivateIp}), and you move that secondary
# private IP to another VNIC, the public IP moves with it.
#
# **Note:** There's a limit to the number of {PublicIp}
# a VNIC or instance can have. If you try to move a reserved public IP
# to a VNIC or instance that has already reached its public IP limit, an error is
# returned. For information about the public IP limits, see
# [Public IP Addresses](https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingpublicIPs.htm).
#
# @param [String] public_ip_id The [OCID](https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the public IP.
# @param [OCI::Core::Models::UpdatePublicIpDetails] update_public_ip_details Public IP details.
# @param [Hash] opts the optional parameters
# @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
#   retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
# @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
#   parameter to the value of the etag from a previous GET or POST response for that resource. The resource
#   will be updated or deleted only if the etag you provide matches the resource's current etag value.
#
# @return [Response] A Response object with data of type {OCI::Core::Models::PublicIp PublicIp}
# @note Click [here](https://docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/core/update_public_ip.rb.html) to see an example of how to use update_public_ip API.
Updates the specified public IP. You must specify the object's OCID. Use this operation if you want to:
Assign a reserved public IP in your pool to a private IP.
Move a reserved public IP to a different private IP.
Unassign a reserved public IP from a private IP (which returns it to your pool
of reserved public IPs).
Change the display name or tags for a public IP.

Assigning, moving, and unassigning a reserved public IP are asynchronous
operations. Poll the public IP's `lifecycleState` to determine if the operation
succeeded.

When moving a reserved public IP, the target private IP
must not already have a public IP with `lifecycleState` = ASSIGNING or ASSIGNED. If it
does, an error is returned. Also, the initial unassignment from the original
private IP always succeeds, but the assignment to the target private IP is asynchronous and
could fail silently (for example, if the target private IP is deleted or has a different public IP
assigned to it in the interim). If that occurs, the public IP remains unassigned and its
`lifecycleState` switches to AVAILABLE (it is not reassigned to its original private IP).
You must poll the public IP's `lifecycleState` to determine if the move succeeded.

Regarding ephemeral public IPs.

If you want to assign an ephemeral public IP to a primary private IP, use
{#create_public_ip create_public_ip}.
You can't move an ephemeral public IP to a different private IP.
If you want to unassign an ephemeral public IP from its private IP, use
{#delete_public_ip delete_public_ip}, which
unassigns and deletes the ephemeral public IP.

If a public IP is assigned to a secondary private
IP , and you move that secondary
private IP to another VNIC, the public IP moves with it.

There's a limit to the number of {PublicIp}
a VNIC or instance can have. If you try to move a reserved public IP
to a VNIC or instance that has already reached its public IP limit, an error is
returned. For information about the public IP limits, see
[Public IP Addresses].
Updates the specified public IP . You must specify the object ' s OCID . Use this operation if you want to : Assign a reserved public IP in your pool to a private IP . Move a reserved public IP to a different private IP . Unassign a reserved public IP from a private IP ( which returns it to your pool of reserved public IPs ) . Change the display name or tags for a public IP . Assigning moving and unassigning a reserved public IP are asynchronous operations . Poll the public IP ' s ` lifecycleState ` to determine if the operation succeeded . When moving a reserved public IP the target private IP must not already have a public IP with ` lifecycleState ` = ASSIGNING or ASSIGNED . If it does an error is returned . Also the initial unassignment from the original private IP always succeeds but the assignment to the target private IP is asynchronous and could fail silently ( for example if the target private IP is deleted or has a different public IP assigned to it in the interim ) . If that occurs the public IP remains unassigned and its ` lifecycleState ` switches to AVAILABLE ( it is not reassigned to its original private IP ) . You must poll the public IP ' s ` lifecycleState ` to determine if the move succeeded . Regarding ephemeral public IPs . If you want to assign an ephemeral public IP to a primary private IP use { #create_public_ip create_public_ip } . You can ' t move an ephemeral public IP to a different private IP . If you want to unassign an ephemeral public IP from its private IP use { #delete_public_ip delete_public_ip } which unassigns and deletes the ephemeral public IP . If a public IP is assigned to a secondary private IP and you move that secondary private IP to another VNIC the public IP moves with it . There ' s a limit to the number of { PublicIp } a VNIC or instance can have . If you try to move a reserved public IP to a VNIC or instance that has already reached its public IP limit an error is returned . For information about the public IP limits see [ Public IP Addresses ] .
def update_public_ip(public_ip_id, update_public_ip_details, opts = {})
      logger.debug 'Calling operation VirtualNetworkClient#update_public_ip.' if logger
      raise "Missing the required parameter 'public_ip_id' when calling update_public_ip." if public_ip_id.nil?
      raise "Missing the required parameter 'update_public_ip_details' when calling update_public_ip." if update_public_ip_details.nil?
      raise "Parameter value for 'public_ip_id' must not be blank" if OCI::Internal::Util.blank_string?(public_ip_id)
      path = '/publicIps/{publicIpId}'.sub('{publicIpId}', public_ip_id.to_s)
      operation_signing_strategy = :standard
      query_params = {}
      header_params = {}
      header_params[:accept] = 'application/json'
      header_params[:'content-type'] = 'application/json'
      header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
      post_body = @api_client.object_to_http_body(update_public_ip_details)
      OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'VirtualNetworkClient#update_public_ip') do
        @api_client.call_api(
          :PUT,
          path,
          endpoint,
          header_params: header_params,
          query_params: query_params,
          operation_signing_strategy: operation_signing_strategy,
          body: post_body,
          return_type: 'OCI::Core::Models::PublicIp'
        )
      end
    end
def update_public_ip ( public_ip_id , update_public_ip_details , opts = { } ) logger . debug 'Calling operation VirtualNetworkClient#update_public_ip.' if logger raise "Missing the required parameter 'public_ip_id' when calling update_public_ip." if public_ip_id . nil? raise "Missing the required parameter 'update_public_ip_details' when calling update_public_ip." if update_public_ip_details . nil? raise "Parameter value for 'public_ip_id' must not be blank" if OCI :: Internal :: Util . blank_string? ( public_ip_id ) path = '/publicIps/{publicIpId}' . sub ( '{publicIpId}' , public_ip_id . to_s ) operation_signing_strategy = :standard query_params = { } header_params = { } header_params [ :accept ] = 'application/json' header_params [ :' content-type ' ] = 'application/json' header_params [ :' if-match ' ] = opts [ :if_match ] if opts [ :if_match ] post_body = @api_client . object_to_http_body ( update_public_ip_details ) OCI :: Retry . make_retrying_call ( applicable_retry_config ( opts ) , call_name : 'VirtualNetworkClient#update_public_ip' ) do @api_client . call_api ( :PUT , path , endpoint , header_params : header_params , query_params : query_params , operation_signing_strategy : operation_signing_strategy , body : post_body , return_type : 'OCI::Core::Models::PublicIp' ) end end
Updates the specified public IP.
Updates the specified public IP .
# rubocop:disable Style/NegatedIf # Query Params # Header Params # rubocop:enable Style/NegatedIf # rubocop:disable Metrics/BlockLength # rubocop:enable Metrics/BlockLength
A Response object with data of type {OCI::Core::Models::PublicIp PublicIp}
A Response object with data of type { OCI :: Core :: Models :: PublicIp PublicIp }
Response
public_ip_id
<not_specific>
update_public_ip_details
<not_specific>
opts
:if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.
: if_match For optimistic concurrency control . In the PUT or DELETE call for a resource set the ` if - match ` parameter to the value of the etag from a previous GET or POST response for that resource . The resource will be updated or deleted only if the etag you provide matches the resource ' s current etag value .
<not_specific>
opts the optional parameters
opts the optional parameters
note
Click [here] to see an example of how to use update_public_ip API.
Click [ here ] to see an example of how to use update_public_ip API .