Пример #1
0
def main():

    # Login to the cluster
    args = get_cmdl_args()
    host_ip = os.getenv('HOST_IP')
    mgmt_auth_token = get_mgnt_token()
    cohesity_client = CohesityClient(cluster_vip=host_ip,
                                     auth_token=mgmt_auth_token)

    view_name = args.view_name
    clone_name = args.clone_name

    if args.clone_name is None:
        clone_name = ''.join(random.choice(
            string.ascii_letters + string.digits) for _ in range(5)) + \
                     '_cloned_view_' + args.view_name

    # Clone a view with name.
    try:
        cloneview = CloneView(cohesity_client)
        cloneview.clone_existing_view(view_name, clone_name)

        # Update the cloned view.
        cloneview.update_view(view_name=clone_name,
                              protocol_access=ProtocolAccessEnum.KNFSONLY,
                              description="View to restrict access"
                              " to s3 only.")
    except APIException as e:
        print("Error : %s" % e.context.response.raw_body)
Пример #2
0
def main(args):

    cohesity_client = CohesityClient(cluster_vip=CLUSTER_VIP,
                                     username=CLUSTER_USERNAME,
                                     password=CLUSTER_PASSWORD,
                                     domain=DOMAIN)
    view_name = args.view_name
    clone_name = args.clone_name

    if args.clone_name is None:
        clone_name = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(5))+ \
                     '_cloned_view_' + args.view_name

    # Clone a view with name.
    try:
        cloneview = CloneView(cohesity_client)
        cloneview.clone_existing_view(view_name, clone_name)

        # Update the cloned view.
        cloneview.update_view(
            view_name=clone_name,
            protocol_access=ProtocolAccessEnum.KNFSONLY,
            description="View to restrict access to s3 only.")
    except APIException as e:
        print("Error : %s" % e.context.response.raw_body)
Пример #3
0
def main():
    cohesity_client = CohesityClient(cluster_vip=CLUSTER_VIP,
                                     username=CLUSTER_USERNAME,
                                     password=CLUSTER_PASSWORD,
                                     domain=DOMAIN)
    vcenter_object = AddVCenter(cohesity_client)
    vcenter_object.register_vcenter()
def main(args):
    cohesity_client = CohesityClient(cluster_vip=CLUSTER_VIP,
                                     username=CLUSTER_USERNAME,
                                     password=CLUSTER_PASSWORD,
                                     domain=DOMAIN)
    pj = ProtectionJobs(cohesity_client)
    pj.run_job(args.job_name)
def main():

    cohesity_client = CohesityClient(cluster_vip=CLUSTER_VIP,
                                     username=CLUSTER_USERNAME,
                                     password=CLUSTER_PASSWORD,
				                     domain=DOMAIN)
    protect_object = ProtectionJobsList()
    protect_object.display_protection_jobs(cohesity_client)
Пример #6
0
def main(args):

    # Login to the cluster
    host_ip = os.getenv('HOST_IP')
    mgmt_auth_token = get_mgmt_token()
    cohesity_client = CohesityClient(cluster_vip=host_ip,
                                     auth_token=mgmt_auth_token)

    alerts = Alerts()
    alerts.display_alerts(cohesity_client, args.max_alerts)
Пример #7
0
def main():
    # Login to the cluster
    args = get_cmdl_args()
    if args.cluster_vip is not None and args.user is not None and \
    args.password is not None:
        cohesity_client = CohesityClient(cluster_vip=args.cluster_vip,
                                         username=args.user,
                                         password=args.password)
    elif args.cluster_vip is not None or args.user is not None or \
    args.password is not None:
        print("Please provide all inputs ie. cluster_vip, user & password")
        exit()
    else:
        host_ip = os.getenv('HOST_IP')
        mgmt_auth_token = get_mgnt_token()
        cohesity_client = CohesityClient(cluster_vip=host_ip,
                                         auth_token=mgmt_auth_token)

    vcenter_object = AddVCenter(cohesity_client)
    vcenter_object.register_vcenter()
Пример #8
0
def main():
    # Login to the cluster
    args = get_cmdl_args()
    if args.cluster_vip is not None and args.user is not None and \
    args.password is not None:
        cohesity_client = CohesityClient(cluster_vip=args.cluster_vip,
                                         username=args.user,
                                         password=args.password)
    elif args.cluster_vip is not None or args.user is not None or \
    args.password is not None:
        print("Please provide all inputs ie. cluster_vip, user & password")
        exit()
    else:
        host_ip = os.getenv('HOST_IP')
        mgmt_auth_token = get_mgnt_token()
        cohesity_client = CohesityClient(cluster_vip=host_ip,
                                         auth_token=mgmt_auth_token)

    pj = ProtectionJobs(cohesity_client)
    pj.run_job(args.job_name)
def init_client(username, password, domain):
    """
    Method to initialize the cohesity client.
    :param username(str): Username of Cohesity cluster user.
    :param password(str): Password of Cohesity cluster user.
    :return None:
    """
    return CohesityClient(cluster_vip=CLUSTER_VIP,
                          username=username,
                          password=password,
			  domain=domain)
def main():

    # Login to the cluster
    args = get_cmdl_args()
    if args.cluster_vip is not None and args.user is not None and \
    args.password is not None:
        cohesity_client = CohesityClient(cluster_vip=args.cluster_vip,
                                         username=args.user,
                                         password=args.password)
    elif args.cluster_vip is not None or args.user is not None or \
    args.password is not None:
        print("Please provide all inputs ie. cluster_vip, user & password")
        exit()
    else:
        host_ip = os.getenv('HOST_IP')
        mgmt_auth_token = get_mgnt_token()
        cohesity_client = CohesityClient(cluster_vip=host_ip,
                                         auth_token=mgmt_auth_token)

    alerts = Alerts()
    alerts.display_alerts(cohesity_client, args.max_alerts)
def get_cohesity_client(module):
    '''
    function to get cohesity cohesity client
    :param module: object that holds parameters passed to the module
    :return:
    '''
    try:
        cluster_vip = module.params.get('cluster')
        username = module.params.get('username')
        password = module.params.get('password')
        domain = 'LOCAL'
        if '@' in username:
            user_domain = username.split('@')
            username = user_domain[0]
            domain = user_domain[1]

        cohesity_client = CohesityClient(cluster_vip=cluster_vip,
                                         username=username,
                                         password=password,
                                         domain=domain)
        return cohesity_client
    except Exception as error:
        raise__cohesity_exception__handler(error, module)