Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/oracle-database/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Release History
===============

3.0.1
++++++
* Update listPrivate Ips command for cloud vm cluster operations
Comment thread
mihretkidane-OCI marked this conversation as resolved.
Outdated

3.0.0
++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@ class ListPrivateIpAddress(AAZCommand):
"""

_aaz_info = {
"version": "2026-06-01",
"version": "2026-07-01-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/oracle.database/cloudvmclusters/{}/listprivateipaddresses", "2026-06-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/oracle.database/cloudvmclusters/{}/listprivateipaddresses", "2026-07-01-preview"],
]
}

AZ_SUPPORT_PAGINATION = True

def _handler(self, command_args):
super()._handler(command_args)
self._execute_operations()
return self._output()
return self.build_paging(self._execute_operations, self._output)

_args_schema = None

Expand Down Expand Up @@ -96,8 +97,9 @@ def post_operations(self):
pass

def _output(self, *args, **kwargs):
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
return result
result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True)
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
return result, next_link

class CloudVmClustersListPrivateIpAddresses(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"
Expand Down Expand Up @@ -147,7 +149,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2026-06-01",
"api-version", "2026-07-01-preview",
required=True,
),
}
Expand Down Expand Up @@ -192,12 +194,20 @@ def _build_schema_on_200(cls):
if cls._schema_on_200 is not None:
return cls._schema_on_200

cls._schema_on_200 = AAZListType()
cls._schema_on_200 = AAZObjectType()

_schema_on_200 = cls._schema_on_200
_schema_on_200.Element = AAZObjectType()
_schema_on_200.next_link = AAZStrType(
serialized_name="nextLink",
)
_schema_on_200.value = AAZListType(
flags={"required": True},
)

value = cls._schema_on_200.value
value.Element = AAZObjectType()

_element = cls._schema_on_200.Element
_element = cls._schema_on_200.value.Element
_element.display_name = AAZStrType(
serialized_name="displayName",
flags={"required": True},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
interactions:
- request:
body: '{"subnetId": "ocid1.subnet.oc1.uk-london-1.aaaaaaaaequboxnii6bxqgkhvabu4hmsywaz5msdd4es4crvpxfqif6ahrnq",
"vnicId": "ocid1.vnic.oc1.uk-london-1.abwgiljswbwvdpkhucoaztvv24rkri6toyo4mvkandol5h7zognd7tnycc5q"}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- oracle-database cloud-vm-cluster list-private-ip-address
Connection:
- keep-alive
Content-Length:
- '206'
Content-Type:
- application/json
ParameterSetName:
- --resource-group --cloudvmclustername --subnet-id --vnic-id
User-Agent:
- AZURECLI/2.81.0 azsdk-python-core/1.35.0 Python/3.13.3 (macOS-26.7.1-arm64-arm-64bit-Mach-O)
method: POST
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/advancedNetworkingTest/providers/Oracle.Database/cloudVmClusters/DataGuardTest0504/listPrivateIpAddresses?api-version=2026-07-01-preview
response:
body:
string: '{"value":[{"displayName":"dataguardtest-7vmff2-vip","hostnameLabel":"dataguardtest-7vmff2-vip","ipAddress":"10.0.1.232","ocid":"ocid1.privateip.oc1.uk-london-1.aaaaaaaabzrtdqptg5h3g6f7c7lpfs7ps7vqpimuyhjbmdbonf5nthdubjsq","subnetId":"ocid1.subnet.oc1.uk-london-1.aaaaaaaaequboxnii6bxqgkhvabu4hmsywaz5msdd4es4crvpxfqif6ahrnq"},{"displayName":"dataguardtest-7vmff-scan-0","hostnameLabel":"","ipAddress":"10.0.1.195","ocid":"ocid1.privateip.oc1.uk-london-1.aaaaaaaadumrne6zk5y7rb7np425esjralbxjmdk74rqvyoigmsjky3nxvbq","subnetId":"ocid1.subnet.oc1.uk-london-1.aaaaaaaaequboxnii6bxqgkhvabu4hmsywaz5msdd4es4crvpxfqif6ahrnq"},{"displayName":"dataguardtest-7vmff2","hostnameLabel":"dataguardtest-7vmff2","ipAddress":"10.0.1.164","ocid":"ocid1.privateip.oc1.uk-london-1.aaaaaaaammhumrkjjefvo5iaipmd7ezrfh2itw35ketajeync7l7v33vblja","subnetId":"ocid1.subnet.oc1.uk-london-1.aaaaaaaaequboxnii6bxqgkhvabu4hmsywaz5msdd4es4crvpxfqif6ahrnq"},{"displayName":"ocid1.dbnode.oc1.uk-london-1.anwgiljs2edokzyafrndhxrytvfrg3xto2jxhj2c3f52mavzeetc3kvinuwq-dataguardtest-7vmff2-client1","hostnameLabel":"dataguardtest-7vmff2-client1","ipAddress":"10.0.1.210","ocid":"ocid1.privateip.oc1.uk-london-1.abwgiljsockazxrkvcg6es7lbplt55u4gghn6piceeac6x4nwbr5ubx5ovcq","subnetId":"ocid1.subnet.oc1.uk-london-1.aaaaaaaaequboxnii6bxqgkhvabu4hmsywaz5msdd4es4crvpxfqif6ahrnq"}],"nextLink":null}'
headers:
cache-control:
- no-cache
content-length:
- '1359'
content-type:
- application/json; charset=utf-8
date:
- Thu, 15 Oct 2026 17:17:57 GMT
expires:
- '-1'
opc-request-id:
- oci-6149484495C1B14-202610151717/667A29D3E9A69142C40AD16A4C485272/8014486A6A85A90A86519691A6DD9DC6
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
vary:
- Origin,Accept-Encoding
x-cache:
- CONFIG_NOCACHE
x-content-type-options:
- nosniff
x-ms-operation-identifier:
- tenantId=9ef05df2-ad7c-4737-aba9-a5e1b3fa5ae1,objectId=ed0404db-6d52-44c6-a09d-182ac122b912/uksouth/435a1a2d-938a-49bb-ba0d-875a31d66474
x-ms-providerhub-traffic:
- 'True'
x-ms-ratelimit-remaining-subscription-global-writes:
- '2999'
x-ms-ratelimit-remaining-subscription-writes:
- '199'
x-msedge-ref:
- 'Ref A: 3725DD5E2C224528ADF9D6FD3DCF8A7A Ref B: BY1AA1072318031 Ref C: 2026-10-15T17:17:50Z'
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import os

from azure.cli.testsdk import ScenarioTest, live_only
from azure.cli.testsdk.scenario_tests import AllowLargeResponse


class OracleDatabasePrivateIpAddressScenario(ScenarioTest):

# @live_only()
@AllowLargeResponse(size_kb=10240)
def test_oracledatabase_cloud_vm_cluster_list_private_ip_address(self):
# Populate the existing cluster details and set its OCI subnet/VNIC environment variables.
resource_group = 'advancedNetworkingTest'
cloud_vm_cluster_name = 'DataGuardTest0504'
subnet_id = os.environ.get('AZURE_ORACLE_DATABASE_SUBNET_ID', '<subnet-ocid>')
vnic_id = os.environ.get('AZURE_ORACLE_DATABASE_VNIC_ID', '<vnic-ocid>')

result = self.cmd(
'az oracle-database cloud-vm-cluster list-private-ip-address '
'--resource-group {} '
'--cloudvmclustername {} '
'--subnet-id {} '
'--vnic-id {}'.format(
resource_group,
cloud_vm_cluster_name,
subnet_id,
vnic_id,
)
).get_output_in_json()
self.assertIsInstance(result, list)
self.assertTrue(result)
self.assertTrue(all('ipAddress' in address for address in result))
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import json
import unittest
from types import SimpleNamespace
from unittest.mock import patch

from azure.cli.core.aaz._command_ctx import AAZCommandCtx
from azure.cli.core.mock import DummyCli
from azure.core import PipelineClient
from azure.core.pipeline.policies import ContentDecodePolicy

from azext_oracle_database.aaz.latest.oracle_database.cloud_vm_cluster._list_private_ip_address import (
ListPrivateIpAddress,
)


class PrivateIpAddressPagingTest(unittest.TestCase):
SUBSCRIPTION = '00000000-0000-0000-0000-000000000000'
URL = (
'https://management.azure.com/subscriptions/' + SUBSCRIPTION +
'/resourceGroups/test-rg/providers/Oracle.Database/cloudVmClusters/test-cluster/'
'listPrivateIpAddresses?api-version=2026-07-01-preview'
)

@staticmethod
def _address(ip_address):
return {
'displayName': 'test-address',
'hostnameLabel': 'test-host',
'ipAddress': ip_address,
'ocid': 'ocid1.privateip.test',
'subnetId': 'ocid1.subnet.test',
}

def _run_command(self, pages):
cli_ctx = DummyCli()
client = PipelineClient(base_url='https://management.azure.com')
sessions = [
SimpleNamespace(
http_response=SimpleNamespace(status_code=200),
context={ContentDecodePolicy.CONTEXT_NAME: page},
)
for page in pages
]
command = ListPrivateIpAddress(cli_ctx=cli_ctx)
with patch.object(AAZCommandCtx, 'get_http_client', return_value=client), \
patch.object(client, 'send_request', side_effect=sessions) as send_request:
output = list(command({
'subscription': self.SUBSCRIPTION,
'resource_group': 'test-rg',
'cloudvmclustername': 'test-cluster',
'subnet_id': 'ocid1.subnet.test',
'vnic_id': 'ocid1.vnic.test',
}))
return output, [call.kwargs['request'] for call in send_request.call_args_list]

def test_single_page_returns_address_array(self):
addresses = [self._address('10.0.1.10'), self._address('10.0.1.11')]
output, requests = self._run_command([{'value': addresses, 'nextLink': None}])

self.assertEqual(output, addresses)
self.assertEqual(len(requests), 1)
self.assertEqual(requests[0].method, 'POST')
self.assertEqual(requests[0].url, self.URL)
self.assertEqual(json.loads(requests[0].body), {
'subnetId': 'ocid1.subnet.test', 'vnicId': 'ocid1.vnic.test',
})

def test_continuation_link_fetches_and_combines_address_pages(self):
first = self._address('10.0.1.10')
second = self._address('10.0.1.11')
next_link = self.URL + '&$skiptoken=next-page'
output, requests = self._run_command([
{'value': [first], 'nextLink': next_link},
{'value': [second], 'nextLink': None},
])

self.assertEqual(output, [first, second])
self.assertEqual(len(requests), 2)
self.assertEqual(requests[0].method, 'POST')
self.assertEqual(requests[1].method, 'GET')
self.assertEqual(requests[1].url, next_link)
2 changes: 1 addition & 1 deletion src/oracle-database/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


# HISTORY.rst entry.
VERSION = '3.0.0'
VERSION = '3.0.1'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
Loading