Class PatchOperation

java.lang.Object
com.eqixiac.equinix.core.http.request.PatchOperation

public final class PatchOperation extends Object
A single RFC 6902 (JSON Patch) operation - {"op": ..., "path": ..., "value": ...}.

Several Equinix endpoints model resource updates as a JSON Patch document: an ordered array of these operations sent with content-type application/json-patch+json (for example Fabric's PATCH /fabric/v4/networks/{id} and PATCH /fabric/v4/routers/{id}). SDK users do not normally construct these directly - the fluent resource.update().field(value).save() builders translate field changes into the appropriate operations - but the type is public so the raw patch surface is available when needed.

Author:
ianjones
  • Field Details

  • Constructor Details

    • PatchOperation

      public PatchOperation(String op, String path, Object value)
      Parameters:
      op - the operation name (replace, add, or remove)
      path - the JSON Pointer to the target member (e.g. /name)
      value - the new value; null (and omitted from the JSON) for remove
  • Method Details

    • replace

      public static PatchOperation replace(String path, Object value)
      Creates a replace operation, setting path to value.
      Parameters:
      path - the JSON Pointer to the target member (e.g. /name)
      value - the replacement value
      Returns:
      the operation
    • add

      public static PatchOperation add(String path, Object value)
      Creates an add operation, adding value at path.
      Parameters:
      path - the JSON Pointer to the target member
      value - the value to add
      Returns:
      the operation
    • remove

      public static PatchOperation remove(String path)
      Creates a remove operation, removing the member at path.
      Parameters:
      path - the JSON Pointer to the target member
      Returns:
      the operation
    • getOp

      public String getOp()
      Returns:
      the operation name
    • getPath

      public String getPath()
      Returns:
      the JSON Pointer path
    • getValue

      public Object getValue()
      Returns:
      the operation value, or null for remove