Example #1
0
def test_docs_generated():
    """Verify we can generate the appropriate docs for all services"""
    botocore_session = botocore.session.get_session()
    session = boto3.Session()
    for service_name in session.get_available_services():
        generated_docs = ServiceDocumenter(service_name).document_service()
        generated_docs = generated_docs.decode('utf-8')
        client = boto3.client(service_name, 'us-east-1')

        # Check that all services have the client documented.
        yield (_assert_has_client_documentation, generated_docs, service_name,
               client)

        # If the client can paginate, make sure the paginators are documented.
        try:
            paginator_model = botocore_session.get_paginator_model(
                service_name)
            yield (_assert_has_paginator_documentation, generated_docs,
                   service_name, client,
                   sorted(paginator_model._paginator_config))
        except DataNotFoundError:
            pass

        # If the client has waiters, make sure the waiters are documented
        if client.waiter_names:
            yield (_assert_has_waiter_documentation, generated_docs,
                   service_name, client)

        # If the service has resources, make sure the service resource
        # is at least documented.
        if service_name in session.get_available_resources():
            resource = boto3.resource(service_name, 'us-east-1')
            yield (_assert_has_resource_documentation, generated_docs,
                   service_name, resource)
Example #2
0
def test_docs_generated():
    """Verify we can generate the appropriate docs for all services"""
    botocore_session = botocore.session.get_session()
    session = boto3.Session()
    for service_name in session.get_available_services():
        generated_docs = ServiceDocumenter(service_name).document_service()
        generated_docs = generated_docs.decode('utf-8')
        client = boto3.client(service_name, 'us-east-1')

        # Check that all services have the client documented.
        yield (_assert_has_client_documentation, generated_docs, service_name,
               client)

        # If the client can paginate, make sure the paginators are documented.
        try:
            paginator_model = botocore_session.get_paginator_model(
                service_name)
            yield (_assert_has_paginator_documentation, generated_docs,
                   service_name, client,
                   sorted(paginator_model._paginator_config))
        except DataNotFoundError:
            pass

        # If the client has waiters, make sure the waiters are documented
        if client.waiter_names:
            yield (_assert_has_waiter_documentation, generated_docs,
                   service_name, client)

        # If the service has resources, make sure the service resource
        # is at least documented.
        if service_name in session.get_available_resources():
            resource = boto3.resource(service_name, 'us-east-1')
            yield (_assert_has_resource_documentation, generated_docs,
                   service_name, resource)
def test_lint_waiter_configs():
    session = botocore.session.get_session()
    for service_name in session.get_available_services():
        client = session.create_client(service_name, 'us-east-1')
        service_model = client.meta.service_model
        for waiter_name in client.waiter_names:
            yield _lint_single_waiter, client, waiter_name, service_model
 def _build_builtin_commands(self, session):
     commands = OrderedDict()
     services = session.get_available_services()
     for service_name in services:
         commands[service_name] = ServiceCommand(cli_name=service_name,
                                                 session=self.session,
                                                 service_name=service_name)
     return commands
Example #5
0
 def _build_builtin_commands(self, session):
     commands = OrderedDict()
     services = session.get_available_services()
     for service_name in services:
         commands[service_name] = ServiceCommand(cli_name=service_name,
                                                 session=self.session,
                                                 service_name=service_name)
     return commands
Example #6
0
def _all_inputs():
    session = botocore.session.get_session()
    for service_name in session.get_available_services():
        service_model = session.get_service_model(service_name)
        for operation_name in service_model.operation_names:
            operation_model = service_model.operation_model(operation_name)
            input_shape = operation_model.input_shape
            if input_shape is not None and input_shape.members:
                yield input_shape, service_name, operation_name
Example #7
0
def test_can_generate_all_inputs():
    session = botocore.session.get_session()
    generator = ArgumentGenerator()
    for service_name in session.get_available_services():
        service_model = session.get_service_model(service_name)
        for operation_name in service_model.operation_names:
            operation_model = service_model.operation_model(operation_name)
            input_shape = operation_model.input_shape
            if input_shape is not None and input_shape.members:
                yield (_test_can_generate_skeleton, generator,
                       input_shape, service_name, operation_name)
