示例#1
0
def list_work_request_logs(ctx, from_json, all_pages, page_size,
                           work_request_id, page, limit):

    if all_pages and limit:
        raise click.UsageError(
            'If you provide the --all option you cannot provide the --limit option'
        )

    if isinstance(work_request_id, six.string_types) and len(
            work_request_id.strip()) == 0:
        raise click.UsageError(
            'Parameter --work-request-id cannot be whitespace or empty string')

    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'])
    client = cli_util.build_client('oce', 'oce_instance', ctx)
    if all_pages:
        if page_size:
            kwargs['limit'] = page_size

        result = cli_util.list_call_get_all_results(
            client.list_work_request_logs,
            work_request_id=work_request_id,
            **kwargs)
    elif limit is not None:
        result = cli_util.list_call_get_up_to_limit(
            client.list_work_request_logs,
            limit,
            page_size,
            work_request_id=work_request_id,
            **kwargs)
    else:
        result = client.list_work_request_logs(work_request_id=work_request_id,
                                               **kwargs)
    cli_util.render_response(result, ctx)
示例#2
0
def list_key_versions(ctx, from_json, all_pages, page_size, key_id, limit,
                      page, sort_by, sort_order):

    if all_pages and limit:
        raise click.UsageError(
            'If you provide the --all option you cannot provide the --limit option'
        )

    if isinstance(key_id, six.string_types) and len(key_id.strip()) == 0:
        raise click.UsageError(
            'Parameter --key-id cannot be whitespace or empty string')

    kwargs = {}
    if limit is not None:
        kwargs['limit'] = limit
    if page is not None:
        kwargs['page'] = page
    if sort_by is not None:
        kwargs['sort_by'] = sort_by
    if sort_order is not None:
        kwargs['sort_order'] = sort_order
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(
        ctx.obj['request_id'])
    client = cli_util.build_client('kms_management', ctx)
    if all_pages:
        if page_size:
            kwargs['limit'] = page_size

        result = cli_util.list_call_get_all_results(client.list_key_versions,
                                                    key_id=key_id,
                                                    **kwargs)
    elif limit is not None:
        result = cli_util.list_call_get_up_to_limit(client.list_key_versions,
                                                    limit,
                                                    page_size,
                                                    key_id=key_id,
                                                    **kwargs)
    else:
        result = client.list_key_versions(key_id=key_id, **kwargs)
    cli_util.render_response(result, ctx)
示例#3
0
def list_quotas(ctx, from_json, all_pages, page_size, compartment_id, page,
                limit, name, lifecycle_state, sort_order, sort_by):

    if all_pages and limit:
        raise click.UsageError(
            'If you provide the --all option you cannot provide the --limit option'
        )

    kwargs = {}
    if page is not None:
        kwargs['page'] = page
    if limit is not None:
        kwargs['limit'] = limit
    if name is not None:
        kwargs['name'] = name
    if lifecycle_state is not None:
        kwargs['lifecycle_state'] = lifecycle_state
    if sort_order is not None:
        kwargs['sort_order'] = sort_order
    if sort_by is not None:
        kwargs['sort_by'] = sort_by
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(
        ctx.obj['request_id'])
    client = cli_util.build_client('quotas', ctx)
    if all_pages:
        if page_size:
            kwargs['limit'] = page_size

        result = cli_util.list_call_get_all_results(
            client.list_quotas, compartment_id=compartment_id, **kwargs)
    elif limit is not None:
        result = cli_util.list_call_get_up_to_limit(
            client.list_quotas,
            limit,
            page_size,
            compartment_id=compartment_id,
            **kwargs)
    else:
        result = client.list_quotas(compartment_id=compartment_id, **kwargs)
    cli_util.render_response(result, ctx)
