コード例 #1
0
identity_cli.tag_group.commands.pop(identity_cli.update_tag.name)

identity_cli.tag_namespace_group.commands.pop(
    identity_cli.update_tag_namespace.name)

identity_cli.api_key_group.commands.pop(identity_cli.upload_api_key.name)
identity_cli.tag_group.commands.pop(
    identity_cli.create_tag_default_tag_definition_validator.name)
identity_cli.tag_group.commands.pop(
    identity_cli.create_tag_enum_tag_definition_validator.name)
identity_cli.tag_group.commands.pop(
    identity_cli.update_tag_default_tag_definition_validator.name)
identity_cli.tag_group.commands.pop(
    identity_cli.update_tag_enum_tag_definition_validator.name)

cli_util.get_param(identity_cli.create_policy,
                   'version_date').type = click.STRING

# help for oci iam policy create --statements
identity_policy_create_statements_example = """'["statement 1","statement 2"]'"""
identity_policy_create_statements_help = cli_util.GENERIC_JSON_FORMAT_HELP
cli_util.update_param_help(identity_cli.create_policy,
                           'statements',
                           identity_policy_create_statements_help,
                           append=True,
                           example=identity_policy_create_statements_example)

# revised short help for tagging operations
identity_cli.create_tag.short_help = 'Create new tag in a given tagNamespace'
identity_cli.get_tag.short_help = 'Gets the specified tag' 's information'
identity_cli.list_tags.short_help = 'List tags in a given tagNamespace'
identity_cli.create_tag_namespace.short_help = 'Create new tagNamespace in a compartment'
コード例 #2
0
            kwargs['credential_file_content'],
            'default_connection':
            kwargs['default_connection']
        })
        ctx.invoke(
            dataintegration_cli.
            update_data_asset_update_data_asset_from_oracle, **oracle_db_args)


@cli_util.copy_params_from_generated_command(
    dataintegration_cli.delete_connection_validation,
    params_to_exclude=['connection_validation_key'])
@cli_util.option(
    '--con-validation-key',
    required=True,
    type=get_param(dataintegration_cli.delete_connection_validation,
                   'connection_validation_key').type,
    help=get_param(dataintegration_cli.delete_connection_validation,
                   'connection_validation_key').help)
@dataintegration_cli.connection_validation_group.command(
    name=cli_util.override(
        'data_integration.delete_connection_validation.command_name',
        'delete'),
    help=
    u"""Successfully accepted the delete request. The connection validation will be deleted."""
)
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(
    input_params_to_complex_types={})
@cli_util.wrap_exceptions
def delete_connection_validation_extended(ctx, **kwargs):
    if 'con_validation_key' in kwargs:
コード例 #3
0
cli_util.update_param_help(virtualnetwork_cli.update_security_list, 'ingress_security_rules', '', append=True, example=network_create_security_list_ingress_security_rules_example)

# Formatting of the help for the bcms network private-ip list command
virtualnetwork_cli.list_private_ips.help = """Lists the [PrivateIp] objects based on one of these filters:

  \b
  - Subnet OCID.
  - VNIC OCID.
  - Both private IP address and subnet OCID: This lets you get a `privateIP` object
    based on its private IP address (for example, 10.0.3.3)  and not its OCID.
    For comparison, [GetPrivateIp] requires the OCID.

If you're listing all the private IPs associated with a given subnet or VNIC, the response includes both primary and secondary private IPs."""

# update the type of the --skip-source-dest-check switch on update_vnic to be a boolean
cli_util.get_param(virtualnetwork_cli.update_vnic, 'skip_source_dest_check').type = click.BOOL


@cli_util.copy_params_from_generated_command(virtualnetwork_cli.create_private_ip, params_to_exclude=[''])
@virtualnetwork_cli.vnic_group.command(name='assign-private-ip', help="""Assigns a secondary private IP address to the specified VNIC. The secondary private IP must be in the same subnet as the VNIC.
This command can also be used to move an existing secondary private IP to the specified VNIC.

For more information about secondary private IPs, see [IP Addresses]
""")
@cli_util.option('--unassign-if-already-assigned', is_flag=True, default=False, help="""Force reassignment of the IP address if it's already assigned to another VNIC in the subnet. This is only relevant if an IP address is associated with this command.""")
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'core', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'core', 'class': 'dict(str, string)'}}, output_type={'module': 'core', 'class': 'PrivateIp'})
@cli_util.wrap_exceptions
def assign_private_ip(ctx, from_json, vnic_id, ip_address, display_name, hostname_label, unassign_if_already_assigned, defined_tags, freeform_tags):
    networking_client = cli_util.build_client('core', 'virtual_network', ctx)
