def create_transfer_appliance(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, id, customer_shipping_address): if isinstance(id, six.string_types) and len(id.strip()) == 0: raise click.UsageError( 'Parameter --id cannot be whitespace or empty string') kwargs = {} _details = {} if customer_shipping_address is not None: _details['customerShippingAddress'] = cli_util.parse_json_parameter( "customer_shipping_address", customer_shipping_address) client = cli_util.build_client('dts', 'transfer_appliance', ctx) result = client.create_transfer_appliance( id=id, create_transfer_appliance_details=_details, **kwargs) if wait_for_state: if hasattr(client, 'get_transfer_appliance') and callable( getattr(client, 'get_transfer_appliance')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs[ 'max_interval_seconds'] = wait_interval_seconds click.echo( 'Action completed. Waiting until the resource has entered state: {}' .format(wait_for_state), file=sys.stderr) result = oci.wait_until( client, client.get_transfer_appliance(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer click.echo( 'Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: click.echo( 'Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: click.echo( 'Unable to wait for the resource to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx)
def update_backup(ctx, from_json, force, backup_id, display_name, description, retention_in_days, freeform_tags, defined_tags, if_match): if isinstance(backup_id, six.string_types) and len(backup_id.strip()) == 0: raise click.UsageError( 'Parameter --backup-id cannot be whitespace or empty string') if not force: if freeform_tags or defined_tags: if not click.confirm( "WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?" ): ctx.abort() kwargs = {} if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) _details = {} if display_name is not None: _details['displayName'] = display_name if description is not None: _details['description'] = description if retention_in_days is not None: _details['retentionInDays'] = retention_in_days if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter( "freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter( "defined_tags", defined_tags) client = cli_util.build_client('mysql', 'db_backups', ctx) result = client.update_backup(backup_id=backup_id, update_backup_details=_details, **kwargs) cli_util.render_response(result, ctx)
def update_event(ctx, from_json, force, managed_instance_id, event_id, compartment_id, freeform_tags, defined_tags, if_match): if isinstance(managed_instance_id, six.string_types) and len( managed_instance_id.strip()) == 0: raise click.UsageError( 'Parameter --managed-instance-id cannot be whitespace or empty string' ) if isinstance(event_id, six.string_types) and len(event_id.strip()) == 0: raise click.UsageError( 'Parameter --event-id cannot be whitespace or empty string') if not force: if freeform_tags or defined_tags: if not click.confirm( "WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?" ): ctx.abort() kwargs = {} if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) _details = {} if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter( "freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter( "defined_tags", defined_tags) client = cli_util.build_client('os_management', 'event', ctx) result = client.update_event(managed_instance_id=managed_instance_id, event_id=event_id, compartment_id=compartment_id, update_event_details=_details, **kwargs) cli_util.render_response(result, ctx)
def generate_data_encryption_key(ctx, from_json, include_plaintext_key, key_id, key_shape, associated_data): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) details = {} details['includePlaintextKey'] = include_plaintext_key details['keyId'] = key_id details['keyShape'] = cli_util.parse_json_parameter("key_shape", key_shape) if associated_data is not None: details['associatedData'] = cli_util.parse_json_parameter( "associated_data", associated_data) client = cli_util.build_client('kms_crypto', ctx) result = client.generate_data_encryption_key(generate_key_details=details, **kwargs) cli_util.render_response(result, ctx)
def update_transfer_appliance(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, id, transfer_appliance_label, lifecycle_state, customer_shipping_address, if_match): if isinstance(id, six.string_types) and len(id.strip()) == 0: raise click.UsageError('Parameter --id cannot be whitespace or empty string') if isinstance(transfer_appliance_label, six.string_types) and len(transfer_appliance_label.strip()) == 0: raise click.UsageError('Parameter --transfer-appliance-label cannot be whitespace or empty string') if not force: if customer_shipping_address: if not click.confirm("WARNING: Updates to customer-shipping-address will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} if if_match is not None: kwargs['if_match'] = if_match details = {} if lifecycle_state is not None: details['lifecycleState'] = lifecycle_state if customer_shipping_address is not None: details['customerShippingAddress'] = cli_util.parse_json_parameter("customer_shipping_address", customer_shipping_address) client = cli_util.build_client('transfer_appliance', ctx) result = client.update_transfer_appliance( id=id, transfer_appliance_label=transfer_appliance_label, update_transfer_appliance_details=details, **kwargs ) if wait_for_state: if hasattr(client, 'get_transfer_appliance') and callable(getattr(client, 'get_transfer_appliance')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) result = oci.wait_until(client, client.get_transfer_appliance(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx)
def update_accepted_agreement(ctx, from_json, force, accepted_agreement_id, display_name, defined_tags, freeform_tags, if_match): if isinstance(accepted_agreement_id, six.string_types) and len( accepted_agreement_id.strip()) == 0: raise click.UsageError( 'Parameter --accepted-agreement-id cannot be whitespace or empty string' ) if not force: if defined_tags or freeform_tags: if not click.confirm( "WARNING: Updates to defined-tags and freeform-tags will replace any existing values. Are you sure you want to continue?" ): ctx.abort() kwargs = {} if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) _details = {} if display_name is not None: _details['displayName'] = display_name if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter( "defined_tags", defined_tags) if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter( "freeform_tags", freeform_tags) client = cli_util.build_client('marketplace', 'marketplace', ctx) result = client.update_accepted_agreement( accepted_agreement_id=accepted_agreement_id, update_accepted_agreement_details=_details, **kwargs) cli_util.render_response(result, ctx)
def update_node_pool(ctx, **kwargs): kwargs['node_config_details'] = {} if 'size' in kwargs and kwargs['size'] is not None: kwargs['node_config_details']['size'] = kwargs['size'] kwargs.pop('size', None) if 'placement_configs' in kwargs and kwargs['placement_configs'] is not None: kwargs['node_config_details']['placementConfigs'] = cli_util.parse_json_parameter("placement_configs", kwargs['placement_configs']) kwargs.pop('placement_configs', None) ctx.invoke(containerengine_cli.update_node_pool, **kwargs)
def decrypt(ctx, from_json, ciphertext, key_id, associated_data, logging_context): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} _details['ciphertext'] = ciphertext _details['keyId'] = key_id if associated_data is not None: _details['associatedData'] = cli_util.parse_json_parameter("associated_data", associated_data) if logging_context is not None: _details['loggingContext'] = cli_util.parse_json_parameter("logging_context", logging_context) client = cli_util.build_client('key_management', 'kms_crypto', ctx) result = client.decrypt( decrypt_data_details=_details, **kwargs ) cli_util.render_response(result, ctx)
def create_transcription_job_object_list_inline_input_location(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, output_location, input_location_object_locations, display_name, description, model_details, normalization, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} _details['inputLocation'] = {} _details['compartmentId'] = compartment_id _details['outputLocation'] = cli_util.parse_json_parameter("output_location", output_location) _details['inputLocation']['objectLocations'] = cli_util.parse_json_parameter("input_location_object_locations", input_location_object_locations) if display_name is not None: _details['displayName'] = display_name if description is not None: _details['description'] = description if model_details is not None: _details['modelDetails'] = cli_util.parse_json_parameter("model_details", model_details) if normalization is not None: _details['normalization'] = cli_util.parse_json_parameter("normalization", normalization) if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) _details['inputLocation']['locationType'] = 'OBJECT_LIST_INLINE_INPUT_LOCATION' client = cli_util.build_client('ai_speech', 'ai_service_speech', ctx) result = client.create_transcription_job( create_transcription_job_details=_details, **kwargs ) if wait_for_state: if hasattr(client, 'get_transcription_job') and callable(getattr(client, 'get_transcription_job')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) result = oci.wait_until(client, client.get_transcription_job(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx)
def update_subscription(ctx, from_json, force, subscription_id, delivery_policy, freeform_tags, defined_tags, if_match): if isinstance(subscription_id, six.string_types) and len( subscription_id.strip()) == 0: raise click.UsageError( 'Parameter --subscription-id cannot be whitespace or empty string') if not force: if delivery_policy or freeform_tags or defined_tags: if not click.confirm( "WARNING: Updates to delivery-policy and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?" ): ctx.abort() kwargs = {} if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) details = {} if delivery_policy is not None: details['deliveryPolicy'] = cli_util.parse_json_parameter( "delivery_policy", delivery_policy) if freeform_tags is not None: details['freeformTags'] = cli_util.parse_json_parameter( "freeform_tags", freeform_tags) if defined_tags is not None: details['definedTags'] = cli_util.parse_json_parameter( "defined_tags", defined_tags) client = cli_util.build_client('notification_data_plane', ctx) result = client.update_subscription(subscription_id=subscription_id, update_subscription_details=details, **kwargs) cli_util.render_response(result, ctx)
def generate_session_token(ctx, from_json, scopes, packaging_config_id, time_expires, asset_ids): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) _details = {} _details['scopes'] = cli_util.parse_json_parameter("scopes", scopes) _details['packagingConfigId'] = packaging_config_id if time_expires is not None: _details['timeExpires'] = time_expires if asset_ids is not None: _details['assetIds'] = cli_util.parse_json_parameter( "asset_ids", asset_ids) client = cli_util.build_client('media_services', 'media_stream', ctx) result = client.generate_session_token( generate_session_token_details=_details, **kwargs) cli_util.render_response(result, ctx)
def encrypt(ctx, from_json, key_id, plaintext, associated_data, logging_context): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) details = {} details['keyId'] = key_id details['plaintext'] = plaintext if associated_data is not None: details['associatedData'] = cli_util.parse_json_parameter( "associated_data", associated_data) if logging_context is not None: details['loggingContext'] = cli_util.parse_json_parameter( "logging_context", logging_context) client = cli_util.build_client('kms_crypto', ctx) result = client.encrypt(encrypt_data_details=details, **kwargs) cli_util.render_response(result, ctx)
def create_instance_agent_command(ctx, from_json, compartment_id, execution_time_out_in_seconds, target, content, display_name): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) _details = {} _details['compartmentId'] = compartment_id _details['executionTimeOutInSeconds'] = execution_time_out_in_seconds _details['target'] = cli_util.parse_json_parameter("target", target) _details['content'] = cli_util.parse_json_parameter("content", content) if display_name is not None: _details['displayName'] = display_name client = cli_util.build_client('compute_instance_agent', 'compute_instance_agent', ctx) result = client.create_instance_agent_command( create_instance_agent_command_details=_details, **kwargs) cli_util.render_response(result, ctx)
def create_config_create_metric_group_details(ctx, from_json, apm_domain_id, display_name, filter_id, metrics, freeform_tags, defined_tags, namespace, dimensions, opc_dry_run): kwargs = {} if opc_dry_run is not None: kwargs['opc_dry_run'] = opc_dry_run kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) _details = {} _details['displayName'] = display_name _details['filterId'] = filter_id _details['metrics'] = cli_util.parse_json_parameter("metrics", metrics) if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter( "freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter( "defined_tags", defined_tags) if namespace is not None: _details['namespace'] = namespace if dimensions is not None: _details['dimensions'] = cli_util.parse_json_parameter( "dimensions", dimensions) _details['configType'] = 'METRIC_GROUP' client = cli_util.build_client('apm_config', 'config', ctx) result = client.create_config(apm_domain_id=apm_domain_id, create_config_details=_details, **kwargs) cli_util.render_response(result, ctx)
def update_config(ctx, from_json, force, apm_domain_id, config_id, config_type, freeform_tags, defined_tags, if_match, opc_dry_run): if isinstance(config_id, six.string_types) and len(config_id.strip()) == 0: raise click.UsageError( 'Parameter --config-id cannot be whitespace or empty string') if not force: if freeform_tags or defined_tags: if not click.confirm( "WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?" ): ctx.abort() kwargs = {} if if_match is not None: kwargs['if_match'] = if_match if opc_dry_run is not None: kwargs['opc_dry_run'] = opc_dry_run kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) _details = {} _details['configType'] = config_type if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter( "freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter( "defined_tags", defined_tags) client = cli_util.build_client('apm_config', 'config', ctx) result = client.update_config(apm_domain_id=apm_domain_id, config_id=config_id, update_config_details=_details, **kwargs) cli_util.render_response(result, ctx)
def update_auto_scaling_policy_update_threshold_policy_details(ctx, from_json, force, auto_scaling_configuration_id, auto_scaling_policy_id, display_name, capacity, rules, if_match): if isinstance(auto_scaling_configuration_id, six.string_types) and len(auto_scaling_configuration_id.strip()) == 0: raise click.UsageError('Parameter --auto-scaling-configuration-id cannot be whitespace or empty string') if isinstance(auto_scaling_policy_id, six.string_types) and len(auto_scaling_policy_id.strip()) == 0: raise click.UsageError('Parameter --auto-scaling-policy-id cannot be whitespace or empty string') if not force: if capacity or rules: if not click.confirm("WARNING: Updates to capacity and rules will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) details = {} if display_name is not None: details['displayName'] = display_name if capacity is not None: details['capacity'] = cli_util.parse_json_parameter("capacity", capacity) if rules is not None: details['rules'] = cli_util.parse_json_parameter("rules", rules) details['policyType'] = 'threshold' client = cli_util.build_client('auto_scaling', ctx) result = client.update_auto_scaling_policy( auto_scaling_configuration_id=auto_scaling_configuration_id, auto_scaling_policy_id=auto_scaling_policy_id, update_auto_scaling_policy_details=details, **kwargs ) cli_util.render_response(result, ctx)
def update_auto_scaling_configuration(ctx, from_json, force, auto_scaling_configuration_id, defined_tags, display_name, freeform_tags, is_enabled, cool_down_in_seconds, if_match): if isinstance(auto_scaling_configuration_id, six.string_types) and len(auto_scaling_configuration_id.strip()) == 0: raise click.UsageError('Parameter --auto-scaling-configuration-id cannot be whitespace or empty string') if not force: if defined_tags or freeform_tags: if not click.confirm("WARNING: Updates to defined-tags and freeform-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) details = {} if defined_tags is not None: details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) if display_name is not None: details['displayName'] = display_name if freeform_tags is not None: details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if is_enabled is not None: details['isEnabled'] = is_enabled if cool_down_in_seconds is not None: details['coolDownInSeconds'] = cool_down_in_seconds client = cli_util.build_client('auto_scaling', ctx) result = client.update_auto_scaling_configuration( auto_scaling_configuration_id=auto_scaling_configuration_id, update_auto_scaling_configuration_details=details, **kwargs ) cli_util.render_response(result, ctx)
def update_tag_namespace_description(ctx, **kwargs): tag_namespace_id = kwargs['tag_namespace_id'] description = kwargs.get('description') freeform_tags = kwargs.get('freeform_tags') defined_tags = kwargs.get('defined_tags') if isinstance(tag_namespace_id, six.string_types) and len( tag_namespace_id.strip()) == 0: raise click.UsageError( 'Parameter --tag-namespace-id cannot be whitespace or empty string' ) if not kwargs.get('force'): if freeform_tags or defined_tags: if not click.confirm( "WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?" ): ctx.abort() service_kwargs = {} details = {} if description is not None: details['description'] = description if freeform_tags is not None: details['freeformTags'] = cli_util.parse_json_parameter( "freeform_tags", freeform_tags) if defined_tags is not None: details['definedTags'] = cli_util.parse_json_parameter( "defined_tags", defined_tags) client = cli_util.build_client('identity', 'identity', ctx) result = client.update_tag_namespace(tag_namespace_id=tag_namespace_id, update_tag_namespace_details=details, **service_kwargs) cli_util.render_response(result, ctx)
def batch_detect_language_text_classification(ctx, from_json, documents): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) _details = {} _details['documents'] = cli_util.parse_json_parameter( "documents", documents) client = cli_util.build_client('ai_language', 'ai_service_language', ctx) result = client.batch_detect_language_text_classification( batch_detect_language_text_classification_details=_details, **kwargs) cli_util.render_response(result, ctx)
def create_query(ctx, from_json, compartment_id, query_definition): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) _details = {} _details['compartmentId'] = compartment_id _details['queryDefinition'] = cli_util.parse_json_parameter( "query_definition", query_definition) client = cli_util.build_client('usage_api', 'usageapi', ctx) result = client.create_query(create_query_details=_details, **kwargs) cli_util.render_response(result, ctx)
def create_auto_scaling_configuration_instance_pool_resource( ctx, from_json, compartment_id, policies, resource_id, defined_tags, display_name, freeform_tags, cool_down_in_seconds, is_enabled): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) details = {} details['resource'] = {} details['compartmentId'] = compartment_id details['policies'] = cli_util.parse_json_parameter("policies", policies) details['resource']['id'] = resource_id if defined_tags is not None: details['definedTags'] = cli_util.parse_json_parameter( "defined_tags", defined_tags) if display_name is not None: details['displayName'] = display_name if freeform_tags is not None: details['freeformTags'] = cli_util.parse_json_parameter( "freeform_tags", freeform_tags) if cool_down_in_seconds is not None: details['coolDownInSeconds'] = cool_down_in_seconds if is_enabled is not None: details['isEnabled'] = is_enabled details['resource']['type'] = 'instancePool' client = cli_util.build_client('auto_scaling', ctx) result = client.create_auto_scaling_configuration( create_auto_scaling_configuration_details=details, **kwargs) cli_util.render_response(result, ctx)
def import_image_internal(ctx, compartment_id, display_name, import_image_details, launch_mode, defined_tags, freeform_tags): kwargs = {} details = {} details['compartmentId'] = compartment_id details['imageSourceDetails'] = import_image_details if display_name is not None: details['displayName'] = display_name if defined_tags is not None: details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) if freeform_tags is not None: details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if launch_mode is not None: details['launchMode'] = launch_mode client = cli_util.build_client('compute', ctx) result = client.create_image( create_image_details=details, **kwargs ) cli_util.render_response(result, ctx)
def update_node_pool(ctx, **kwargs): if 'size' in kwargs and kwargs['size'] is not None: kwargs['node_config_details'] = {} kwargs['node_config_details']['size'] = kwargs['size'] kwargs.pop('size', None) if 'nsg_ids' in kwargs and kwargs['nsg_ids'] is not None: kwargs['node_config_details']['nsgIds'] = cli_util.parse_json_parameter("nsg_ids", kwargs['nsg_ids']) kwargs.pop('nsg_ids', None) if 'placement_configs' in kwargs and kwargs['placement_configs'] is not None: if 'node_config_details' not in kwargs: kwargs['node_config_details'] = {} kwargs['node_config_details']['placementConfigs'] = cli_util.parse_json_parameter("placement_configs", kwargs['placement_configs']) kwargs.pop('placement_configs', None) if 'node_defined_tags' in kwargs and kwargs['node_defined_tags'] is not None: kwargs['node_config_details']['definedTags'] = cli_util.parse_json_parameter("node_defined_tags", kwargs['node_defined_tags']) kwargs.pop('node_defined_tags', None) if 'node_freeform_tags' in kwargs and kwargs['node_freeform_tags'] is not None: kwargs['node_config_details']['freeformTags'] = cli_util.parse_json_parameter("node_freeform_tags", kwargs['node_freeform_tags']) kwargs.pop('node_freeform_tags', None) if kwargs.get('kms_key_id') is not None: kwargs['node_config_details']['kmsKeyId'] = kwargs.get('kms_key_id') kwargs.pop('kms_key_id', None) if kwargs.get('is_pv_encryption_in_transit_enabled') is not None: kwargs['node_config_details']['isPvEncryptionInTransitEnabled'] = kwargs.get('is_pv_encryption_in_transit_enabled') kwargs.pop('is_pv_encryption_in_transit_enabled', None) ctx.invoke(containerengine_cli.update_node_pool, **kwargs)
def create_topic(ctx, from_json, name, compartment_id, description, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) details = {} details['name'] = name details['compartmentId'] = compartment_id if description is not None: details['description'] = description if freeform_tags is not None: details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) client = cli_util.build_client('notification_control_plane', ctx) result = client.create_topic( create_topic_details=details, **kwargs ) cli_util.render_response(result, ctx)
def request_summarized_usages(ctx, from_json, tenant_id, time_usage_started, time_usage_ended, granularity, query_type, group_by, compartment_depth, filter, page, limit): kwargs = {} if page is not None: kwargs['page'] = page if limit is not None: kwargs['limit'] = limit kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) _details = {} _details['tenantId'] = tenant_id _details['timeUsageStarted'] = time_usage_started _details['timeUsageEnded'] = time_usage_ended _details['granularity'] = granularity if query_type is not None: _details['queryType'] = query_type if group_by is not None: _details['groupBy'] = cli_util.parse_json_parameter( "group_by", group_by) if compartment_depth is not None: _details['compartmentDepth'] = compartment_depth if filter is not None: _details['filter'] = cli_util.parse_json_parameter("filter", filter) client = cli_util.build_client('usage_api', 'usageapi', ctx) result = client.request_summarized_usages( request_summarized_usages_details=_details, **kwargs) cli_util.render_response(result, ctx)
def create_auto_scaling_policy_create_threshold_policy_details(ctx, from_json, auto_scaling_configuration_id, capacity, rules, display_name): if isinstance(auto_scaling_configuration_id, six.string_types) and len(auto_scaling_configuration_id.strip()) == 0: raise click.UsageError('Parameter --auto-scaling-configuration-id cannot be whitespace or empty string') kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) details = {} details['capacity'] = cli_util.parse_json_parameter("capacity", capacity) details['rules'] = cli_util.parse_json_parameter("rules", rules) if display_name is not None: details['displayName'] = display_name details['policyType'] = 'threshold' client = cli_util.build_client('auto_scaling', ctx) result = client.create_auto_scaling_policy( auto_scaling_configuration_id=auto_scaling_configuration_id, create_auto_scaling_policy_details=details, **kwargs ) cli_util.render_response(result, ctx)
def batch_detect_language_sentiments(ctx, from_json, documents, level): kwargs = {} if level is not None and len(level) > 0: kwargs['level'] = level kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) _details = {} _details['documents'] = cli_util.parse_json_parameter( "documents", documents) client = cli_util.build_client('ai_language', 'ai_service_language', ctx) result = client.batch_detect_language_sentiments( batch_detect_language_sentiments_details=_details, **kwargs) cli_util.render_response(result, ctx)
def create_custom_table(ctx, from_json, compartment_id, saved_report_id, saved_custom_table): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) _details = {} _details['compartmentId'] = compartment_id _details['savedReportId'] = saved_report_id _details['savedCustomTable'] = cli_util.parse_json_parameter( "saved_custom_table", saved_custom_table) client = cli_util.build_client('usage_api', 'usageapi', ctx) result = client.create_custom_table(create_custom_table_details=_details, **kwargs) cli_util.render_response(result, ctx)
def decrypt(ctx, from_json, ciphertext, key_id, associated_data): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) details = {} details['ciphertext'] = ciphertext details['keyId'] = key_id if associated_data is not None: details['associatedData'] = cli_util.parse_json_parameter( "associated_data", associated_data) client = cli_util.build_client('kms_crypto', ctx) result = client.decrypt(decrypt_data_details=details, **kwargs) cli_util.render_response(result, ctx)
def process_ssl_configuration_kwargs(kwargs): ssl_configuration = {} if kwargs['ssl_certificate_name']: ssl_configuration['certificateName'] = kwargs['ssl_certificate_name'] if kwargs['ssl_verify_depth'] is not None: if kwargs['ssl_certificate_name'] is None: raise click.UsageError('--ssl-certificate-name option must be provided if --ssl-verify-depth is provided') ssl_configuration['verifyDepth'] = kwargs['ssl_verify_depth'] if kwargs['ssl_verify_peer_certificate'] is not None: if kwargs['ssl_certificate_name'] is None: raise click.UsageError('--ssl-certificate-name option must be provided if --ssl-verify-peer-certificate is provided') ssl_configuration['verifyPeerCertificate'] = kwargs['ssl_verify_peer_certificate'] if kwargs['protocols'] is not None: if kwargs['ssl_certificate_name'] is None: raise click.UsageError('--ssl-certificate-name option must be provided if --protocols is provided') ssl_configuration['protocols'] = cli_util.parse_json_parameter("protocols", kwargs['protocols']) if kwargs['cipher_suite_name'] is not None: if kwargs['ssl_certificate_name'] is None: raise click.UsageError('--ssl-certificate-name option must be provided if --cipher-suite-name is provided') ssl_configuration['cipherSuiteName'] = kwargs['cipher_suite_name'] if kwargs['server_order_preference'] is not None: if kwargs['ssl_certificate_name'] is None: raise click.UsageError('--ssl-certificate-name option must be provided if --server-order-preference is provided') ssl_configuration['serverOrderPreference'] = kwargs['server_order_preference'] if len(ssl_configuration) > 0: kwargs['ssl_configuration'] = json.dumps(ssl_configuration) # remove kwargs that create_backend_set wont recognize kwargs.pop('ssl_certificate_name') kwargs.pop('ssl_verify_depth') kwargs.pop('ssl_verify_peer_certificate') kwargs.pop('protocols') kwargs.pop('cipher_suite_name') kwargs.pop('server_order_preference')