# Path: invtool/lib/registrar.py
# class Registrar():
#     def register(self, dispatch):
# 
# Path: invtool/core_dispatch.py
# class CoreDispatch(ObjectDispatch):
#     object_url = "/en-US/core/api/v1_core/{1}/{2}/"
#     object_list_url = "/en-US/core/api/v1_core/{1}/"
# 
# Path: invtool/lib/config.py
# API_MAJOR_VERSION = 1
# 
# Path: invtool/lib/options.py
# def comment_argument(field_name):
#     def add_com_arg(parser, **kwargs):
#         parser.add_argument(
#             '--comment', default="", type=str,
#             dest='comment', help="Use this to record why a change is "
#             "being made", required=False
#         )
# 
#     def test_data():
#         return 'comment', TEST_DESCRIPTION  # Reuse this test data
# 
#     return add_com_arg, build_extractor(field_name, 'comment'), test_data
# 
# def general_argument(field_name, help, type=lambda x: x, test_data=None):
#     real_fname = field_name.replace('-', '_')
# 
#     def add_srt_arg(parser, **kwargs):
#         parser.add_argument(
#             '--{0}'.format(field_name), default="", type=str,
#             dest=real_fname, required=False, help=help
#         )
# 
#     if test_data is None:
#         def test_data_fun():
#             return field_name, TEST_STR()  # Reuse this test data
#     else:
#         test_data_fun = test_data
# 
#     return add_srt_arg, build_extractor(real_fname, real_fname), test_data_fun
# 
# def datetime_argument(field_name, help):
#     def parse_datetime(date_str):
#         try:
#             datetime.strptime(date_str, '%Y-%m-%dT%M:%H')
#         except ValueError:
#             raise argparse.ArgumentTypeError(
#                 '{0} is not in the format yyyy-mm-ddThh-mm (iso-8601)'.format(
#                     date_str)
#             )
# 
#     def test_data_fun():
#         return field_name, '2013-02-02T11:11'
# 
#     return general_argument(
#         field_name, help, type=parse_datetime, test_data=test_data_fun
#     )
# 
# def date_argument(field_name, help):
#     def parse_date(date_str):
#         try:
#             datetime.strptime(date_str, '%Y-%m-%d')
#         except ValueError:
#             raise argparse.ArgumentTypeError(
#                 '{0} is not in the format yyyy-mm-dd'.format(
#                     date_str)
#             )
# 
#     def test_data_fun():
#         return field_name, '2013-02-02'
# 
#     return general_argument(
#         field_name, help, type=parse_date, test_data=test_data_fun
#     )
# 
# Path: invtool/lib/system_options.py
# def foreign_key_argument(field_name, help):
#     real_fname = field_name.replace('-', '_')
# 
#     def add_srt_arg(parser, **kwargs):
#         parser.add_argument(
#             '--{0}-pk'.format(field_name), default="", type=str,
#             dest=real_fname, required=False, help=help
#         )
# 
#     def test_data():
#         return '', ''
# 
#     return add_srt_arg, build_extractor(real_fname, real_fname), test_data
# 
# def hostname_argument(field_name, help):
#     return general_argument(field_name, help)
# 
# def notes_argument(field_name, help):
#     """
#     Work around for systems calling it 'Notes' and everything else calling it
#     'Description'.
#     """
#     def add_srt_arg(parser, **kwargs):
#         parser.add_argument(
#             '--description', default="", type=str, dest='notes',
#             required=False, help=help
#         )
# 
#     def test_data():
#         return 'description', 'asdfasdf'
# 
#     return add_srt_arg, build_extractor('notes', 'notes'), test_data
# 
# def system_pk_argument(action='updating'):
#     def add_pk_arg(parser, **kwargs):
#         arg_g = parser.add_mutually_exclusive_group(required=True)
#         arg_g.add_argument(
#             '--hostname', type=str, dest='pk',
#             help='The hostname of a system you are {0}'.format(action)
#         )
#         arg_g.add_argument(
#             '--pk', type=str, dest='pk',
#             help='The integer primary key of a system you are '
#             '{0}'.format(action)
#         )
# 
#     def extract_pk(nas):
#         if nas.hostname:
#             return {'pk': nas.hostname}
#         else:
#             return {'pk': nas.pk}
# 
#     return add_pk_arg, build_extractor('hostname', 'hostname'), lambda: None
# 
# def new_hostname_argument():
#     def add_srt_arg(parser, **kwargs):
#         parser.add_argument(
#             '--new-hostname', default="", type=str,
#             dest='hostname', required=False, help='If you are changing the '
#             'hostname of an existing system specify it with --hostname and '
#             'use this option to assign a new hostname'
#         )
# 
#     def test_data():
#         return 'new-hostname', TEST_STR()
# 
#     return add_srt_arg, build_extractor('hostname', 'hostname'), test_data


    import simplejson as json
    import json  # noqa
from invtool.lib.registrar import registrar
from invtool.core_dispatch import CoreDispatch
from invtool.lib.config import API_MAJOR_VERSION
from invtool.lib.options import (
    comment_argument, general_argument,
    datetime_argument, date_argument
)
from invtool.lib.system_options import (
    foreign_key_argument, hostname_argument, notes_argument,
    system_pk_argument, new_hostname_argument
)
try:
except ImportError:





