def create_connection(prof=None, user_agent=None, **kwargs):
        try:
            conn = connection.Connection(profile=prof, user_agent=user_agent,
                                         **kwargs)
        except exceptions.HttpException as ex:
            exc.parse_exception(ex.details)

        return conn
Example #2
0
    def __init__(self, prof=None, user_agent=None, **kwargs):
        try:
            conn = plugin.create_connection(prof=prof,
                                            user_agent=user_agent,
                                            **kwargs)
        except exceptions.HttpException as ex:
            exc.parse_exception(ex.details)

        self.conn = conn
        self.service = self.conn.cluster
def print_list(objs, fields, formatters=None, sortby_index=0,
               mixed_case_fields=None, field_labels=None):
    # This wrapper is needed because sdk may yield a generator that will
    # escape the exception catching previously
    if not objs:
        objs = []

    try:
        _print_list(objs, fields, formatters=formatters,
                    sortby_index=sortby_index,
                    mixed_case_fields=mixed_case_fields,
                    field_labels=field_labels)
    except Exception as ex:
        exc.parse_exception(ex)
Example #4
0
def create_connection(prof=None, user_agent=None, **kwargs):
        if not prof:
            prof = profile.Profile()
        interface = kwargs.pop('interface', None)
        region_name = kwargs.pop('region_name', None)
        if interface:
            prof.set_interface('clustering', interface)
        if region_name:
            prof.set_region('clustering', region_name)

        try:
            conn = connection.Connection(profile=prof, user_agent=user_agent,
                                         **kwargs)
        except exceptions.HttpException as ex:
            exc.parse_exception(ex.details)

        return conn
Example #5
0
def create_connection(prof=None, user_agent=None, **kwargs):
        if not prof:
            prof = profile.Profile()
        interface = kwargs.pop('interface', None)
        region_name = kwargs.pop('region_name', None)
        if interface:
            prof.set_interface('clustering', interface)
        if region_name:
            prof.set_region('clustering', region_name)

        prof.set_api_version('clustering', '1.2')
        try:
            conn = connection.Connection(profile=prof, user_agent=user_agent,
                                         **kwargs)
        except exceptions.HttpException as ex:
            exc.parse_exception(ex.details)

        return conn
Example #6
0
def print_list(objs,
               fields,
               formatters=None,
               sortby_index=0,
               mixed_case_fields=None,
               field_labels=None):
    # This wrapper is needed because sdk may yield a generator that will
    # escape the exception catching previously
    if not objs:
        objs = []

    try:
        _print_list(objs,
                    fields,
                    formatters=formatters,
                    sortby_index=sortby_index,
                    mixed_case_fields=mixed_case_fields,
                    field_labels=field_labels)
    except Exception as ex:
        exc.parse_exception(ex)