def list_subscriptions(ctx, from_json, all_pages, page_size, compartment_id, plan_number, subscription_id, buyer_email, is_commit_info_required, 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 plan_number is not None: kwargs['plan_number'] = plan_number if subscription_id is not None: kwargs['subscription_id'] = subscription_id if buyer_email is not None: kwargs['buyer_email'] = buyer_email if is_commit_info_required is not None: kwargs['is_commit_info_required'] = is_commit_info_required 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('onesubscription', 'subscription', 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)
def list_listings(ctx, from_json, all_pages, page_size, name, listing_id, publisher_id, package_type, limit, page, sort_by, sort_order, category, pricing, is_featured): if all_pages and limit: raise click.UsageError( 'If you provide the --all option you cannot provide the --limit option' ) kwargs = {} if name is not None and len(name) > 0: kwargs['name'] = name if listing_id is not None: kwargs['listing_id'] = listing_id if publisher_id is not None: kwargs['publisher_id'] = publisher_id if package_type is not None: kwargs['package_type'] = package_type 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 if category is not None and len(category) > 0: kwargs['category'] = category if pricing is not None and len(pricing) > 0: kwargs['pricing'] = pricing if is_featured is not None: kwargs['is_featured'] = is_featured kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) client = cli_util.build_client('marketplace', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results(client.list_listings, **kwargs) elif limit is not None: result = cli_util.list_call_get_up_to_limit(client.list_listings, limit, page_size, **kwargs) else: result = client.list_listings(**kwargs) cli_util.render_response(result, ctx)
def list_redeemable_users(ctx, from_json, all_pages, page_size, tenancy_id, subscription_id, page, limit, sort_order, sort_by): if all_pages and limit: raise click.UsageError( 'If you provide the --all option you cannot provide the --limit option' ) 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 if limit is not None: kwargs['limit'] = limit 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('usage', 'rewards', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_redeemable_users, tenancy_id=tenancy_id, subscription_id=subscription_id, **kwargs) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_redeemable_users, limit, page_size, tenancy_id=tenancy_id, subscription_id=subscription_id, **kwargs) else: result = client.list_redeemable_users(tenancy_id=tenancy_id, subscription_id=subscription_id, **kwargs) cli_util.render_response(result, ctx)
def list_work_request_errors(ctx, from_json, all_pages, page_size, work_request_id, page, limit, 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(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 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('governance_rules_control_plane', 'work_request', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_work_request_errors, 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_errors, limit, page_size, work_request_id=work_request_id, **kwargs) else: result = client.list_work_request_errors( work_request_id=work_request_id, **kwargs) cli_util.render_response(result, ctx)
def list_rover_clusters(ctx, from_json, all_pages, page_size, compartment_id, display_name, cluster_type, limit, page, 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 display_name is not None: kwargs['display_name'] = display_name if cluster_type is not None: kwargs['cluster_type'] = cluster_type if limit is not None: kwargs['limit'] = limit if page is not None: kwargs['page'] = page 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('rover', 'rover_cluster', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_rover_clusters, compartment_id=compartment_id, **kwargs) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_rover_clusters, limit, page_size, compartment_id=compartment_id, **kwargs) else: result = client.list_rover_clusters(compartment_id=compartment_id, **kwargs) cli_util.render_response(result, ctx)
def list_agreements(ctx, from_json, all_pages, page_size, listing_id, package_version, limit, page, compartment_id): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') if isinstance(listing_id, six.string_types) and len(listing_id.strip()) == 0: raise click.UsageError('Parameter --listing-id cannot be whitespace or empty string') if isinstance(package_version, six.string_types) and len(package_version.strip()) == 0: raise click.UsageError('Parameter --package-version cannot be whitespace or empty string') kwargs = {} if limit is not None: kwargs['limit'] = limit if page is not None: kwargs['page'] = page if compartment_id is not None: kwargs['compartment_id'] = compartment_id 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: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_agreements, listing_id=listing_id, package_version=package_version, **kwargs ) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_agreements, limit, page_size, listing_id=listing_id, package_version=package_version, **kwargs ) else: result = client.list_agreements( listing_id=listing_id, package_version=package_version, **kwargs ) cli_util.render_response(result, ctx)
def list_alert_rules(ctx, from_json, all_pages, page_size, budget_id, limit, page, sort_order, sort_by, lifecycle_state, display_name): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') if isinstance(budget_id, six.string_types) and len(budget_id.strip()) == 0: raise click.UsageError('Parameter --budget-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_order is not None: kwargs['sort_order'] = sort_order if sort_by is not None: kwargs['sort_by'] = sort_by if lifecycle_state is not None: kwargs['lifecycle_state'] = lifecycle_state if display_name is not None: kwargs['display_name'] = display_name kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) client = cli_util.build_client('budget', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_alert_rules, budget_id=budget_id, **kwargs ) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_alert_rules, limit, page_size, budget_id=budget_id, **kwargs ) else: result = client.list_alert_rules( budget_id=budget_id, **kwargs ) cli_util.render_response(result, ctx)
def list_related_events(ctx, from_json, all_pages, page_size, event_fingerprint, compartment_id, limit, page, sort_order, sort_by, latest_timestamp_less_than, latest_timestamp_greater_than_or_equal_to): 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 if sort_by is not None: kwargs['sort_by'] = sort_by if latest_timestamp_less_than is not None: kwargs['latest_timestamp_less_than'] = latest_timestamp_less_than if latest_timestamp_greater_than_or_equal_to is not None: kwargs['latest_timestamp_greater_than_or_equal_to'] = latest_timestamp_greater_than_or_equal_to kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) client = cli_util.build_client('os_management', 'event', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_related_events, event_fingerprint=event_fingerprint, compartment_id=compartment_id, **kwargs ) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_related_events, limit, page_size, event_fingerprint=event_fingerprint, compartment_id=compartment_id, **kwargs ) else: result = client.list_related_events( event_fingerprint=event_fingerprint, compartment_id=compartment_id, **kwargs ) cli_util.render_response(result, ctx)
def list_instance_agent_command_executions(ctx, from_json, all_pages, page_size, compartment_id, instance_id, page, limit, sort_by, sort_order, lifecycle_state): 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 sort_by is not None: kwargs['sort_by'] = sort_by if sort_order is not None: kwargs['sort_order'] = sort_order if lifecycle_state is not None: kwargs['lifecycle_state'] = lifecycle_state kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) client = cli_util.build_client('compute_instance_agent', 'compute_instance_agent', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_instance_agent_command_executions, compartment_id=compartment_id, instance_id=instance_id, **kwargs) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_instance_agent_command_executions, limit, page_size, compartment_id=compartment_id, instance_id=instance_id, **kwargs) else: result = client.list_instance_agent_command_executions( compartment_id=compartment_id, instance_id=instance_id, **kwargs) cli_util.render_response(result, ctx)
def list_subscribed_services(ctx, from_json, all_pages, page_size, compartment_id, subscription_id, order_line_id, status, 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 order_line_id is not None: kwargs['order_line_id'] = order_line_id if status is not None: kwargs['status'] = status 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('onesubscription', 'subscribed_service', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_subscribed_services, compartment_id=compartment_id, subscription_id=subscription_id, **kwargs ) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_subscribed_services, limit, page_size, compartment_id=compartment_id, subscription_id=subscription_id, **kwargs ) else: result = client.list_subscribed_services( compartment_id=compartment_id, subscription_id=subscription_id, **kwargs ) cli_util.render_response(result, ctx)
def list_domains(ctx, from_json, all_pages, page_size, compartment_id, domain_id, lifecycle_state, status, name, page, limit, sort_by, sort_order): if all_pages and limit: raise click.UsageError( 'If you provide the --all option you cannot provide the --limit option' ) kwargs = {} if domain_id is not None: kwargs['domain_id'] = domain_id if lifecycle_state is not None: kwargs['lifecycle_state'] = lifecycle_state if status is not None: kwargs['status'] = status if name is not None: kwargs['name'] = name if page is not None: kwargs['page'] = page if limit is not None: kwargs['limit'] = limit 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('tenant_manager_control_plane', 'domain', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_domains, compartment_id=compartment_id, **kwargs) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_domains, limit, page_size, compartment_id=compartment_id, **kwargs) else: result = client.list_domains(compartment_id=compartment_id, **kwargs) cli_util.render_response(result, ctx)
def list_suppressions(ctx, from_json, all_pages, page_size, compartment_id, email_address, time_created_greater_than_or_equal_to, time_created_less_than, page, limit, sort_by, sort_order): if all_pages and limit: raise click.UsageError( 'If you provide the --all option you cannot provide the --limit option' ) kwargs = {} if email_address is not None: kwargs['email_address'] = email_address if time_created_greater_than_or_equal_to is not None: kwargs[ 'time_created_greater_than_or_equal_to'] = time_created_greater_than_or_equal_to if time_created_less_than is not None: kwargs['time_created_less_than'] = time_created_less_than if page is not None: kwargs['page'] = page if limit is not None: kwargs['limit'] = limit 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('email', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_suppressions, compartment_id=compartment_id, **kwargs) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_suppressions, limit, page_size, compartment_id=compartment_id, **kwargs) else: result = client.list_suppressions(compartment_id=compartment_id, **kwargs) cli_util.render_response(result, ctx)
def list_functions(ctx, from_json, all_pages, page_size, application_id, limit, page, lifecycle_state, display_name, id, 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 limit is not None: kwargs['limit'] = limit if page is not None: kwargs['page'] = page if lifecycle_state is not None: kwargs['lifecycle_state'] = lifecycle_state if display_name is not None: kwargs['display_name'] = display_name if id is not None: kwargs['id'] = id 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('functions_management', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_functions, application_id=application_id, **kwargs ) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_functions, limit, page_size, application_id=application_id, **kwargs ) else: result = client.list_functions( application_id=application_id, **kwargs ) cli_util.render_response(result, ctx)
def list_compartments(ctx, from_json, all_pages, page_size, compartment_id, page, limit, access_level, compartment_id_in_subtree, with_root): 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 access_level is not None: kwargs['access_level'] = access_level if compartment_id_in_subtree is not None: kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree client = cli_util.build_client('identity', 'identity', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_compartments, compartment_id=compartment_id, **kwargs) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_compartments, limit, page_size, compartment_id=compartment_id, **kwargs) else: result = client.list_compartments(compartment_id=compartment_id, **kwargs) if with_root: tenancy_id = get_tenancy_from_config(ctx) tenancy_result = client.get_compartment(compartment_id=tenancy_id, ) if limit is not None and result.data: # remove from list as root will be one compartment result.data.pop() result.data.insert(0, tenancy_result.data) cli_util.render_response(result, ctx)
def list_esxi_hosts(ctx, from_json, all_pages, page_size, sddc_id, compute_instance_id, display_name, limit, page, sort_order, sort_by, lifecycle_state): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') kwargs = {} if sddc_id is not None: kwargs['sddc_id'] = sddc_id if compute_instance_id is not None: kwargs['compute_instance_id'] = compute_instance_id 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 if lifecycle_state is not None: kwargs['lifecycle_state'] = lifecycle_state kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) client = cli_util.build_client('ocvp', 'esxi_host', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_esxi_hosts, **kwargs ) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_esxi_hosts, limit, page_size, **kwargs ) else: result = client.list_esxi_hosts( **kwargs ) cli_util.render_response(result, ctx)
def list_users_for_group(ctx, from_json, compartment_id, group_id, page, limit, all_pages, page_size): cli_util.load_context_obj_values_from_defaults(ctx) if all_pages and limit: raise click.UsageError( 'If you provide the --all option you cannot provide the --limit option' ) client = cli_util.build_client('identity', 'identity', ctx) args = {} args['group_id'] = group_id if page is not None: args['page'] = page if limit is not None: args['limit'] = limit if all_pages: if page_size: args['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_user_group_memberships, compartment_id=compartment_id, **args) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_user_group_memberships, limit, page_size, compartment_id=compartment_id, **args) else: result = client.list_user_group_memberships( compartment_id=compartment_id, **args) users = [] for membership in result.data: users.append(client.get_user(membership.user_id).data) cli_util.render(users, result.headers, ctx)
def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, work_request_id, status, resource_id, page, limit, 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 compartment_id is not None: kwargs['compartment_id'] = compartment_id if work_request_id is not None: kwargs['work_request_id'] = work_request_id if status is not None: kwargs['status'] = status if resource_id is not None: kwargs['resource_id'] = resource_id 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 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('opa', 'opa_instance', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_work_requests, **kwargs ) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_work_requests, limit, page_size, **kwargs ) else: result = client.list_work_requests( **kwargs ) cli_util.render_response(result, ctx)
def list_limit_definitions(ctx, from_json, all_pages, page_size, compartment_id, service_name, name, sort_by, sort_order, limit, page): if all_pages and limit: raise click.UsageError( 'If you provide the --all option you cannot provide the --limit option' ) kwargs = {} if service_name is not None: kwargs['service_name'] = service_name if name is not None: kwargs['name'] = name if sort_by is not None: kwargs['sort_by'] = sort_by 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 kwargs['opc_request_id'] = cli_util.use_or_generate_request_id( ctx.obj['request_id']) client = cli_util.build_client('limits', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_limit_definitions, compartment_id=compartment_id, **kwargs) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_limit_definitions, limit, page_size, compartment_id=compartment_id, **kwargs) else: result = client.list_limit_definitions(compartment_id=compartment_id, **kwargs) cli_util.render_response(result, ctx)
def list_packages(ctx, from_json, all_pages, page_size, oda_instance_id, resource_type, name, display_name, is_latest_skill_only, 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 oda_instance_id is not None: kwargs['oda_instance_id'] = oda_instance_id if resource_type is not None: kwargs['resource_type'] = resource_type if name is not None: kwargs['name'] = name if display_name is not None: kwargs['display_name'] = display_name if is_latest_skill_only is not None: kwargs['is_latest_skill_only'] = is_latest_skill_only 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('oda', 'odapackage', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results(client.list_packages, **kwargs) elif limit is not None: result = cli_util.list_call_get_up_to_limit(client.list_packages, limit, page_size, **kwargs) else: result = client.list_packages(**kwargs) cli_util.render_response(result, ctx)
def list_work_request_logs(ctx, from_json, all_pages, page_size, compartment_id, work_request_id, limit, page): 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 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('integration_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, compartment_id=compartment_id, 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, compartment_id=compartment_id, work_request_id=work_request_id, **kwargs) else: result = client.list_work_request_logs(compartment_id=compartment_id, work_request_id=work_request_id, **kwargs) cli_util.render_response(result, ctx)
def list_subscription_mappings(ctx, from_json, all_pages, page_size, subscription_id, subscription_mapping_id, compartment_id, lifecycle_state, page, limit, 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 subscription_id is not None: kwargs['subscription_id'] = subscription_id if subscription_mapping_id is not None: kwargs['subscription_mapping_id'] = subscription_mapping_id if compartment_id is not None: kwargs['compartment_id'] = compartment_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 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('tenant_manager_control_plane', 'subscription', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_subscription_mappings, **kwargs) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_subscription_mappings, limit, page_size, **kwargs) else: result = client.list_subscription_mappings(**kwargs) cli_util.render_response(result, ctx)
def list_subscriptions(ctx, from_json, all_pages, page_size, osp_home_region, compartment_id, page, limit, sort_by, sort_order): 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 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('osp_gateway', 'subscription_service', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_subscriptions, osp_home_region=osp_home_region, 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, osp_home_region=osp_home_region, compartment_id=compartment_id, **kwargs) else: result = client.list_subscriptions(osp_home_region=osp_home_region, compartment_id=compartment_id, **kwargs) cli_util.render_response(result, ctx)
def list_access_request_histories(ctx, from_json, all_pages, page_size, access_request_id, limit, page): if all_pages and limit: raise click.UsageError( 'If you provide the --all option you cannot provide the --limit option' ) if isinstance(access_request_id, six.string_types) and len( access_request_id.strip()) == 0: raise click.UsageError( 'Parameter --access-request-id cannot be whitespace or empty string' ) 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('operator_access_control', 'access_requests', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_access_request_histories, access_request_id=access_request_id, **kwargs) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_access_request_histories, limit, page_size, access_request_id=access_request_id, **kwargs) else: result = client.list_access_request_histories( access_request_id=access_request_id, **kwargs) cli_util.render_response(result, ctx)
def list_organization_tenancies(ctx, from_json, all_pages, page_size, organization_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(organization_id, six.string_types) and len( organization_id.strip()) == 0: raise click.UsageError( 'Parameter --organization-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('tenant_manager_control_plane', 'organization', ctx) if all_pages: if page_size: kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( client.list_organization_tenancies, organization_id=organization_id, **kwargs) elif limit is not None: result = cli_util.list_call_get_up_to_limit( client.list_organization_tenancies, limit, page_size, organization_id=organization_id, **kwargs) else: result = client.list_organization_tenancies( organization_id=organization_id, **kwargs) cli_util.render_response(result, ctx)
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)
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)
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)
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_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)
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)