Example #8
0
def _waiter_configs():
    session = botocore.session.get_session()
    validator = Draft4Validator(WAITER_SCHEMA)
    for service_name in session.get_available_services():
        client = session.create_client(service_name, 'us-east-1')
        try:
            # We use the loader directly here because we need the entire
            # json document, not just the portions exposed (either
            # internally or externally) by the WaiterModel class.
            loader = session.get_component('data_loader')
            waiter_model = loader.load_service_model(service_name, 'waiters-2')
        except UnknownServiceError:
            # The service doesn't have waiters
            continue
        yield validator, waiter_model, client
Example #9
0
def test_lint_waiter_configs():
    session = botocore.session.get_session()
    validator = Draft4Validator(WAITER_SCHEMA)
    for service_name in session.get_available_services():
        client = session.create_client(service_name, 'us-east-1')
        service_model = client.meta.service_model
        try:
            # We use the loader directly here because we need the entire
            # json document, not just the portions exposed (either
            # internally or externally) by the WaiterModel class.
            loader = session.get_component('data_loader')
            waiter_model = loader.load_service_model(
                service_name, 'waiters-2')
        except UnknownServiceError:
            # The service doesn't have waiters
            continue
        yield _validate_schema, validator, waiter_model
        for waiter_name in client.waiter_names:
            yield _lint_single_waiter, client, waiter_name, service_model
Example #10
0
def generate_docs(root_dir):
    """Generates the reference documentation for botocore

    This will go through every available AWS service and output ReSTructured
    text files documenting each service.

    :param root_dir: The directory to write the reference files to. Each
        service's reference documentation is loacated at
        root_dir/reference/services/service-name.rst
    """
    services_doc_path = os.path.join(root_dir, 'reference', 'services')
    if not os.path.exists(services_doc_path):
        os.makedirs(services_doc_path)

    # Generate reference docs and write them out.
    session = botocore.session.get_session()
    for service_name in session.get_available_services():
        docs = ServiceDocumenter(service_name).document_service()
        service_doc_path = os.path.join(
            services_doc_path, service_name + '.rst')
        with open(service_doc_path, 'wb') as f:
            f.write(docs)
Example #11
0
def generate_docs(root_dir):
    """Generates the reference documentation for botocore

    This will go through every available AWS service and output ReSTructured
    text files documenting each service.

    :param root_dir: The directory to write the reference files to. Each
        service's reference documentation is loacated at
        root_dir/reference/services/service-name.rst
    """
    services_doc_path = os.path.join(root_dir, 'reference', 'services')
    if not os.path.exists(services_doc_path):
        os.makedirs(services_doc_path)

    # Generate reference docs and write them out.
    session = botocore.session.get_session()
    for service_name in session.get_available_services():
        docs = ServiceDocumenter(service_name).document_service()
        service_doc_path = os.path.join(services_doc_path,
                                        service_name + '.rst')
        with open(service_doc_path, 'wb') as f:
            f.write(docs)
Example #12
0
 def test_get_aws_services_in_alphabetical_order(self):
     session = create_session(session_vars=self.env_vars)
     services = session.get_available_services()
     self.assertEqual(sorted(services), services)
Example #13
0
 def test_get_aws_services_in_alphabetical_order(self):
     session = create_session(session_vars=self.env_vars)
     services = session.get_available_services()
     self.assertEqual(sorted(services), services)
Example #14
0
 def _get_choices(self):
     session = botocore.session.get_session()
     return session.get_available_services()
Example #15
0
def _all_clients():
    session = create_session()
    for service_name in session.get_available_services():
        yield session, service_name
Example #16
0
def test_can_create_all_clients():
    session = create_session()
    for service_name in session.get_available_services():
        yield _test_create_client, session, service_name
Example #17
0
def all_services():
    session = boto3.Session(region_name='us-east-1')
    for service_name in session.get_available_services():
        yield service_name
Example #18
0
def all_services():
    session = boto3.Session(region_name='us-east-1')
    yield from session.get_available_services()