if capella_api_response.status_code == 204:
            print("Cluster user is deleted")
        else:
            print("Failed to delete user")
            print("Capella API returned " +
                  str(capella_api_response.status_code))
            print("Full error message")
            print(capella_api_response.json()["message"])
    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(description='Deletes a user from a cluster')
    my_parser.ExampleCmdline = " -cid d157a069-9451-4188-a4b1-8be2920db094 -un myuser "

    # Add the arguments

    my_parser.add_argument('-cid',
                           '--clusterID',
                           dest="clusterID",
                           metavar="",
                           action='store',
                           required=True,
                           type=check_if_valid_uuid,
                           help='The ID of the cluster')

    my_parser.add_argument('-un',
                           '--UserName',
            else:
                print("Failed to change the cluster configuration ")
                print("Capella API returned " +
                      str(capella_api_response.status_code))
                print("Full error message")
                print(capella_api_response.json()["message"])

    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description=
        "Scales the cluster to run each service on it's own set of 3 nodes with 300Gb storage on each "
    )
    my_parser.ExampleCmdline = """-cid "1478c0f4-07b2-4818-a5e8-d15703ef79b0" """

    # Add the arguments

    my_parser.add_argument('-cid',
                           '--ClusterID',
                           action='store',
                           required=True,
                           type=str,
                           help='ID of the cluster')

    my_parser.add_argument("-d",
                           "--debug",
                           default=False,
Beispiel #3
0
        cmd_line_args.cluster_id, bucket_configuration)

    # Check response code , 201 is success
    if capella_api_response.status_code == 201:
        print("Creating bucket ")
    else:
        print("Failed to create bucket ")
        print("Capella API returned " + str(capella_api_response.status_code))
        print("Full error message")
        print(capella_api_response.json()["message"])


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(description='Creates a bucket for a cluster using '
                         'Couchbases own cloud in Couchbase Capella')
    my_parser.ExampleCmdline = "-cid d157a069-9451-4188-a4b1-8be2920db094 -n mynewbucket -r 0 -m 250 "

    # Add the arguments

    my_parser.add_argument('-cid',
                           '--clusterID',
                           dest="cluster_id",
                           action='store',
                           required=True,
                           type=check_if_valid_uuid,
                           help='The ID of the cluster')

    my_parser.add_argument('-n',
                           '--Name',
                           dest="name",
Beispiel #4
0
                print("Unable to find " + CmdLineArgs.bucketName +
                      " to update on this cluster")

        else:
            print("This cluster cannot be found")
            print("Full error message")
            print(capella_api_response.json()["message"])
    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description=
        'Updates the memory quota bucket for a cluster running in your cloud')
    my_parser.ExampleCmdline = """-cid "d157a069-9451-4188-a4b1-8be2920db094" -m 250 -n "my-new-bucket" """

    # Add the arguments

    my_parser.add_argument('-cid',
                           '--ClusterID',
                           dest="ClusterID",
                           metavar="",
                           action='store',
                           required=True,
                           type=check_if_valid_uuid,
                           help='The ID of the cluster')

    my_parser.add_argument('-n',
    # Check response code , 201 is success
    if capella_api_response.status_code == 202:
        print("Creating cluster ")
        print("Check deployment status here: " + cappella_api.API_BASE_URL +
              capella_api_response.headers['Location'] + '/status')
    else:
        print("Failed to create cluster ")
        print("Capella API returned " + str(capella_api_response.status_code))
        print("Full error message")
        print(capella_api_response.json()["message"])


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(description='Creates a cluster using customers own cloud in Couchbase Capella')
    my_parser.ExampleCmdline = """-cn "ANewCluster" -cid "070a3be4-5246-40e3-9b57-5a51a2663d20" -pid "1478c0f4-07b2-4818-a5e8-d15703ef79b0" """

    # Add the arguments
    my_parser.add_argument('-cn', '--clusterName',
                           action='store',
                           required=True,
                           type=str,
                           help='The name to use for the cluster')

    my_parser.add_argument('-cld', '--cloudID',
                           action='store',
                           required=True,
                           metavar="",
                           type=check_if_valid_uuid,
                           help='ID of the cloud to use with the cluster')
Beispiel #6
0
            print("Cluster user is being created")
        else:
            print("Failed to create user")
            print("Capella API returned " +
                  str(capella_api_response.status_code))
            print("Full error message")
            print(capella_api_response.json()["message"])
    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description=
        'Creates a user for a cluster and grants them access to one or more buckets'
    )
    my_parser.ExampleCmdline = """-cid d157a069-9451-4188-a4b1-8be2920db094 -un myuser -pwd Password123! -b 
    "bucket1:*:rw,bucket2:MyScope:rw" """

    # Add the arguments
    my_parser.add_argument("-cid",
                           "--ClusterID",
                           dest="cluster_id",
                           action='store',
                           required=True,
                           metavar="",
                           type=check_if_valid_uuid,
                           help="The ID of the cluster ")

    my_parser.add_argument('-un',
            # Display the table, which uses pretty table to make things easier
            print('Capella Clusters ')
            print(pretty_table(cluster_table_heading, clusters_table_rows))

    else:
        print("Failed to get list of clusters ")
        print("Capella API returned " + str(capella_api_response.status_code))
        print("Full error message")
        print(capella_api_response.json()["message"])


if __name__ == '__main__':
    # Process command line args
    # Create the parser

    my_parser = MyParser(
        description='List clusters managed by Couchbase Capella')
    my_parser.ExampleCmdline = """With debug on -d \nWith debug off """

    # Add the arguments
    my_parser.add_argument("-d",
                           "--debug",
                           default=False,
                           action="store_true",
                           help="Turn on logging at debug level")

    args = my_parser.parse_args()

    main(args)
        # Did the delete work?
        if capella_api_response.status_code == 204:
            print("Deleting allowlist ")
        else:
            print("Failed to delete allowlist ")
            print("Capella API returned " +
                  str(capella_api_response.status_code))
            print("Full error message")
            print(capella_api_response.json()['message'])


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description='Deletes an allowlist from a cluster running in your cloud'
    )
    my_parser.ExampleCmdline = "-cid d157a069-9451-4188-a4b1-8be2920db094 -cb 10.0.0.1"

    # Add the arguments

    my_parser.add_argument('-cid',
                           '--clusterID',
                           dest="clusterID",
                           metavar="",
                           action='store',
                           required=True,
                           type=check_if_valid_uuid,
                           help='The ID of the cluster')

    my_parser.add_argument('-cb',
        else:
            print("Failed to get projects ")
            print("Capella API returned " +
                  str(capella_api_response.status_code))
            print("Full error message")
            print(capella_api_response.json()["message"])

    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser

    my_parser = MyParser(
        description='List projects defined in Couchbase Capella')
    my_parser.ExampleCmdline = "With debug on -d \nWith debug off "

    # Add the arguments
    my_parser.add_argument("-d",
                           "--debug",
                           default=False,
                           action="store_true",
                           help="Turn on logging at debug level")

    args = my_parser.parse_args()

    main(args)
Beispiel #10
0
            print("Got information for cluster ID " + cmd_line_args.ClusterID)
            print(json.dumps(capella_api_response.json(), indent=3))
        else:
            print("Failed to get information for cluster ID " +
                  cmd_line_args.ClusterID)
            print("Capella API returned " +
                  str(capella_api_response.status_code))

    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description='Get information for a cluster running in your cloud')
    my_parser.ExampleCmdline = "-cid 1478c0f4-07b2-4818-a5e8-d15703ef79b0"

    # Add the arguments
    my_parser.add_argument("-cid",
                           "--ClusterID",
                           dest="ClusterID",
                           action='store',
                           required=True,
                           metavar="",
                           type=check_if_valid_uuid,
                           help="The ID of the cluster ")

    my_parser.add_argument("-d",
                           "--debug",
                           default=False,
        # Did the delete work?
        if capella_api_response.status_code == 202:
            print("Deleting bucket ")
        else:
            print("Failed to delete bucket ")
            print("Capella API returned " +
                  str(capella_api_response.status_code))
            print("Full error message")
            print(capella_api_response.json()["message"])


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description='Deletes a bucket from a cluster running in your cloud')
    my_parser.ExampleCmdline = "-cid d157a069-9451-4188-a4b1-8be2920db094 -n my-bucket"

    # Add the arguments

    my_parser.add_argument('-cid',
                           '--clusterID',
                           action='store',
                           dest="clusterID",
                           metavar="",
                           required=True,
                           type=check_if_valid_uuid,
                           help='The ID of the cluster')

    my_parser.add_argument('-n',
                           '--Name',
Beispiel #12
0
    if capella_api_response.status_code == 202:
        print("Creating cluster ")
        print("Check deployment status here: " + cappella_api.API_BASE_URL +
              capella_api_response.headers['Location'] + '/status')
    else:
        print("Failed to create cluster ")
        print("Capella API returned " + str(capella_api_response.status_code))
        print("Full error message")
        print(capella_api_response.json()["message"])


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(description='Creates a 3 node cluster using Couchbase managed cloud in Couchbase Capella\n '
                                     'with data, index, search, and query services and 50Gb of storage\n in aws '
                                     'us-east-2')
    my_parser.ExampleCmdline = "-cn aNewCluster -pid 1478c0f4-07b2-4818-a5e8-d15703ef79b0 "

    # Add the arguments

    my_parser.add_argument('-cn', '--clusterName',
                           action='store',
                           required=True,
                           type=str,
                           help='The name to use for the cluster')

    my_parser.add_argument('-pid', '--projectID',
                           action='store',
                           required=True,
                           type=check_if_valid_uuid,
        else:
            print("Failed to get clouds ")
            print("Capella API returned " +
                  str(capella_api_response.status_code))
            print("Full error message")
            print(capella_api_response.json()["message"])

    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser

    my_parser = MyParser(
        description='List clouds defined in Couchbase Capella')
    my_parser.ExampleCmdline = """With debug on -d \nWith debug off """

    # Add the arguments
    my_parser.add_argument("-d",
                           "--debug",
                           default=False,
                           action="store_true",
                           help="Turn on logging at debug level")

    args = my_parser.parse_args()

    main(args)
Beispiel #14
0
                print("No buckets found")

        else:
            print("Failed to get buckets ")
            print("Capella API returned " + str(capella_api_response.status_code))
            print("Full error message")
            print(capella_api_response.json()["message"])

    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(description='Get buckets for a cluster running in your cloud')
    my_parser.ExampleCmdline = """-cid "1478c0f4-07b2-4818-a5e8-d15703ef79b0" """

    # Add the arguments
    my_parser.add_argument("-cid", "--ClusterID",
                           dest="ClusterID",
                           action='store',
                           required=True,
                           metavar="",
                           type=check_if_valid_uuid,
                           help="The ID of the cluster ")

    my_parser.add_argument("-d", "--debug",
                           default=False,
                           action="store_true",
                           help="Turn on logging at debug level")
Beispiel #15
0
    if capella_api_response.status_code == 202:
        print("Deleting cluster ")
        print("Check status here: " + cappella_api.API_BASE_URL +
              capella_api_response.headers['Location'] + '/status')
    else:
        print("Failed to delete cluster ")
        print("Capella API returned " + str(capella_api_response.status_code))
        print("Full error message")
        print(capella_api_response.json()["message"])


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description=
        'Deletes a cluster running in your cloud from Couchbase Capella')
    my_parser.ExampleCmdline = """-cid 1478c0f4-07b2-4818-a5e8-d15703ef79b0 """

    # Add the arguments
    my_parser.add_argument('-cid',
                           '--clusterID',
                           dest="clusterID",
                           metavar="",
                           action='store',
                           required=True,
                           type=check_if_valid_uuid,
                           help='The ID of the cluster')

    my_parser.add_argument("-d",
                           "--debug",
    if capella_api_response.status_code == 202:
        print("Deleting cluster ")
        print("Check status here: " + cappella_api.API_BASE_URL +
              capella_api_response.headers['Location'] + '/status')
    else:
        print("Failed to delete cluster ")
        print("Capella API returned " + str(capella_api_response.status_code))
        print("Full error message")
        print(capella_api_response.json()["message"])


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description='Deletes a cluster, in a cloud managed by Couchbase, '
        'from Couchbase Capella')
    my_parser.ExampleCmdline = "-cid 1478c0f4-07b2-4818-a5e8-d15703ef79b0 "

    # Add the arguments
    my_parser.add_argument('-cid',
                           '--clusterID',
                           dest="clusterID",
                           metavar="",
                           action='store',
                           required=True,
                           type=check_if_valid_uuid,
                           help='The ID of the cluster')

    my_parser.add_argument("-d",
                           "--debug",
                    print(pretty_table(table_header, table_rows))

        else:
            print("Failed to get health for cluster ID " + cmd_line_args.ClusterID)
            print("Capella API returned " + str(capella_api_response.status_code))
            print("Full error message")
            print(capella_api_response.json()["message"])

    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(description='Get the health of a cluster running in your cloud')
    my_parser.ExampleCmdline = "-cid 1478c0f4-07b2-4818-a5e8-d15703ef79b0"

    # Add the arguments
    my_parser.add_argument("-cid", "--ClusterID",
                           dest="ClusterID",
                           action='store',
                           required=True,
                           metavar="",
                           type=check_if_valid_uuid,
                           help="The ID of the cluster ")

    my_parser.add_argument("-d", "--debug",
                           default=False,
                           action="store_true",
                           help="Turn on logging at debug level")
        else:
            print("Failed to delete project with ID " +
                  cmd_line_args.projectID)
            print("Capella API returned " +
                  str(capella_api_response.status_code))
            print("Full error message")
            print(capella_api_response.json()["message"])

    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description='Deletes a project from Couchbase Capella')
    my_parser.ExampleCmdline = '-pid e50323f2-2c1c-4506-8234-504d5332f400 \n ' \
                               'With debug  -pid e50323f2-2c1c-4506-8234-504d5332f400 -d'

    # Add the arguments

    my_parser.add_argument(
        '-pid',
        '--projectID',
        dest="projectID",
        metavar="",
        action='store',
        required=True,
        type=check_if_valid_uuid,
        help='ID of the project to delete.  Must be a valid unique identifier.'
    )
def allow_list_rule_type(rule_type):
    if rule_type.lower() == 'temporary':
        return (rule_type.lower())
    elif rule_type.lower() == 'permanent':
        return (rule_type.lower())
    else:
        raise AllowlistRuleError(
            rule_type + " is not a permitted option for allow list rule type")


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description=
        'Creates an allow list entry for a cluster running in your cloud')
    my_parser.ExampleCmdline = "-cid 1478c0f4-07b2-4818-a5e8-d15703ef79b0 -cb 10.0.0.1 " \
                               "-rt \"temporary\" -dt 1 -ct \"1 hour access\"  "

    # Add the arguments
    my_parser.add_argument("-cid",
                           "--ClusterID",
                           dest="ClusterID",
                           action='store',
                           required=True,
                           metavar="",
                           type=check_if_valid_uuid,
                           help="The ID of the cluster ")

    my_parser.add_argument(
Beispiel #20
0
                if not allow_list_entry_found:
                    print("Unable to find " + CmdLineArgs.Name +
                          " for this cluster")
        else:
            print("Failed to find cluster for the allow list ")
            print("Capella API returned " +
                  str(cluster_allowlist_from_API.status_code))
            print("Full error message")
            print(cluster_allowlist_from_API.json()["message"])


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description='Updates the comment for an allow list entry')
    my_parser.ExampleCmdline = """Change comment of an allow list entry with a cidr of 10.2.1.0\n-cid d157a069-9451-4188-a4b1-8be2920db094 -cidr 10.2.1.0 -ct "New comment" """

    # Add the arguments

    my_parser.add_argument("-cid",
                           "--ClusterID",
                           dest="ClusterID",
                           action='store',
                           required=True,
                           metavar="",
                           type=check_if_valid_uuid,
                           help="The ID of the cluster ")

    my_parser.add_argument(
        '-cb',
Beispiel #21
0
        else:
            print("Failed to get allowlist ")
            print("Capella API returned " +
                  str(capella_api_response.status_code))
            print("Full error message")
            print(capella_api_response.json()["message"])

    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description='Gets the allow list for a cluster running in your cloud')
    my_parser.ExampleCmdline = "-cid 1478c0f4-07b2-4818-a5e8-d15703ef79b0"

    # Add the arguments
    my_parser.add_argument('-cid',
                           '--ClusterID',
                           action='store',
                           required=True,
                           metavar="",
                           type=check_if_valid_uuid,
                           help="The ID of the cluster ")

    my_parser.add_argument("-d",
                           "--debug",
                           default=False,
                           action="store_true",
        else:
            print("Failed to get status for cluster ID " +
                  cmd_line_args.ClusterID)
            print("Capella API returned " +
                  str(capella_api_response.status_code))
            print("Full error message")
            print(capella_api_response.json()["message"])

    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description='Get the status of a cluster running in your cloud')
    my_parser.ExampleCmdline = "-cid 1478c0f4-07b2-4818-a5e8-d15703ef79b0"

    # Add the arguments

    my_parser.add_argument("-cid",
                           "--ClusterID",
                           dest="ClusterID",
                           action='store',
                           required=True,
                           metavar="",
                           type=check_if_valid_uuid,
                           help="The ID of the cluster ")

    my_parser.add_argument("-d",
                           "--debug",
                  " with ID of " + capella_api_response.json()['id'])
        else:
            print("Failed to create project " + cmd_line_args.project)
            print("Capella API returned " +
                  str(capella_api_response.status_code))
            print("Full error message")
            print(capella_api_response.json()["message"])

    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(description='create a project in Couchbase Capella')
    my_parser.ExampleCmdline = """Create new project:  -n "My new project"\n
    With debug on -p "My new project" -d """

    # Add the arguments

    my_parser.add_argument('-pn',
                           '--projectName',
                           dest='projectName',
                           action='store',
                           required=True,
                           type=str,
                           metavar="",
                           help='Name of the project to create')

    my_parser.add_argument("-d",
            print("Failed to get certificate for cluster ID " +
                  cmd_line_args.ClusterID)
            print("Capella API returned " +
                  str(capella_api_response.status_code))
            print("Full error message")
            print(capella_api_response.json()["message"])
    else:
        print("Check Capella API is up.")


if __name__ == '__main__':
    # Process command line args
    # Create the parser

    my_parser = MyParser(
        description=
        'Gets information for a cluster running in Couchbase own cloud')
    my_parser.ExampleCmdline = "With debug on  -cid e50323f2-2c1c-4506-8234-504d5332f400 -d \n" \
                               "With debug off  -cid e50323f2-2c1c-4506-8234-504d5332f400"

    # Add the arguments

    my_parser.add_argument("-cid",
                           "--ClusterID",
                           dest="ClusterID",
                           action='store',
                           required=True,
                           metavar="",
                           type=check_if_valid_uuid,
                           help="The ID of the cluster ")
            else:
                print("No users found for this cluster")
        else:
            print("No users found for this cluster")
    else:
        print("Failed to get list of users for this cluster ")
        print("Capella API returned " + str(capella_api_response.status_code))
        print("Full error message")
        print(capella_api_response.json()["message"])


if __name__ == '__main__':
    # Process command line args
    # Create the parser
    my_parser = MyParser(
        description='Get list of users for a cluster running in your cloud')
    my_parser.ExampleCmdline = "-cid 1478c0f4-07b2-4818-a5e8-d15703ef79b0"

    # Add the arguments
    my_parser.add_argument("-cid",
                           "--ClusterID",
                           dest="ClusterID",
                           action='store',
                           required=True,
                           metavar="",
                           type=check_if_valid_uuid,
                           help="The ID of the cluster ")

    my_parser.add_argument("-d",
                           "--debug",
                           default=False,