示例#4
0
def list_configs(ctx, from_json, all_pages, page_size, apm_domain_id,
                 config_type, display_name, limit, page, sort_order, sort_by):

    if all_pages and limit:
        raise click.UsageError(
            'If you provide the --all option you cannot provide the --limit option'
        )

    kwargs = {}
    if config_type is not None:
        kwargs['config_type'] = config_type
    if display_name is not None:
        kwargs['display_name'] = display_name
    if limit is not None:
        kwargs['limit'] = limit
    if page is not None:
        kwargs['page'] = page
    if sort_order is not None:
        kwargs['sort_order'] = sort_order
    if sort_by is not None:
        kwargs['sort_by'] = sort_by
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(
        ctx.obj['request_id'])
    client = cli_util.build_client('apm_config', 'config', ctx)
    if all_pages:
        if page_size:
            kwargs['limit'] = page_size

        result = cli_util.list_call_get_all_results(
            client.list_configs, apm_domain_id=apm_domain_id, **kwargs)
    elif limit is not None:
        result = cli_util.list_call_get_up_to_limit(
            client.list_configs,
            limit,
            page_size,
            apm_domain_id=apm_domain_id,
            **kwargs)
    else:
        result = client.list_configs(apm_domain_id=apm_domain_id, **kwargs)
    cli_util.render_response(result, ctx)
示例#5
0
def list_links(ctx, from_json, all_pages, page_size, parent_tenancy_id, child_tenancy_id, lifecycle_state, page, limit, sort_order):

    if all_pages and limit:
        raise click.UsageError('If you provide the --all option you cannot provide the --limit option')

    kwargs = {}
    if parent_tenancy_id is not None:
        kwargs['parent_tenancy_id'] = parent_tenancy_id
    if child_tenancy_id is not None:
        kwargs['child_tenancy_id'] = child_tenancy_id
    if lifecycle_state is not None:
        kwargs['lifecycle_state'] = lifecycle_state
    if page is not None:
        kwargs['page'] = page
    if limit is not None:
        kwargs['limit'] = limit
    if sort_order is not None:
        kwargs['sort_order'] = sort_order
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
    client = cli_util.build_client('tenant_manager_control_plane', 'link', ctx)
    if all_pages:
        if page_size:
            kwargs['limit'] = page_size

        result = cli_util.list_call_get_all_results(
            client.list_links,
            **kwargs
        )
    elif limit is not None:
        result = cli_util.list_call_get_up_to_limit(
            client.list_links,
            limit,
            page_size,
            **kwargs
        )
    else:
        result = client.list_links(
            **kwargs
        )
    cli_util.render_response(result, ctx)
示例#6
0
def list_appliance_export_jobs(ctx, from_json, all_pages, page_size,
                               compartment_id, lifecycle_state, display_name,
                               limit, page):

    if all_pages and limit:
        raise click.UsageError(
            'If you provide the --all option you cannot provide the --limit option'
        )

    kwargs = {}
    if lifecycle_state is not None:
        kwargs['lifecycle_state'] = lifecycle_state
    if display_name is not None:
        kwargs['display_name'] = display_name
    if limit is not None:
        kwargs['limit'] = limit
    if page is not None:
        kwargs['page'] = page
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(
        ctx.obj['request_id'])
    client = cli_util.build_client('dts', 'appliance_export_job', ctx)
    if all_pages:
        if page_size:
            kwargs['limit'] = page_size

        result = cli_util.list_call_get_all_results(
            client.list_appliance_export_jobs,
            compartment_id=compartment_id,
            **kwargs)
    elif limit is not None:
        result = cli_util.list_call_get_up_to_limit(
            client.list_appliance_export_jobs,
            limit,
            page_size,
            compartment_id=compartment_id,
            **kwargs)
    else:
        result = client.list_appliance_export_jobs(
            compartment_id=compartment_id, **kwargs)
    cli_util.render_response(result, ctx)
示例#7
0
def list_events(ctx, from_json, all_pages, compartment_id, start_time,
                end_time, page):

    kwargs = {}
    if page is not None:
        kwargs['page'] = page
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(
        ctx.obj['request_id'])
    client = cli_util.build_client('audit', 'audit', ctx)
    if all_pages:
        result = cli_util.list_call_get_all_results(
            client.list_events,
            compartment_id=compartment_id,
            start_time=start_time,
            end_time=end_time,
            **kwargs)
    else:
        result = client.list_events(compartment_id=compartment_id,
                                    start_time=start_time,
                                    end_time=end_time,
                                    **kwargs)
    cli_util.render_response(result, ctx)