class DispatchSystem(CoreDispatch):
    object_url = "/en-US/core/api/v1_core/{1}/{2}/"
    object_list_url = "/en-US/core/api/v1_core/{1}/"
    resource_name = 'system'
    dtype = 'SYS'
    dgroup = 'core'

    create_args = [

# Path: invtool/lib/registrar.py
# class Registrar():
#     def register(self, dispatch):
# 
# Path: invtool/core_dispatch.py
# class CoreDispatch(ObjectDispatch):
#     object_url = "/en-US/core/api/v1_core/{1}/{2}/"
#     object_list_url = "/en-US/core/api/v1_core/{1}/"
# 
# Path: invtool/lib/config.py
# API_MAJOR_VERSION = 1
# 
# Path: invtool/lib/options.py
# def comment_argument(field_name):
#     def add_com_arg(parser, **kwargs):
#         parser.add_argument(
#             '--comment', default="", type=str,
#             dest='comment', help="Use this to record why a change is "
#             "being made", required=False
#         )
# 
#     def test_data():
#         return 'comment', TEST_DESCRIPTION  # Reuse this test data
# 
#     return add_com_arg, build_extractor(field_name, 'comment'), test_data
# 
# def general_argument(field_name, help, type=lambda x: x, test_data=None):
#     real_fname = field_name.replace('-', '_')
# 
#     def add_srt_arg(parser, **kwargs):
#         parser.add_argument(
#             '--{0}'.format(field_name), default="", type=str,
#             dest=real_fname, required=False, help=help
#         )
# 
#     if test_data is None:
#         def test_data_fun():
#             return field_name, TEST_STR()  # Reuse this test data
#     else:
#         test_data_fun = test_data
# 
#     return add_srt_arg, build_extractor(real_fname, real_fname), test_data_fun
# 
# def datetime_argument(field_name, help):
#     def parse_datetime(date_str):
#         try:
#             datetime.strptime(date_str, '%Y-%m-%dT%M:%H')
#         except ValueError:
#             raise argparse.ArgumentTypeError(
#                 '{0} is not in the format yyyy-mm-ddThh-mm (iso-8601)'.format(
#                     date_str)
#             )
# 
#     def test_data_fun():
#         return field_name, '2013-02-02T11:11'
# 
#     return general_argument(
#         field_name, help, type=parse_datetime, test_data=test_data_fun
#     )
# 
# def date_argument(field_name, help):
#     def parse_date(date_str):
#         try:
#             datetime.strptime(date_str, '%Y-%m-%d')
#         except ValueError:
#             raise argparse.ArgumentTypeError(
#                 '{0} is not in the format yyyy-mm-dd'.format(
#                     date_str)
#             )
# 
#     def test_data_fun():
#         return field_name, '2013-02-02'
# 
#     return general_argument(
#         field_name, help, type=parse_date, test_data=test_data_fun
#     )
# 
# Path: invtool/lib/system_options.py
# def foreign_key_argument(field_name, help):
#     real_fname = field_name.replace('-', '_')
# 
#     def add_srt_arg(parser, **kwargs):
#         parser.add_argument(
#             '--{0}-pk'.format(field_name), default="", type=str,
#             dest=real_fname, required=False, help=help
#         )
# 
#     def test_data():
#         return '', ''
# 
#     return add_srt_arg, build_extractor(real_fname, real_fname), test_data
# 
# def hostname_argument(field_name, help):
#     return general_argument(field_name, help)
# 
# def notes_argument(field_name, help):
#     """
#     Work around for systems calling it 'Notes' and everything else calling it
#     'Description'.
#     """
#     def add_srt_arg(parser, **kwargs):
#         parser.add_argument(
#             '--description', default="", type=str, dest='notes',
#             required=False, help=help
#         )
# 
#     def test_data():
#         return 'description', 'asdfasdf'
# 
#     return add_srt_arg, build_extractor('notes', 'notes'), test_data
# 
# def system_pk_argument(action='updating'):
#     def add_pk_arg(parser, **kwargs):
#         arg_g = parser.add_mutually_exclusive_group(required=True)
#         arg_g.add_argument(
#             '--hostname', type=str, dest='pk',
#             help='The hostname of a system you are {0}'.format(action)
#         )
#         arg_g.add_argument(
#             '--pk', type=str, dest='pk',
#             help='The integer primary key of a system you are '
#             '{0}'.format(action)
#         )
# 
#     def extract_pk(nas):
#         if nas.hostname:
#             return {'pk': nas.hostname}
#         else:
#             return {'pk': nas.pk}
# 
#     return add_pk_arg, build_extractor('hostname', 'hostname'), lambda: None
# 
# def new_hostname_argument():
#     def add_srt_arg(parser, **kwargs):
#         parser.add_argument(
#             '--new-hostname', default="", type=str,
#             dest='hostname', required=False, help='If you are changing the '
#             'hostname of an existing system specify it with --hostname and '
#             'use this option to assign a new hostname'
#         )
# 
#     def test_data():
#         return 'new-hostname', TEST_STR()
# 
#     return add_srt_arg, build_extractor('hostname', 'hostname'), test_data


# Path: invtool/system_dispatch.py
    import simplejson as json
    import json  # noqa
from invtool.lib.registrar import registrar
from invtool.core_dispatch import CoreDispatch
from invtool.lib.config import API_MAJOR_VERSION
from invtool.lib.options import (
    comment_argument, general_argument,
    datetime_argument, date_argument
)
from invtool.lib.system_options import (
    foreign_key_argument, hostname_argument, notes_argument,
    system_pk_argument, new_hostname_argument
)

try:
except ImportError:





class DispatchSystem(CoreDispatch):
    object_url = "/en-US/core/api/v1_core/{1}/{2}/"
    object_list_url = "/en-US/core/api/v1_core/{1}/"
    resource_name = 'system'
    dtype = 'SYS'
    dgroup = 'core'

    create_args = [

        foreign_key_argument(