#!/usr/bin/env python3
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse
import IPython
from adcm_client.objects import ADCMClient
from getpass import getpass


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Create IPython shell with ADCM's SDK")
    parser.add_argument('-a', '--url', required=False, default='http://127.0.0.1:8000')
    parser.add_argument('-u', '--user', required=False, default='admin')
    parser.add_argument('-n', '--noconnect', action='store_true', required=False, default=False)
    # parser.add_argument('--store', action='store_true', required=False, default=False)
    args = parser.parse_args()
    if not args.noconnect:
        password = getpass()
        print(args.url)
        print(args.user)
        client = ADCMClient(url=args.url, user=args.user, password=password)
    IPython.embed()