def get_job_logs_extended(ctx, job_id, type, level_greater_than_or_equal_to, sort_order, limit, page, timestamp_greater_than_or_equal_to, timestamp_less_than_or_equal_to, all_pages, **kwargs):

    if all_pages and limit:
        raise click.UsageError('If you provide the --all option you cannot provide the --limit option')

    if isinstance(job_id, six.string_types) and len(job_id.strip()) == 0:
        raise click.UsageError('Parameter --job-id cannot be whitespace or empty string')

    kwargs = {}
    if type is not None and len(type) > 0:
        kwargs['type'] = type
    if level_greater_than_or_equal_to is not None:
        kwargs['level_greater_than_or_equal_to'] = level_greater_than_or_equal_to
    if sort_order is not None:
        kwargs['sort_order'] = sort_order
    if limit is not None:
        kwargs['limit'] = limit
    if page is not None:
        kwargs['page'] = page
    if timestamp_greater_than_or_equal_to is not None:
        kwargs['timestamp_greater_than_or_equal_to'] = timestamp_greater_than_or_equal_to
    if timestamp_less_than_or_equal_to is not None:
        kwargs['timestamp_less_than_or_equal_to'] = timestamp_less_than_or_equal_to
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
    client = cli_util.build_client('resource_manager', 'resource_manager', ctx)

    if all_pages:
        result = cli_util.list_call_get_all_results(
            client.get_job_logs,
            job_id=job_id,
            **kwargs
        )
    # GetJobLogs operation already has built in support for limit
    else:
        result = client.get_job_logs(
            job_id=job_id,
            **kwargs
        )
    cli_util.render_response(result, ctx)
示例#9
0
def list_reports(ctx, from_json, all_pages, report_type, date, compartment_id,
                 page):

    kwargs = {}
    if page is not None:
        kwargs['page'] = page
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(
        ctx.obj['request_id'])
    client = cli_util.build_client('marketplace', 'marketplace', ctx)
    if all_pages:
        result = cli_util.list_call_get_all_results(
            client.list_reports,
            report_type=report_type,
            date=date,
            compartment_id=compartment_id,
            **kwargs)
    else:
        result = client.list_reports(report_type=report_type,
                                     date=date,
                                     compartment_id=compartment_id,
                                     **kwargs)
    cli_util.render_response(result, ctx)
示例#10
0
def list_available_regions(ctx, from_json, all_pages, subscription_id, page):

    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')

    kwargs = {}
    if page is not None:
        kwargs['page'] = page
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(
        ctx.obj['request_id'])
    client = cli_util.build_client('tenant_manager_control_plane',
                                   'subscription', ctx)
    if all_pages:
        result = cli_util.list_call_get_all_results(
            client.list_available_regions,
            subscription_id=subscription_id,
            **kwargs)
    else:
        result = client.list_available_regions(subscription_id=subscription_id,
                                               **kwargs)
    cli_util.render_response(result, ctx)
def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, page, limit, integration_instance_id):

    if all_pages and limit:
        raise click.UsageError('If you provide the --all option you cannot provide the --limit option')

    kwargs = {}
    if page is not None:
        kwargs['page'] = page
    if limit is not None:
        kwargs['limit'] = limit
    if integration_instance_id is not None:
        kwargs['integration_instance_id'] = integration_instance_id
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
    client = cli_util.build_client('integration_instance', ctx)
    if all_pages:
        if page_size:
            kwargs['limit'] = page_size

        result = cli_util.list_call_get_all_results(
            client.list_work_requests,
            compartment_id=compartment_id,
            **kwargs
        )
    elif limit is not None:
        result = cli_util.list_call_get_up_to_limit(
            client.list_work_requests,
            limit,
            page_size,
            compartment_id=compartment_id,
            **kwargs
        )
    else:
        result = client.list_work_requests(
            compartment_id=compartment_id,
            **kwargs
        )
    cli_util.render_response(result, ctx)
示例#12
0
def list_threat_types(ctx, from_json, all_pages, page_size, compartment_id, limit, page, sort_order):

    if all_pages and limit:
        raise click.UsageError('If you provide the --all option you cannot provide the --limit option')

    kwargs = {}
    if limit is not None:
        kwargs['limit'] = limit
    if page is not None:
        kwargs['page'] = page
    if sort_order is not None:
        kwargs['sort_order'] = sort_order
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
    client = cli_util.build_client('threat_intelligence', 'threatintel', ctx)
    if all_pages:
        if page_size:
            kwargs['limit'] = page_size

        result = cli_util.list_call_get_all_results(
            client.list_threat_types,
            compartment_id=compartment_id,
            **kwargs
        )
    elif limit is not None:
        result = cli_util.list_call_get_up_to_limit(
            client.list_threat_types,
            limit,
            page_size,
            compartment_id=compartment_id,
            **kwargs
        )
    else:
        result = client.list_threat_types(
            compartment_id=compartment_id,
            **kwargs
        )
    cli_util.render_response(result, ctx)
