Chilkat Online Tools

PowerBuilder / Core Services API / GetInstance

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Id
string ls_CompartmentId
string ls_Shape
string ls_Region
string ls_AvailabilityDomain
string ls_LifecycleState
string ls_TimeCreated
string ls_Value
string ls_IsManagementDisabledValue
string ls_IsMonitoringDisabledValue
string ls_PluginsConfigValue
string ls_IsLiveMigrationPreferredValue
string ls_RecoveryActionValue
string ls_CapacityReservationId
string ls_DedicatedVmHostId
string ls_DisplayName
string ls_FaultDomain
string ls_ImageId
string ls_AreLegacyImdsEndpointsDisabledValue
string ls_IpxeScript
string ls_LaunchMode
string ls_BootVolumeTypeValue
string ls_FirmwareValue
string ls_IsConsistentVolumeNamingEnabledValue
string ls_IsPvEncryptionInTransitEnabledValue
string ls_NetworkTypeValue
string ls_RemoteDataVolumeTypeValue
string ls_TypeValue
string ls_IsMeasuredBootEnabledValue
string ls_IsSecureBootEnabledValue
string ls_IsTrustedPlatformModuleEnabledValue
string ls_PreemptionActionValue
string ls_BaselineOcpuUtilizationValue
string ls_GpuDescriptionValue
string ls_GpusValue
string ls_LocalDiskDescriptionValue
string ls_LocalDisksValue
string ls_LocalDisksTotalSizeInGBsValue
string ls_MaxVnicAttachmentsValue
string ls_MemoryInGBsValue
string ls_NetworkingBandwidthInGbpsValue
string ls_OcpusValue
string ls_ProcessorDescriptionValue
string ls_SourceTypeValue
string ls_TimeMaintenanceRebootDue

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Http.SetRequestHeader("Authorization","{{signature}}")
loo_Http.SetRequestHeader("Date","{{date}}")

loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://iaas.{{region}}.oraclecloud.com/20160918/instances/:instanceId",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponseBody
    return
end if

loo_JResp = create oleobject
li_rc = loo_JResp.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Http.LastHeader
    Write-Debug "Failed."
    destroy loo_Http
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// {
//   "id": "sit dolor",
//   "compartmentId": "et esse",
//   "shape": "sunt veniam",
//   "region": "laboris",
//   "availabilityDomain": "dolor",
//   "lifecycleState": "TERMINATED",
//   "timeCreated": "2006-02-03T20:50:31.716Z",
//   "agentConfig": {
//     "areAllPluginsDisabled": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "isManagementDisabled": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "isMonitoringDisabled": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "pluginsConfig": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     }
//   },
//   "availabilityConfig": {
//     "isLiveMigrationPreferred": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "recoveryAction": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     }
//   },
//   "capacityReservationId": "occaecat sint id",
//   "dedicatedVmHostId": "ipsum dolor incididunt sit ex",
//   "definedTags": {},
//   "displayName": "consequat aliquip magna ullamco",
//   "extendedMetadata": {},
//   "faultDomain": "incididunt esse",
//   "freeformTags": {},
//   "imageId": "dolor nulla consequat ipsum",
//   "instanceOptions": {
//     "areLegacyImdsEndpointsDisabled": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     }
//   },
//   "ipxeScript": "anim magna",
//   "launchMode": "CUSTOM",
//   "launchOptions": {
//     "bootVolumeType": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "firmware": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "isConsistentVolumeNamingEnabled": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "isPvEncryptionInTransitEnabled": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "networkType": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "remoteDataVolumeType": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     }
//   },
//   "metadata": {},
//   "platformConfig": {
//     "type": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "isMeasuredBootEnabled": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "isSecureBootEnabled": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "isTrustedPlatformModuleEnabled": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     }
//   },
//   "preemptibleInstanceConfig": {
//     "preemptionAction": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     }
//   },
//   "shapeConfig": {
//     "baselineOcpuUtilization": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "gpuDescription": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "gpus": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "localDiskDescription": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "localDisks": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "localDisksTotalSizeInGBs": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "maxVnicAttachments": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "memoryInGBs": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "networkingBandwidthInGbps": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "ocpus": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "processorDescription": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     }
//   },
//   "sourceDetails": {
//     "sourceType": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     }
//   },
//   "timeMaintenanceRebootDue": "1973-07-06T14:36:00.263Z"
// }

// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

ls_Id = loo_JResp.StringOf("id")
ls_CompartmentId = loo_JResp.StringOf("compartmentId")
ls_Shape = loo_JResp.StringOf("shape")
ls_Region = loo_JResp.StringOf("region")
ls_AvailabilityDomain = loo_JResp.StringOf("availabilityDomain")
ls_LifecycleState = loo_JResp.StringOf("lifecycleState")
ls_TimeCreated = loo_JResp.StringOf("timeCreated")
ls_Value = loo_JResp.StringOf("agentConfig.areAllPluginsDisabled.value")
ls_IsManagementDisabledValue = loo_JResp.StringOf("agentConfig.isManagementDisabled.value")
ls_IsMonitoringDisabledValue = loo_JResp.StringOf("agentConfig.isMonitoringDisabled.value")
ls_PluginsConfigValue = loo_JResp.StringOf("agentConfig.pluginsConfig.value")
ls_IsLiveMigrationPreferredValue = loo_JResp.StringOf("availabilityConfig.isLiveMigrationPreferred.value")
ls_RecoveryActionValue = loo_JResp.StringOf("availabilityConfig.recoveryAction.value")
ls_CapacityReservationId = loo_JResp.StringOf("capacityReservationId")
ls_DedicatedVmHostId = loo_JResp.StringOf("dedicatedVmHostId")
ls_DisplayName = loo_JResp.StringOf("displayName")
ls_FaultDomain = loo_JResp.StringOf("faultDomain")
ls_ImageId = loo_JResp.StringOf("imageId")
ls_AreLegacyImdsEndpointsDisabledValue = loo_JResp.StringOf("instanceOptions.areLegacyImdsEndpointsDisabled.value")
ls_IpxeScript = loo_JResp.StringOf("ipxeScript")
ls_LaunchMode = loo_JResp.StringOf("launchMode")
ls_BootVolumeTypeValue = loo_JResp.StringOf("launchOptions.bootVolumeType.value")
ls_FirmwareValue = loo_JResp.StringOf("launchOptions.firmware.value")
ls_IsConsistentVolumeNamingEnabledValue = loo_JResp.StringOf("launchOptions.isConsistentVolumeNamingEnabled.value")
ls_IsPvEncryptionInTransitEnabledValue = loo_JResp.StringOf("launchOptions.isPvEncryptionInTransitEnabled.value")
ls_NetworkTypeValue = loo_JResp.StringOf("launchOptions.networkType.value")
ls_RemoteDataVolumeTypeValue = loo_JResp.StringOf("launchOptions.remoteDataVolumeType.value")
ls_TypeValue = loo_JResp.StringOf("platformConfig.type.value")
ls_IsMeasuredBootEnabledValue = loo_JResp.StringOf("platformConfig.isMeasuredBootEnabled.value")
ls_IsSecureBootEnabledValue = loo_JResp.StringOf("platformConfig.isSecureBootEnabled.value")
ls_IsTrustedPlatformModuleEnabledValue = loo_JResp.StringOf("platformConfig.isTrustedPlatformModuleEnabled.value")
ls_PreemptionActionValue = loo_JResp.StringOf("preemptibleInstanceConfig.preemptionAction.value")
ls_BaselineOcpuUtilizationValue = loo_JResp.StringOf("shapeConfig.baselineOcpuUtilization.value")
ls_GpuDescriptionValue = loo_JResp.StringOf("shapeConfig.gpuDescription.value")
ls_GpusValue = loo_JResp.StringOf("shapeConfig.gpus.value")
ls_LocalDiskDescriptionValue = loo_JResp.StringOf("shapeConfig.localDiskDescription.value")
ls_LocalDisksValue = loo_JResp.StringOf("shapeConfig.localDisks.value")
ls_LocalDisksTotalSizeInGBsValue = loo_JResp.StringOf("shapeConfig.localDisksTotalSizeInGBs.value")
ls_MaxVnicAttachmentsValue = loo_JResp.StringOf("shapeConfig.maxVnicAttachments.value")
ls_MemoryInGBsValue = loo_JResp.StringOf("shapeConfig.memoryInGBs.value")
ls_NetworkingBandwidthInGbpsValue = loo_JResp.StringOf("shapeConfig.networkingBandwidthInGbps.value")
ls_OcpusValue = loo_JResp.StringOf("shapeConfig.ocpus.value")
ls_ProcessorDescriptionValue = loo_JResp.StringOf("shapeConfig.processorDescription.value")
ls_SourceTypeValue = loo_JResp.StringOf("sourceDetails.sourceType.value")
ls_TimeMaintenanceRebootDue = loo_JResp.StringOf("timeMaintenanceRebootDue")


destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp

Curl Command

curl -X GET
	-H "Date: {{date}}"
	-H "Authorization: {{signature}}"
https://iaas.{{region}}.oraclecloud.com/20160918/instances/:instanceId

Postman Collection Item JSON

{
  "name": "GetInstance",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Date",
        "value": "{{date}}",
        "description": "(Required) Current Date",
        "type": "text"
      },
      {
        "key": "Authorization",
        "value": "{{signature}}",
        "description": "(Required) Signature Authentication on Authorization header",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/instances/:instanceId",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "instances",
        ":instanceId"
      ],
      "variable": [
        {
          "key": "instanceId",
          "value": "officia sed",
          "description": "(Required) The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the instance."
        }
      ]
    },
    "description": "Gets information about the specified instance."
  },
  "response": [
    {
      "name": "The instance was retrieved.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/instances/:instanceId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "instances",
            ":instanceId"
          ],
          "variable": [
            {
              "key": "instanceId"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "etag",
          "value": "officia sed",
          "description": "For optimistic concurrency control. See `if-match`.\n"
        },
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"id\": \"sit dolor\",\n \"compartmentId\": \"et esse\",\n \"shape\": \"sunt veniam\",\n \"region\": \"laboris\",\n \"availabilityDomain\": \"dolor\",\n \"lifecycleState\": \"TERMINATED\",\n \"timeCreated\": \"2006-02-03T20:50:31.716Z\",\n \"agentConfig\": {\n  \"areAllPluginsDisabled\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"isManagementDisabled\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"isMonitoringDisabled\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"pluginsConfig\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  }\n },\n \"availabilityConfig\": {\n  \"isLiveMigrationPreferred\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"recoveryAction\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  }\n },\n \"capacityReservationId\": \"occaecat sint id\",\n \"dedicatedVmHostId\": \"ipsum dolor incididunt sit ex\",\n \"definedTags\": {},\n \"displayName\": \"consequat aliquip magna ullamco\",\n \"extendedMetadata\": {},\n \"faultDomain\": \"incididunt esse\",\n \"freeformTags\": {},\n \"imageId\": \"dolor nulla consequat ipsum\",\n \"instanceOptions\": {\n  \"areLegacyImdsEndpointsDisabled\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  }\n },\n \"ipxeScript\": \"anim magna\",\n \"launchMode\": \"CUSTOM\",\n \"launchOptions\": {\n  \"bootVolumeType\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"firmware\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"isConsistentVolumeNamingEnabled\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"isPvEncryptionInTransitEnabled\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"networkType\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"remoteDataVolumeType\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  }\n },\n \"metadata\": {},\n \"platformConfig\": {\n  \"type\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"isMeasuredBootEnabled\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"isSecureBootEnabled\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"isTrustedPlatformModuleEnabled\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  }\n },\n \"preemptibleInstanceConfig\": {\n  \"preemptionAction\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  }\n },\n \"shapeConfig\": {\n  \"baselineOcpuUtilization\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"gpuDescription\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"gpus\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"localDiskDescription\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"localDisks\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"localDisksTotalSizeInGBs\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"maxVnicAttachments\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"memoryInGBs\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"networkingBandwidthInGbps\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"ocpus\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"processorDescription\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  }\n },\n \"sourceDetails\": {\n  \"sourceType\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  }\n },\n \"timeMaintenanceRebootDue\": \"1973-07-06T14:36:00.263Z\"\n}"
    },
    {
      "name": "Unauthorized",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/instances/:instanceId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "instances",
            ":instanceId"
          ],
          "variable": [
            {
              "key": "instanceId"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "Not Found",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/instances/:instanceId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "instances",
            ":instanceId"
          ],
          "variable": [
            {
              "key": "instanceId"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "Internal Server Error",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/instances/:instanceId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "instances",
            ":instanceId"
          ],
          "variable": [
            {
              "key": "instanceId"
            }
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "An error has occurred.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/instances/:instanceId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "instances",
            ":instanceId"
          ],
          "variable": [
            {
              "key": "instanceId"
            }
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    }
  ]
}