Skip to content

Commit 974e6d8

Browse files
authored
Releasing version 2.4.5 (#2)
1 parent f94181f commit 974e6d8

File tree

12 files changed

+933
-195
lines changed

12 files changed

+933
-195
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ All notable changes to this project will be documented in this file.
77
The format is based on `Keep a
88
Changelog <http://keepachangelog.com/>`__.
99

10+
2.4.5 - 2017-07-20
11+
------------------
12+
13+
Added
14+
~~~~~
15+
- Support for VCN multi-VNIC operations.
16+
- Support for compute image import/export operations.
17+
1018
2.4.4 - 2017-06-09
1119
------------------
1220

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ cryptography==1.8.1
88
httpsig-cffi==15.0.0
99
idna==2.5
1010
ndg-httpsclient==0.4.2
11-
oraclebmc==1.3.3
11+
oraclebmc==1.3.5
1212
packaging==16.8
1313
pluggy==0.4.0
1414
py==1.4.32

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def open_relative(*path):
3030

3131

3232
requires = [
33-
'oraclebmc==1.3.3',
33+
'oraclebmc==1.3.5',
3434
'certifi',
3535
'click==6.7',
3636
'configparser==3.5.0',

src/oraclebmc_cli/core_cli_extended.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from .generated import blockstorage_cli
1010
from .generated import compute_cli
1111
from .generated import virtualnetwork_cli
12+
13+
from oraclebmc import wait_until
1214
from oraclebmc.exceptions import ServiceError
15+
from oraclebmc.exceptions import MaximumWaitTimeExceeded
1316
from . import cli_util
1417

1518
blockstorage_cli.blockstorage_group.add_command(blockstorage_cli.volume_group)
@@ -23,6 +26,8 @@
2326
compute_cli.compute_group.add_command(compute_cli.console_history_group)
2427
compute_cli.instance_group.add_command(compute_cli.get_windows_instance_initial_credentials)
2528
compute_cli.volume_attachment_group.add_command(compute_cli.detach_volume)
29+
compute_cli.vnic_attachment_group.commands.pop(compute_cli.attach_vnic.name)
30+
compute_cli.vnic_attachment_group.commands.pop(compute_cli.detach_vnic.name)
2631

2732
virtualnetwork_cli.virtual_network_group.add_command(virtualnetwork_cli.vcn_group)
2833
virtualnetwork_cli.virtual_network_group.add_command(virtualnetwork_cli.subnet_group)
@@ -55,6 +60,21 @@
5560
cli_util.update_param_help(compute_cli.launch_instance, 'subnet_id', compute_instance_launch_subnet_id_help)
5661
cli_util.update_param_help(compute_cli.launch_instance, 'hostname_label', compute_instance_launch_hostname_label_help, example='`bminstance-1`')
5762

63+
64+
image_source_details_example = """'{ "objectName": "image-to-import.qcow2", "bucketName": "MyBucket", "namespaceName": "MyNamespace", "sourceType": "objectStorageTuple" }'
65+
66+
or
67+
68+
'{ "sourceUri": "https://objectstorage.us-phoenix-1.oraclecloud.com/n/MyNamespace/b/MyBucket/o/image-to-import.qcow2", "sourceType": "objectStorageUri" }'"""
69+
cli_util.update_param_help(compute_cli.create_image, 'image_source_details', "", append=True, example=image_source_details_example)
70+
71+
destination_type_example = """'{ "objectName": "image-to-import.qcow2", "bucketName": "MyBucket", "namespaceName": "MyNamespace", "sourceType": "objectStorageTuple" }'
72+
73+
or
74+
75+
'{ "destinationUri": "https://objectstorage.us-phoenix-1.oraclecloud.com/n/MyNamespace/b/MyBucket/o/exported-image.qcow2", "destinationType": "objectStorageUri" }'"""
76+
cli_util.update_param_help(compute_cli.export_image, 'destination_type', "", append=True, example=destination_type_example)
77+
5878
# help for bmcs network ip-sec-connection create --static-routes
5979
network_create_ip_sec_connection_static_routes_example = """'["10.0.0.0/16"]'"""
6080
network_create_ip_sec_connection_static_routes_help = """Static routes to the CPE. At least one route must be included. The CIDR must not be a multicast address or class E address. This must be provided in JSON format."""
@@ -201,3 +221,72 @@ def launch_instance_extended(ctx, **kwargs):
201221
del kwargs['vnic_display_name']
202222

203223
ctx.invoke(compute_cli.launch_instance, **kwargs)
224+
225+
226+
@compute_cli.instance_group.command(name='attach-vnic', help="""Creates a secondary VNIC and attaches it to the specified instance. For more information about secondary VNICs, see [Managing Virtual Network Interface Cards (VNICs)].""")
227+
@click.option('--instance-id', required=True, help="""The OCID of the instance.""")
228+
@click.option('--subnet-id', required=True, help="""The OCID of the subnet to create the VNIC in.""")
229+
@click.option('--vnic-display-name', required=False, help="""A user-friendly name for the VNIC. Does not have to be unique.""")
230+
@click.option('--assign-public-ip', required=False, type=click.BOOL, help="""Whether the VNIC should be assigned a public IP address. Defaults to whether the subnet is public or private. If not set and the VNIC is being created in a private subnet (i.e., where prohibitPublicIpOnVnic=true in the Subnet), then no public IP address is assigned. If not set and the subnet is public (prohibitPublicIpOnVnic=false), then a public IP address is assigned. If set to true and prohibitPublicIpOnVnic=true, an error is returned.""")
231+
@click.option('--private-ip', required=False, help="""A private IP address of your choice to assign to the VNIC. Must be an available IP address within the subnet's CIDR. If no value is specified, a private IP address from the subnet will be automatically assigned.""")
232+
@click.option('--hostname-label', help="""The hostname for the VNIC. Used for DNS. The value is the hostname portion of the VNIC's fully qualified domain name (FQDN) (e.g., `bminstance-1` in FQDN `bminstance-1.subnet123.vcn1.oraclevcn.com`). Must be unique across all VNICs in the subnet and comply with [RFC 952](https://tools.ietf.org/html/rfc952) and [RFC 1123](https://tools.ietf.org/html/rfc1123). The value can be retrieved from the [Vnic](#/en/iaas/20160918/Vnic/).""")
233+
@click.option('--wait', is_flag=True, default=False, help="""If set, then wait for the attachment to complete and return the newly attached VNIC. If not set, then the command will not wait and will return nothing on success.""")
234+
@cli_util.help_option
235+
@click.pass_context
236+
@cli_util.wrap_exceptions
237+
def attach_vnic(ctx, instance_id, subnet_id, vnic_display_name, assign_public_ip, private_ip, hostname_label, wait):
238+
kwargs = {}
239+
240+
vnic_details = {}
241+
vnic_details['subnetId'] = subnet_id
242+
vnic_details['displayName'] = vnic_display_name
243+
vnic_details['assignPublicIp'] = assign_public_ip
244+
vnic_details['privateIp'] = private_ip
245+
vnic_details['hostnameLabel'] = hostname_label
246+
247+
attachment_details = {}
248+
attachment_details['createVnicDetails'] = vnic_details
249+
attachment_details['instanceId'] = instance_id
250+
251+
compute_client = cli_util.build_client('compute', ctx)
252+
response = compute_client.attach_vnic(
253+
attach_vnic_details=attachment_details,
254+
**kwargs
255+
)
256+
257+
if not wait:
258+
return
259+
260+
response = compute_client.get_vnic_attachment(response.data.id)
261+
262+
try:
263+
response = wait_until(compute_client, response, 'lifecycle_state', 'ATTACHED', max_wait_seconds=180)
264+
except MaximumWaitTimeExceeded:
265+
sys.exit('Timed out while waiting for the VNIC attachment to reach the ATTACHED state.')
266+
267+
if not response.data.vnic_id:
268+
sys.exit('The VNIC ID is not set on the VNIC attachment.')
269+
270+
network_client = cli_util.build_client('virtual_network', ctx)
271+
response = network_client.get_vnic(vnic_id=response.data.vnic_id)
272+
cli_util.render_response(response)
273+
274+
275+
@compute_cli.instance_group.command(name='detach-vnic', help="""Detaches and deletes the specified secondary VNIC. This operation cannot be used on the instance's primary VNIC. When you terminate an instance, all attached VNICs (primary and secondary) are automatically detached and deleted.""")
276+
@click.option('--vnic-id', required=True, help="""The OCID of the VNIC.""")
277+
@click.option('--compartment-id', required=True, help="""The OCID of the instance's compartment.""")
278+
@cli_util.confirm_delete_option
279+
@cli_util.help_option
280+
@click.pass_context
281+
@cli_util.wrap_exceptions
282+
def detach_vnic(ctx, vnic_id, compartment_id):
283+
compute_client = cli_util.build_client('compute', ctx)
284+
result = compute_client.list_vnic_attachments(compartment_id=compartment_id, vnic_id=vnic_id)
285+
286+
if result.data is None or len(result.data) == 0:
287+
sys.exit('A VNIC attachment could not be found for the given VNIC ID.')
288+
289+
vnic_attachment_id = result.data[0].id
290+
result = compute_client.detach_vnic(vnic_attachment_id=vnic_attachment_id)
291+
292+
cli_util.render_response(result)

src/oraclebmc_cli/generated/blockstorage_cli.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ def volume_backup_group():
3737
pass
3838

3939

40-
@volume_group.command(name=cli_util.override('create_volume.command_name', 'create'), help="""Creates a new volume in the specified compartment. The size of a volume can be either 256 GB or 2 TB. For general information about block volumes, see [Overview of Block Volume Service].
40+
@volume_group.command(name=cli_util.override('create_volume.command_name', 'create'), help="""Creates a new volume in the specified compartment. Volumes can be created in sizes ranging from 50 GB (51200 MB) to 2 TB (2097152 MB), in 1 GB (1024 MB) increments. By default, volumes are 1 TB (1048576 MB). For general information about block volumes, see [Overview of Block Volume Service].
4141
4242
A volume and instance can be in separate compartments but must be in the same Availability Domain. For information about access control and compartments, see [Overview of the IAM Service]. For information about Availability Domains, see [Regions and Availability Domains]. To get a list of Availability Domains, use the `ListAvailabilityDomains` operation in the Identity and Access Management Service API.
4343
44-
You may optionally specify a *display name* for the volume, which is simply a friendly name or description. It does not have to be unique, and you can change it.""")
44+
You may optionally specify a *display name* for the volume, which is simply a friendly name or description. It does not have to be unique, and you can change it. Avoid entering confidential information.""")
4545
@click.option('--availability-domain', required=True, help="""The Availability Domain of the volume.
4646
4747
Example: `Uocm:PHX-AD-1`""")
4848
@click.option('--compartment-id', required=True, help="""The OCID of the compartment that contains the volume.""")
49-
@click.option('--display-name', help="""A user-friendly name. Does not have to be unique, and it's changeable.""")
49+
@click.option('--display-name', help="""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""")
5050
@click.option('--size-in-mbs', help="""The size of the volume in MBs.""")
5151
@click.option('--volume-backup-id', help="""The OCID of the volume backup from which the data should be restored on the newly created volume.""")
5252
@cli_util.help_option
@@ -80,7 +80,7 @@ def create_volume(ctx, availability_domain, compartment_id, display_name, size_i
8080
8181
When the request is received, the backup object is in a REQUEST_RECEIVED state. When the data is imaged, it goes into a CREATING state. After the backup is fully uploaded to the cloud, it goes into an AVAILABLE state.""")
8282
@click.option('--volume-id', required=True, help="""The OCID of the volume that needs to be backed up.""")
83-
@click.option('--display-name', help="""A user-friendly name for the volume backup. Does not have to be unique and it's changeable.""")
83+
@click.option('--display-name', help="""A user-friendly name for the volume backup. Does not have to be unique and it's changeable. Avoid entering confidential information.""")
8484
@cli_util.help_option
8585
@click.pass_context
8686
@cli_util.wrap_exceptions
@@ -223,9 +223,9 @@ def list_volumes(ctx, compartment_id, availability_domain, limit, page):
223223
cli_util.render_response(result)
224224

225225

226-
@volume_group.command(name=cli_util.override('update_volume.command_name', 'update'), help="""Updates the specified volume's display name.""")
226+
@volume_group.command(name=cli_util.override('update_volume.command_name', 'update'), help="""Updates the specified volume's display name. Avoid entering confidential information.""")
227227
@click.option('--volume-id', required=True, help="""The OCID of the volume.""")
228-
@click.option('--display-name', help="""A user-friendly name. Does not have to be unique, and it's changeable.""")
228+
@click.option('--display-name', help="""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""")
229229
@click.option('--if-match', help="""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.""")
230230
@cli_util.help_option
231231
@click.pass_context
@@ -249,9 +249,9 @@ def update_volume(ctx, volume_id, display_name, if_match):
249249
cli_util.render_response(result)
250250

251251

252-
@volume_backup_group.command(name=cli_util.override('update_volume_backup.command_name', 'update'), help="""Updates the display name for the specified volume backup.""")
252+
@volume_backup_group.command(name=cli_util.override('update_volume_backup.command_name', 'update'), help="""Updates the display name for the specified volume backup. Avoid entering confidential information.""")
253253
@click.option('--volume-backup-id', required=True, help="""The OCID of the volume backup.""")
254-
@click.option('--display-name', help="""A friendly user-specified name for the volume backup.""")
254+
@click.option('--display-name', help="""A friendly user-specified name for the volume backup. Avoid entering confidential information.""")
255255
@click.option('--if-match', help="""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.""")
256256
@cli_util.help_option
257257
@click.pass_context

0 commit comments

Comments
 (0)