def list_subscriptions(ctx, from_json, all_pages, page_size, compartment_id, topic_id, page, limit):

    if all_pages and limit:
        raise click.UsageError('If you provide the --all option you cannot provide the --limit option')

    kwargs = {}
    if topic_id is not None:
        kwargs['topic_id'] = topic_id
    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'])
    client = cli_util.build_client('ons', 'notification_data_plane', ctx)
    if all_pages:
        if page_size:
            kwargs['limit'] = page_size

        result = cli_util.list_call_get_all_results(
            client.list_subscriptions,
            compartment_id=compartment_id,
            **kwargs
        )
    elif limit is not None:
        result = cli_util.list_call_get_up_to_limit(
            client.list_subscriptions,
            limit,
            page_size,
            compartment_id=compartment_id,
            **kwargs
        )
    else:
        result = client.list_subscriptions(
            compartment_id=compartment_id,
            **kwargs
        )
    cli_util.render_response(result, ctx)
示例#14
0
def list_supported_vmware_software_versions(ctx, from_json, all_pages,
                                            page_size, compartment_id, limit,
                                            page):

    if all_pages and limit:
        raise click.UsageError(
            'If you provide the --all option you cannot provide the --limit option'
        )

    kwargs = {}
    if limit is not None:
        kwargs['limit'] = limit
    if page is not None:
        kwargs['page'] = page
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(
        ctx.obj['request_id'])
    client = cli_util.build_client('ocvp', 'sddc', ctx)
    if all_pages:
        if page_size:
            kwargs['limit'] = page_size

        result = cli_util.list_call_get_all_results(
            client.list_supported_vmware_software_versions,
            compartment_id=compartment_id,
            **kwargs)
    elif limit is not None:
        result = cli_util.list_call_get_up_to_limit(
            client.list_supported_vmware_software_versions,
            limit,
            page_size,
            compartment_id=compartment_id,
            **kwargs)
    else:
        result = client.list_supported_vmware_software_versions(
            compartment_id=compartment_id, **kwargs)
    cli_util.render_response(result, ctx)
示例#15
0
def list_attention_logs(ctx, from_json, all_pages, page_size,
                        managed_database_id, time_greater_than_or_equal_to,
                        time_less_than_or_equal_to, urgency_filter,
                        type_filter, log_search_text, is_regular_expression,
                        sort_by, sort_order, page, limit):

    if all_pages and limit:
        raise click.UsageError(
            'If you provide the --all option you cannot provide the --limit option'
        )

    if isinstance(managed_database_id, six.string_types) and len(
            managed_database_id.strip()) == 0:
        raise click.UsageError(
            'Parameter --managed-database-id cannot be whitespace or empty string'
        )

    kwargs = {}
    if time_greater_than_or_equal_to is not None:
        kwargs['time_greater_than_or_equal_to'] = time_greater_than_or_equal_to
    if time_less_than_or_equal_to is not None:
        kwargs['time_less_than_or_equal_to'] = time_less_than_or_equal_to
    if urgency_filter is not None:
        kwargs['urgency_filter'] = urgency_filter
    if type_filter is not None:
        kwargs['type_filter'] = type_filter
    if log_search_text is not None:
        kwargs['log_search_text'] = log_search_text
    if is_regular_expression is not None:
        kwargs['is_regular_expression'] = is_regular_expression
    if sort_by is not None:
        kwargs['sort_by'] = sort_by
    if sort_order is not None:
        kwargs['sort_order'] = sort_order
    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'])
    client = cli_util.build_client('database_management', 'diagnosability',
                                   ctx)
    if all_pages:
        if page_size:
            kwargs['limit'] = page_size

        result = cli_util.list_call_get_all_results(
            client.list_attention_logs,
            managed_database_id=managed_database_id,
            **kwargs)
    elif limit is not None:
        result = cli_util.list_call_get_up_to_limit(
            client.list_attention_logs,
            limit,
            page_size,
            managed_database_id=managed_database_id,
            **kwargs)
    else:
        result = client.list_attention_logs(
            managed_database_id=managed_database_id, **kwargs)
    cli_util.render_response(result, ctx)