SQL Server / Core Services API / Get Virtual Network VCN topology
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
DECLARE @queryParams int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @queryParams OUT
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'compartmentId', '{{compartment_ocid}}'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'accessLevel', 'ANY'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'queryCompartmentSubtree', 'true'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'vcnId', 'amet ut'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'opc-request-id', '8wF'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Date', '{{date}}'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Authorization', '{{signature}}'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'cache-control', 'officia sed'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'if-none-match', 'officia sed'
DECLARE @resp int
EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'https://iaas.{{region}}.oraclecloud.com/20160918/vcnTopology', @queryParams
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
RETURN
END
DECLARE @sbResponseBody int
-- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody
DECLARE @jResp int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT
EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
EXEC sp_OASetProperty @jResp, 'EmitCompact', 0
PRINT 'Response Body:'
EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
PRINT @sTmp0
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode >= 400
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
RETURN
END
EXEC @hr = sp_OADestroy @resp
-- Sample JSON response:
-- (Sample code for parsing the JSON response is shown below)
-- {
-- "type": {
-- "value": "<Error: Too many levels of nesting to fake this schema>"
-- },
-- "entities": {
-- "value": "<Error: Too many levels of nesting to fake this schema>"
-- },
-- "relationships": {
-- "value": "<Error: Too many levels of nesting to fake this schema>"
-- },
-- "timeCreated": {
-- "value": "<Error: Too many levels of nesting to fake this schema>"
-- },
-- "vcnId": "est"
-- }
-- Sample code for parsing the JSON response...
-- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
DECLARE @Value nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Value OUT, 'type.value'
DECLARE @entitiesValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @entitiesValue OUT, 'entities.value'
DECLARE @relationshipsValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @relationshipsValue OUT, 'relationships.value'
DECLARE @timeCreatedValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @timeCreatedValue OUT, 'timeCreated.value'
DECLARE @vcnId nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @vcnId OUT, 'vcnId'
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
END
GO
Curl Command
curl -G -d "compartmentId=%7B%7Bcompartment_ocid%7D%7D"
-d "accessLevel=ANY"
-d "queryCompartmentSubtree=true"
-d "vcnId=amet%20ut"
-H "opc-request-id: 8wF"
-H "if-none-match: officia sed"
-H "cache-control: officia sed"
-H "Date: {{date}}"
-H "Authorization: {{signature}}"
https://iaas.{{region}}.oraclecloud.com/20160918/vcnTopology
Postman Collection Item JSON
{
"name": "Get Virtual Network VCN topology",
"request": {
"method": "GET",
"header": [
{
"description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
"key": "opc-request-id",
"value": "8wF"
},
{
"description": "For querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
"key": "if-none-match",
"value": "officia sed"
},
{
"description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
"key": "cache-control",
"value": "officia sed"
},
{
"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}}/vcnTopology?compartmentId={{compartment_ocid}}&accessLevel=ANY&queryCompartmentSubtree=true&vcnId=amet ut",
"host": [
"{{baseUrl}}"
],
"path": [
"vcnTopology"
],
"query": [
{
"key": "compartmentId",
"value": "{{compartment_ocid}}",
"description": "(Required) The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment."
},
{
"key": "accessLevel",
"value": "ANY",
"description": "Valid values are `ANY` and `ACCESSIBLE`. The default is `ANY`.\nSetting this to `ACCESSIBLE` returns only compartments for which a\nuser has INSPECT permissions, either directly or indirectly (permissions can be on a\nresource in a subcompartment). A restricted set of fields is returned for compartments in which a user has\nindirect INSPECT permissions.\n\nWhen set to `ANY` permissions are not checked.\n"
},
{
"key": "queryCompartmentSubtree",
"value": "true",
"description": "When set to true, the hierarchy of compartments is traversed\nand the specified compartment and its subcompartments are\ninspected depending on the the setting of `accessLevel`.\nDefault is false.\n"
},
{
"key": "vcnId",
"value": "amet ut",
"description": "(Required) The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the VCN."
}
]
},
"description": "Gets a virtual network topology for a given VCN."
},
"response": [
{
"name": "The topology was successfully returned.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
"key": "opc-request-id",
"value": "8wF"
},
{
"description": "For querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
"key": "if-none-match",
"value": "officia sed"
},
{
"description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
"key": "cache-control",
"value": "officia sed"
}
],
"url": {
"raw": "{{baseUrl}}/vcnTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true&vcnId=amet ut",
"host": [
"{{baseUrl}}"
],
"path": [
"vcnTopology"
],
"query": [
{
"key": "compartmentId",
"value": "amet ut"
},
{
"key": "accessLevel",
"value": "ACCESSIBLE"
},
{
"key": "queryCompartmentSubtree",
"value": "true"
},
{
"key": "vcnId",
"value": "amet ut"
}
]
}
},
"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 \"type\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"entities\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"relationships\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"timeCreated\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"vcnId\": \"est\"\n}"
},
{
"name": "Bad Request",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
"key": "opc-request-id",
"value": "8wF"
},
{
"description": "For querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
"key": "if-none-match",
"value": "officia sed"
},
{
"description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
"key": "cache-control",
"value": "officia sed"
}
],
"url": {
"raw": "{{baseUrl}}/vcnTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true&vcnId=amet ut",
"host": [
"{{baseUrl}}"
],
"path": [
"vcnTopology"
],
"query": [
{
"key": "compartmentId",
"value": "amet ut"
},
{
"key": "accessLevel",
"value": "ACCESSIBLE"
},
{
"key": "queryCompartmentSubtree",
"value": "true"
},
{
"key": "vcnId",
"value": "amet ut"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_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": "Unauthorized",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
"key": "opc-request-id",
"value": "8wF"
},
{
"description": "For querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
"key": "if-none-match",
"value": "officia sed"
},
{
"description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
"key": "cache-control",
"value": "officia sed"
}
],
"url": {
"raw": "{{baseUrl}}/vcnTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true&vcnId=amet ut",
"host": [
"{{baseUrl}}"
],
"path": [
"vcnTopology"
],
"query": [
{
"key": "compartmentId",
"value": "amet ut"
},
{
"key": "accessLevel",
"value": "ACCESSIBLE"
},
{
"key": "queryCompartmentSubtree",
"value": "true"
},
{
"key": "vcnId",
"value": "amet ut"
}
]
}
},
"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": [
{
"description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
"key": "opc-request-id",
"value": "8wF"
},
{
"description": "For querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
"key": "if-none-match",
"value": "officia sed"
},
{
"description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
"key": "cache-control",
"value": "officia sed"
}
],
"url": {
"raw": "{{baseUrl}}/vcnTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true&vcnId=amet ut",
"host": [
"{{baseUrl}}"
],
"path": [
"vcnTopology"
],
"query": [
{
"key": "compartmentId",
"value": "amet ut"
},
{
"key": "accessLevel",
"value": "ACCESSIBLE"
},
{
"key": "queryCompartmentSubtree",
"value": "true"
},
{
"key": "vcnId",
"value": "amet ut"
}
]
}
},
"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": "Too many requests",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
"key": "opc-request-id",
"value": "8wF"
},
{
"description": "For querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
"key": "if-none-match",
"value": "officia sed"
},
{
"description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
"key": "cache-control",
"value": "officia sed"
}
],
"url": {
"raw": "{{baseUrl}}/vcnTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true&vcnId=amet ut",
"host": [
"{{baseUrl}}"
],
"path": [
"vcnTopology"
],
"query": [
{
"key": "compartmentId",
"value": "amet ut"
},
{
"key": "accessLevel",
"value": "ACCESSIBLE"
},
{
"key": "queryCompartmentSubtree",
"value": "true"
},
{
"key": "vcnId",
"value": "amet ut"
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_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": [
{
"description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
"key": "opc-request-id",
"value": "8wF"
},
{
"description": "For querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
"key": "if-none-match",
"value": "officia sed"
},
{
"description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
"key": "cache-control",
"value": "officia sed"
}
],
"url": {
"raw": "{{baseUrl}}/vcnTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true&vcnId=amet ut",
"host": [
"{{baseUrl}}"
],
"path": [
"vcnTopology"
],
"query": [
{
"key": "compartmentId",
"value": "amet ut"
},
{
"key": "accessLevel",
"value": "ACCESSIBLE"
},
{
"key": "queryCompartmentSubtree",
"value": "true"
},
{
"key": "vcnId",
"value": "amet ut"
}
]
}
},
"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": [
{
"description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
"key": "opc-request-id",
"value": "8wF"
},
{
"description": "For querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
"key": "if-none-match",
"value": "officia sed"
},
{
"description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
"key": "cache-control",
"value": "officia sed"
}
],
"url": {
"raw": "{{baseUrl}}/vcnTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true&vcnId=amet ut",
"host": [
"{{baseUrl}}"
],
"path": [
"vcnTopology"
],
"query": [
{
"key": "compartmentId",
"value": "amet ut"
},
{
"key": "accessLevel",
"value": "ACCESSIBLE"
},
{
"key": "queryCompartmentSubtree",
"value": "true"
},
{
"key": "vcnId",
"value": "amet ut"
}
]
}
},
"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}"
}
]
}