コード例 #4
0
ファイル: sddc_cli_extended.py プロジェクト: zhiiker/oci-cli
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates.  All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
import click
from oci_cli import cli_util
from oci_cli import json_skeleton_utils
from oci_cli.cli_util import get_param, rename_command
from services.ocvp.src.oci_cli_sddc.generated import sddc_cli
from services.ocvp.src.oci_cli_ocvp.generated import ocvs_service_cli

# Shorten parameters for create command
get_param(sddc_cli.create_sddc,
          'compute_availability_domain').opts.extend(['--ad'])
get_param(sddc_cli.create_sddc, 'display_name').opts.extend(['--name'])

# Shorten parameters for update command
get_param(sddc_cli.update_sddc, 'display_name').opts.extend(['--name'])

# Shorten parameters for list command
get_param(sddc_cli.list_sddcs,
          'compute_availability_domain').opts.extend(['--ad'])
get_param(sddc_cli.list_sddcs, 'display_name').opts.extend(['--name'])

# Rename commands
rename_command(sddc_cli, sddc_cli.sddc_summary_group, sddc_cli.list_sddcs,
               "list")
rename_command(sddc_cli,
               sddc_cli.supported_vmware_software_version_summary_group,
               sddc_cli.list_supported_vmware_software_versions,
               "vmware-versions")
コード例 #5
0
                           "",
                           append=True,
                           example=image_source_details_example)

destination_type_example = """'{ "objectName": "image-to-import.qcow2", "bucketName": "MyBucket", "namespaceName": "MyNamespace", "destinationType": "objectStorageTuple" }'

or

'{ "destinationUri": "https://objectstorage.us-phoenix-1.oraclecloud.com/n/MyNamespace/b/MyBucket/o/exported-image.qcow2", "destinationType": "objectStorageUri" }'"""
cli_util.update_param_help(compute_cli.export_image,
                           'destination_type',
                           "",
                           append=True,
                           example=destination_type_example)

cli_util.get_param(compute_cli.attach_volume,
                   'type').type = custom_types.CliCaseInsensitiveChoice([
                       'service_determined', 'emulated', 'iscsi',
                       'paravirtualized'
                   ])

cli_util.update_param_help(
    compute_cli.create_image,
    'image_source_details',
    """[DEPRECATED] The use of the `oci compute image create` command to import an image from Object Storage is deprecated.

\b
Please use the `oci compute image import` command instead.

""" +
    cli_util.get_param(compute_cli.create_image, 'image_source_details').help,
    append=False)
コード例 #6
0
# coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates.  All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
import click
from oci_cli import cli_util
from oci_cli import json_skeleton_utils
from oci_cli.cli_util import get_param
from services.ocvp.src.oci_cli_esxi_host.generated import esxihost_cli
from services.ocvp.src.oci_cli_ocvp.generated import ocvs_service_cli

# Shorten parameters for create command
get_param(esxihost_cli.create_esxi_host,
          'display_name').opts.extend(['--name'])

# Shorten parameters for update command
get_param(esxihost_cli.update_esxi_host,
          'display_name').opts.extend(['--name'])

# Shorten parameters for list command
get_param(esxihost_cli.list_esxi_hosts, 'display_name').opts.extend(['--name'])


@cli_util.copy_params_from_generated_command(
    esxihost_cli.delete_esxi_host, params_to_exclude=['esxi_host_id'])
@esxihost_cli.esxi_host_group.command(name=cli_util.override(
    'delete_esxi_host.command_name', 'delete'),
                                      help=esxihost_cli.delete_esxi_host.help)
@cli_util.option('--esxi-id',
                 required=True,
                 help=u"""The [OCID] of the ESXi host.""")
@click.pass_context
コード例 #7
0
from oci_cli_audit.generated import audit_cli
from oci_cli import cli_util
from oci_cli import custom_types
from oci_cli import json_skeleton_utils
from timeit import default_timer as timer
import click
import sys

cli_util.rename_command(audit_cli.audit_root_group,
                        audit_cli.audit_event_group, "event")
