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',
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",
# 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')
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',
# 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 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.' )
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,
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,
def bucket_access_type(bucket_access_list): # We should have a string like this r or w # nothing else is allowed if bucket_access_list == 'r': return (bucket_access_list) elif bucket_access_list == 'w': return (bucket_access_list) else: raise UserBucketAccessListError(bucket_access_list + " is not valid access permission. must be r or w.") 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 all buckets') my_parser.ExampleCmdline = "-cid d157a069-9451-4188-a4b1-8be2920db094 -un myuser -pwd Password123! -a w" # 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('-un', '--UserName', dest="UserName", action='store',
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',
" 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",
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(
# 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)
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",
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("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 ")
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',