audit_cli.configuration_group.commands.pop(audit_cli.update_configuration.name)
audit_cli.audit_event_group.commands.pop(audit_cli.list_events.name)

cli_util.get_param(
    audit_cli.list_events,
    'start_time').type = custom_types.CLI_DATETIME_ROUNDED_MINUTE
cli_util.get_param(audit_cli.list_events,
                   'end_time').type = custom_types.CLI_DATETIME_ROUNDED_MINUTE

audit_start_time_help = """Returns events that were processed at or after this start date and time. For example, a start value of `2017-01-15T11:30:00Z` will retrieve a list of all events processed since 30 minutes after the 11th hour of January 15, 2017, in Coordinated Universal Time (UTC).
You can specify a value with granularity to the minute. If seconds are provided then this will be rounded to the nearest minute, with greater than or equal to 30 seconds rounding up and less than 30 seconds rounding down.
""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE
cli_util.update_param_help(audit_cli.list_events,
                           'start_time',
                           audit_start_time_help,
                           append=False)
audit_end_time_help = """Returns events that were processed before this end date and time. For example, a start value of `2017-01-01T00:00:00Z` and an end value of `2017-01-02T00:00:00Z` will retrieve a list of all events processed on January 1, 2017. Similarly, a start value of `2017-01-01T00:00:00Z` and an end value of `2017-02-01T00:00:00Z` will result in a list of all events processed between January 1, 2017 and January 31, 2017.
You can specify a value with granularity to the minute. If seconds are provided then this will be rounded to the nearest minute, with greater than or equal to 30 seconds rounding up and less than 30 seconds rounding down.
""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE
cli_util.update_param_help(audit_cli.list_events,
コード例 #8
0
# oci kms management vault restore-vault-from-object-store-backup-location-bucket
kmsvault_cli.vault_group.commands.pop(
    kmsvault_cli.restore_vault_from_object_store_backup_location_bucket.name)

# oci kms management vault restore-vault-from-object-store-backup-location-uri
kmsvault_cli.vault_group.commands.pop(
    kmsvault_cli.restore_vault_from_object_store_backup_location_uri.name)

# oci kms management vault restore-vault-from-file
kmsvault_cli.vault_group.commands.pop(
    kmsvault_cli.restore_vault_from_file.name)

vault_backup_params_from_generated = {
    'wait_for_state':
    get_param(kmsvault_cli.backup_vault_backup_location_bucket,
              'wait_for_state'),
    'max_wait_seconds':
    get_param(kmsvault_cli.backup_vault_backup_location_bucket,
              'max_wait_seconds'),
    'wait_interval_seconds':
    get_param(kmsvault_cli.backup_vault_backup_location_bucket,
              'wait_interval_seconds'),
    'is_include_keys':
    get_param(kmsvault_cli.backup_vault_backup_location_bucket,
              'is_include_keys')
}


@kmsvault_cli.vault_group.command(
    name=cli_util.override(
        'kmsvault_cli.vault_backup_from_bucket_or_uri.command_name', 'backup'),
コード例 #9
0
# oci kms management key restore-key-from-object-store-backup-location-bucket
kmsmanagement_cli.key_group.commands.pop(
    kmsmanagement_cli.restore_key_from_object_store_backup_location_bucket.name
)

# oci kms management key restore-key-from-object-store-backup-location-uri
kmsmanagement_cli.key_group.commands.pop(
    kmsmanagement_cli.restore_key_from_object_store_backup_location_uri.name)

# oci kms management key restore-key-from-file
kmsmanagement_cli.key_group.commands.pop(
    kmsmanagement_cli.restore_key_from_file.name)

key_backup_params_from_generated = {
    'wait_for_state':
    get_param(kmsmanagement_cli.backup_key_backup_location_bucket,
              'wait_for_state'),
    'max_wait_seconds':
    get_param(kmsmanagement_cli.backup_key_backup_location_bucket,
              'max_wait_seconds'),
    'wait_interval_seconds':
    get_param(kmsmanagement_cli.backup_key_backup_location_bucket,
              'wait_interval_seconds')
}


@kmsmanagement_cli.key_group.command(
    name=cli_util.override(
        'kms_management.key_backup_from_bucket_or_uri.command_name', 'backup'),
    help=kmsmanagement_cli.backup_key_backup_location_bucket.help)
@cli_util.option('--key-id',
                 required=True,
コード例 #10
0
cli_util.rename_command(autoscaling_cli,
                        autoscaling_cli.autoscaling_root_group,
                        autoscaling_cli.auto_scaling_policy_group, "policy")


@cli_util.copy_params_from_generated_command(
    autoscaling_cli.create_auto_scaling_policy)
@autoscaling_cli.auto_scaling_policy_group.command(
    name=cli_util.override(
        'autoscaling_cli.create_auto_scaling_policy_extended.command_name',
        'create'),
    help=autoscaling_cli.create_auto_scaling_policy.help)
@cli_util.option(
    '--execution-schedule',
    type=cli_util.get_param(
        autoscaling_cli.
        create_auto_scaling_policy_create_scheduled_policy_details,
        'execution_schedule').type,
    help=cli_util.copy_help_from_generated_code(
        autoscaling_cli.
        create_auto_scaling_policy_create_scheduled_policy_details,
        'execution_schedule',
        remove_required=True))
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(
    input_params_to_complex_types={
        'capacity': {
            'module': 'autoscaling',
            'class': 'Capacity'
        },
        'execution-schedule': {
            'module': 'autoscaling',
コード例 #11
0
            kwargs['data_asset_type'],
            'default_connection':
            kwargs['default_connection']
        })
        ctx.invoke(
            dataintegration_cli.update_data_asset_update_data_asset_from_jdbc,
            **generic_jdbc_args)


@cli_util.copy_params_from_generated_command(
    dataintegration_cli.delete_connection_validation,
    params_to_exclude=['connection_validation_key'])
@cli_util.option(
    '--con-validation-key',
    required=True,
    type=get_param(dataintegration_cli.delete_connection_validation,
                   'connection_validation_key').type,
    help=get_param(dataintegration_cli.delete_connection_validation,
                   'connection_validation_key').help)
@dataintegration_cli.connection_validation_group.command(
    name=cli_util.override(
        'data_integration.delete_connection_validation.command_name',
        'delete'),
    help=
    u"""Successfully accepted the delete request. The connection validation will be deleted."""
)
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(
    input_params_to_complex_types={})
@cli_util.wrap_exceptions
def delete_connection_validation_extended(ctx, **kwargs):
    if 'con_validation_key' in kwargs:
コード例 #12
0
image_source_details_example = """'{ "objectName": "image-to-import.qcow2", "bucketName": "MyBucket", "namespaceName": "MyNamespace", "sourceType": "objectStorageTuple" }'

or

'{ "sourceUri": "https://objectstorage.us-phoenix-1.oraclecloud.com/n/MyNamespace/b/MyBucket/o/image-to-import.qcow2", "sourceType": "objectStorageUri" }'"""
cli_util.update_param_help(compute_cli.create_image, 'image_source_details', "", append=True, example=image_source_details_example)

destination_type_example = """'{ "objectName": "image-to-import.qcow2", "bucketName": "MyBucket", "namespaceName": "MyNamespace", "destinationType": "objectStorageTuple" }'

or

'{ "destinationUri": "https://objectstorage.us-phoenix-1.oraclecloud.com/n/MyNamespace/b/MyBucket/o/exported-image.qcow2", "destinationType": "objectStorageUri" }'"""
cli_util.update_param_help(compute_cli.export_image, 'destination_type', "", append=True, example=destination_type_example)

cli_util.get_param(compute_cli.attach_volume, 'type').type = custom_types.CliCaseInsensitiveChoice(['iscsi', 'paravirtualized'])

cli_util.update_param_help(compute_cli.create_image, 'image_source_details', """[DEPRECATED] The use of the `oci compute image create` command to import an image from Object Storage is deprecated.

\b
Please use the `oci compute image import` command instead.

""" + cli_util.get_param(compute_cli.create_image, 'image_source_details').help, append=False)


instance_console_connection_windows_help = """If you are attempting to start a VNC connection to an instance from a Windows machine without SSH installed, you can consider using plink instead.
The 'oci compute instance-console-connection get-plink-connection-string' command returns a PowerShell command which uses plink to launch the SSH tunnel necessary to start a VNC connection to the instance."""
compute_cli.instance_console_connection_group.help = compute_cli.instance_console_connection_group.help + '\n\n' + instance_console_connection_windows_help
compute_cli.get_instance_console_connection.help = compute_cli.get_instance_console_connection.help + '\n\n' + instance_console_connection_windows_help