Example #1
0
def main(cmd_line_args):
    cappella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    # Check Capella API status
    if cappella_api.api_status().status_code == 200:
        capella_api_response = cappella_api.get_cluster_info(
            False, cmd_line_args.ClusterID)
        if capella_api_response.status_code == 200:
            # Cluster information was found
            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.")
Example #2
0
def main(cmd_line_args):
    cappella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    # Check Capella API status
    if cappella_api.api_status().status_code == 200:
        capella_api_response = cappella_api.get_cluster_status(True, cmd_line_args.ClusterID)

        if capella_api_response.status_code == 200:
            # Cluster information was found
            print(
                "Status for cluster with ID " + cmd_line_args.ClusterID + " is " +
                capella_api_response.json()['status'])
        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.")
def main(cmd_line_args):
    cappella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    # Check Capella API status
    if cappella_api.api_status().status_code == 200:
        capella_api_response = cappella_api.delete_project(
            cmd_line_args.projectID)
        if capella_api_response.status_code == 204:
            # Our project was created
            print("Deleted project with ID " + cmd_line_args.projectID)
        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.")
def main(cmd_line_args):
    cappella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    # Check Capella API status
    if cappella_api.api_status().status_code == 200:
        capella_api_response = cappella_api.get_cluster_certificate(
            False, cmd_line_args.ClusterID)

        if capella_api_response.status_code == 200:
            # Cluster certificate was found
            print("Cluster certificate:\n" +
                  capella_api_response.json()['certificate'])
        else:
            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.")
def main(CmdLineArgs):

    # This represents the new server service configuration
    new_server_service_configuration = {
        "servers": [{
            "compute": "m5.xlarge",
            "size": 3,
            "services": ["data"],
            "storage": {
                "size": 300,
                "IOPS": 3000,
                "type": "GP3"
            }
        }]
    }

    cappella_api = CapellaAPI()

    if CmdLineArgs.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    # Check API is up
    if cappella_api.api_status().status_code == 200:

        # Show the current cluster configuration
        # first we'll need to get the configuration
        capella_api_response = cappella_api.get_cluster_info(
            True, CmdLineArgs.ClusterID)

        #Then pass the bit we're interested in to the function that will display it
        if capella_api_response.status_code == 200:
            print('Current cluster configuration')
            show_cluster_server_configuration(
                capella_api_response.json()['servers'])

            # Now we will tell the API to change the configuration
            capella_api_response = cappella_api.update_cluster_servers(
                CmdLineArgs.ClusterID, new_server_service_configuration)

            # Check response code , 201 is success
            if capella_api_response.status_code == 202:
                # Got a response back
                print("Changing cluster to ")
                show_cluster_server_configuration(
                    new_server_service_configuration['servers'])

            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.")
Example #6
0
def main(CmdLineArgs):
    cappella_api = CapellaAPI()

    if CmdLineArgs.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    # Check the status of the API, response code = 200 is success
    if cappella_api.api_status().status_code == 200:
        # Work out the bucket ID
        # which is the base64 value of the bucket name
        bucketName_bytes = CmdLineArgs.bucketName.encode('ascii')
        base64_bytes = base64.b64encode(bucketName_bytes)
        bucketName_base64 = base64_bytes.decode('ascii')

        # Get the current cluster buckets
        capella_api_response = cappella_api.get_cluster_buckets(
            CmdLineArgs.ClusterID)

        # We got the buckets, now check that we have the one we want to update
        if capella_api_response.status_code == 200:
            cluster_buckets = capella_api_response.json()
            found_bucket = False
            for cluster_bucket in cluster_buckets:
                if cluster_bucket['name'] == CmdLineArgs.bucketName:
                    cluster_bucket['memoryQuota'] = CmdLineArgs.MemoryQuota
                    found_bucket = True
                    # Now update the bucket
                    capella_api_response = cappella_api.update_cluster_bucket(
                        CmdLineArgs.ClusterID, bucketName_base64,
                        cluster_bucket)

                    # Did the update work?
                    if capella_api_response.status_code == 202:
                        print("Bucket memory quota is being updated ")
                    else:
                        print("Failed to update bucket ")
                        print("Capella API returned " +
                              str(capella_api_response.status_code))
                        print("Full error message")
                        print(capella_api_response.json()["message"])
            if not found_bucket:
                # We didn't find the bucket to update
                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.")
def main(cmd_line_args):
    cappella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    cluster_allowlist_configuration = {
        "cidrBlock": cmd_line_args.CidrBlock,
        "ruleType": cmd_line_args.RuleType.lower(),
    }

    if cmd_line_args.RuleType.lower() == 'temporary':
        cluster_allowlist_configuration["duration"] = str(
            cmd_line_args.Duration) + "h0m0s"

    if cmd_line_args.RuleType.lower() == 'permanent':
        # If rule is permanent , Duration should not be given
        # Will look into seeing if arg parser can deal with this
        # For now, the check is here
        if cmd_line_args.Duration is not None:
            raise AllowlistRuleError(
                "Duration is not a permitted option for allow list when type is permanent"
            )

    if cmd_line_args.Comment is not None:
        cluster_allowlist_configuration["comment"] = cmd_line_args.Comment

    # Check Capella API status
    if cappella_api.api_status().status_code == 200:
        capella_api_response = cappella_api.create_cluster_allowlist(
            cmd_line_args.ClusterID, cluster_allowlist_configuration)

        if capella_api_response.status_code == 202:
            print("Allow list is being created")
        else:
            print("Failed to create 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.")
Example #8
0
def main(cmd_line_args):
    cappella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    # Check Capella API status
    if cappella_api.api_status().status_code == 200:
        capella_api_response = cappella_api.get_cluster_buckets(cmd_line_args.ClusterID)

        # Check response code , 200 is success
        if capella_api_response.status_code == 200:
            bucket_table_rows = []
            list_of_buckets = capella_api_response.json()

            # We should have a list of buckets, but just in case, check
            # Then we will build rows to show in a table
            if list_of_buckets is not None:
                # Check to see if we got any buckets back
                if len(list_of_buckets) > 0:
                    for bucket in list_of_buckets:
                        bucket_table_rows.append(bucket.values())

                    print('Buckets')
                    print(pretty_table(list_of_buckets[0].keys(), bucket_table_rows))
                else:
                    print("No buckets found")
            else:
                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.")
def main(cmd_line_args):
    cappella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    # Check Capella API status
    if cappella_api.api_status().status_code == 200:
        capella_api_response = cappella_api.get_projects()

        # Check response code , 200 is success
        if capella_api_response.status_code == 200:
            project_table_rows = []
            list_of_projects = capella_api_response.json()

            for project in list_of_projects['data']:
                project_table_rows.append([
                    project['name'],
                    maya.parse(project['createdAt']), project['id']
                ])

            # Table heading / rows for the output
            project_table_headings = ['Name', 'Created at', 'ID']

            print('Projects')
            print(pretty_table(project_table_headings, project_table_rows))

        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.")
Example #10
0
def main(cmd_line_args):
    capella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        capella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    cluster_user_struct = {
        "password": cmd_line_args.Password,
        "username": cmd_line_args.UserName,
    }

    # Split up into the individual bits we need
    all_bucket_access = cmd_line_args.Access.strip()

    # Look at the access requested and then map to what the endpoint expects
    if all_bucket_access == 'r':
        cluster_user_struct['allBucketsAccess']="data_reader"
    elif all_bucket_access == 'w':
        cluster_user_struct['allBucketsAccess']="data_writer"
    else:
        raise UserBucketAccessListError('access not found')

    # Check Capella API status
    if capella_api.api_status().status_code == 200:
        capella_api_response = capella_api.create_cluster_user(False, cmd_line_args.ClusterID, cluster_user_struct)

        if capella_api_response.status_code == 201:
            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.")
def main(cmd_line_args):
    cappella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    # Check Capella API status
    if cappella_api.api_status().status_code == 200:
        capella_api_response = cappella_api.get_clouds()

        # Check response code , 200 is success
        if capella_api_response.status_code == 200:
            cloud_table_rows = []
            list_of_clouds = capella_api_response.json()

            for cloud in list_of_clouds['data']:
                cloud_table_rows.append(cloud.values())

            # Table heading / rows for the output
            # The JSON keys are always the same across all clouds so we can use the
            # keys from the first entry that we got
            cloud_table_headings = list_of_clouds['data'][0].keys()

            print('Projects')
            print(pretty_table(cloud_table_headings, cloud_table_rows))

        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.")
def main(cmd_line_args):
    cappella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    bucket_configuration = {"cidrBlock": cmd_line_args.cidrBlock}

    if cappella_api.api_status().status_code == 200:
        capella_api_response = cappella_api.delete_cluster_allowlist(
            cmd_line_args.clusterID, bucket_configuration)

        # 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'])
def main(cmd_line_args):
    capella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        capella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    # Check Capella API status
    if capella_api.api_status().status_code == 200:
        capella_api_response = capella_api.delete_cluster_user(
            False, cmd_line_args.clusterID, cmd_line_args.UserName)

        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.")
Example #14
0
def main(cmd_line_args):
    capella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        capella_api.set_logging_level('DEBUG')
    else:
        capella_logging('INFO')

    cluster_user_struct = {
        "password": cmd_line_args.password,
        "username": cmd_line_args.user_name,
        "buckets": []
    }

    # Go through each entry
    for bucket_and_scope_entry in cmd_line_args.buckets_and_scope.split(','):

        cluster_user_bucket_and_scope_access = {
            "name": "",
            "scope": "",
            "access": ""
        }

        # Split up into the individual bits we need
        bucket_and_scope_entry = bucket_and_scope_entry.strip()
        bucket_access = bucket_and_scope_entry.split(':')[2]
        bucket_scope = bucket_and_scope_entry.split(':')[1]
        bucket_name = bucket_and_scope_entry.split(':')[0]

        # Set the name of the bucket we're going to grant access to
        cluster_user_bucket_and_scope_access['name'] = bucket_name

        # Set the scope
        cluster_user_bucket_and_scope_access['scope'] = bucket_scope

        # Look at the access requested and then map to what the endpoint expects
        if bucket_access == 'r':
            cluster_user_bucket_and_scope_access["access"] = "data_reader"
        elif bucket_access == 'w':
            cluster_user_bucket_and_scope_access["access"] = "data_writer"
        elif bucket_access == 'rw':
            cluster_user_bucket_and_scope_access["access"] = "data_writer"
        elif bucket_access == 'wr':
            cluster_user_bucket_and_scope_access["access"] = "data_writer"
        else:
            # This should never have passed the regex test done in check_bucket_and_scope_type
            # but just in case....
            print('access not found for ' + bucket_and_scope_entry)
            raise UserBucketAccessListError('access not found for ' +
                                            bucket_and_scope_entry)

        cluster_user_struct["buckets"].append(
            cluster_user_bucket_and_scope_access)

    # Check Capella API status
    if capella_api.api_status().status_code == 200:
        capella_api_response = capella_api.create_cluster_user(
            True, cmd_line_args.cluster_id, cluster_user_struct)

        if capella_api_response.status_code == 201:
            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.")
Example #15
0
def main(CmdLineArgs):
    cappella_api = CapellaAPI()

    if CmdLineArgs.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    # Caution :  The endpoint treats the allow list as a single resource
    #            This means the new, updated, configuration will replace what is already there
    #            We will get the current allow list, alter the allow list entry that we're changing
    #            and then send everything back.  The change just being the comment key : value
    #            If we didn't do this, we'd end up with a cluster with just the allow list entry we're updating...

    # Step 1 - get the allow list with all of its entries
    if cappella_api.api_status().status_code == 200:
        cluster_allowlist_from_API = cappella_api.get_cluster_allowlist(
            CmdLineArgs.ClusterID)

        # Check response code , 200 is success
        if cluster_allowlist_from_API.status_code == 200:

            # Did we actually get any entries in the allow list?
            if cluster_allowlist_from_API.json() is not None:
                # Yep, we did.
                # Step 2 - Find the allow list entry that we want to update. cidr is unique, so we can search on that
                allow_list_entry_found = False
                allow_list_entries = cluster_allowlist_from_API.json()
                for allow_list in allow_list_entries:
                    # The allow list cidr has /xx and we only need the first bit
                    # so we split it apart on the / and use the first entry in the resulting list
                    # which has an index of zero
                    if allow_list['cidrBlock'].split(
                            '/')[0] == CmdLineArgs.cidrBlock:
                        allow_list_entry_found = True

                        # There should always be a value for comment, but just in case
                        if CmdLineArgs.Comment is not None:
                            allow_list["Comment"] = CmdLineArgs.Comment

                        # We can now update the allow list entry
                        capella_api_response = cappella_api.update_cluster_allowlist(
                            CmdLineArgs.ClusterID, allow_list_entries)

                        # Did the update work?
                        if capella_api_response.status_code == 202:
                            print("Updating allow list ")
                        else:
                            print("Failed to update allow list ")
                            print("Capella API returned " +
                                  str(capella_api_response.status_code))
                            print("Full error message")
                            print(capella_api_response.json()["message"])

                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"])
def main(cmd_line_args):
    cappella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    # Check Capella API status
    if cappella_api.api_status().status_code == 200:
        capella_api_response = cappella_api.get_cluster_health(cmd_line_args.ClusterID)

        print("Cluster status: " + capella_api_response.json()["status"] + "\n")
        if capella_api_response.status_code == 200:
            # Show a table with the node information
            table_rows = []
            table_header = ["Node name", "Services", "Status"]

            if "nodeStats" in capella_api_response.json():
                table_entries = capella_api_response.json()["nodeStats"]
            else:
                table_entries = None
                print("Node information not available\n")

            # We should have a list of nodes, but just in case, check
            # Then we will build the table
            if table_entries is not None:
                # Make sure the list is not empty
                if len(table_entries) > 0:
                    cluster_node_count = str(table_entries["totalCount"])
                    for entry in table_entries["serviceStats"]:
                        service_list_as_str = ' '.join(entry["services"])
                        table_rows.append([entry["nodeName"], service_list_as_str, entry["status"]])

                    print('Cluster nodes: ' + cluster_node_count)
                    print(pretty_table(table_header, table_rows))

            # Reset everything, we're going to do another table with the bucket information
            table_rows = []
            table_header = ["Bucket name", "Status"]

            if "bucketStats" in capella_api_response.json():
                table_entries = capella_api_response.json()["bucketStats"]
            else:
                table_entries = None
                print("Bucket information not available\n")

            if table_entries is not None:
                # Make sure the list is not empty
                if len(table_entries) > 0:
                    cluster_bucket_count = str(table_entries["totalCount"])
                    for entry_key in table_entries["healthStats"].keys():
                        table_rows.append([entry_key, table_entries["healthStats"][entry_key]])

                    print('Cluster buckets: ' + cluster_bucket_count)
                    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.")
Example #17
0
def main(cmd_line_args):
    cappella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        cappella_api.set_logging_level('DEBUG')
    else:
        capella_logging('info')

    # Check Capella API status
    if cappella_api.api_status().status_code == 200:
        capella_api_response = cappella_api.get_cluster_allowlist(
            cmd_line_args.ClusterID)
        # Check response code , 200 is success
        if capella_api_response.status_code == 200:
            allowlist_table_header = [
                "cidrBlock", "comment", "createdAt", "duration", "expiresAt",
                "ruleType", "state", "updatedAt"
            ]
            allowlist_table_rows = []
            cluster_allowlist = capella_api_response.json()

            # We should have a list of buckets, but just in case, check
            # Then we will build rows to show in a table
            if cluster_allowlist is not None:
                # Check to see if we got any buckets back
                if len(cluster_allowlist) > 0:
                    for allowlist in cluster_allowlist:
                        # Make the two key:values with time stamps look nicer
                        allowlist['createdAt'] = maya.parse(
                            allowlist['createdAt'])
                        allowlist['updatedAt'] = maya.parse(
                            allowlist['updatedAt'])

                        if allowlist['ruleType'] == "permanent":
                            # These need to go into the right place in the dictionary
                            # or the table is messed up
                            new_allowlist = {}
                            for k in allowlist:
                                new_allowlist[k] = allowlist[k]
                                if k == 'createdAt':
                                    new_allowlist['duration'] = " n/a "
                                    new_allowlist['expiresAt'] = " n/a "
                            allowlist = new_allowlist
                        else:
                            allowlist['expiresAt'] = maya.parse(
                                allowlist['expiresAt'])

                        allowlist_table_rows.append(allowlist.values())

                    print('Allowlist')
                    print(
                        pretty_table(allowlist_table_header,
                                     allowlist_table_rows))
                else:
                    print("Allowlist not found")
            else:
                print("Allowlist not found")

        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.")
def main(cmd_line_args):
    capella_api = CapellaAPI()

    if cmd_line_args.debug:
        capella_logging('debug')
        capella_api.set_logging_level('DEBUG')
    else:
        capella_logging('INFO')

    cluster_user_struct = {
        "password": cmd_line_args.Password,
        "username": cmd_line_args.UserName,
        "buckets": []
    }

    # Go through each entry
    for bucket_and_access_entry in cmd_line_args.Buckets.split(','):

        cluster_user_bucket_access_struct = {
            "bucketName": "",
            "bucketAccess": []
        }

        # Split up into the individual bits we need
        bucket_and_access_entry = bucket_and_access_entry.strip()
        bucket_access_requested = bucket_and_access_entry.split(':')[1]
        bucket_access_name = bucket_and_access_entry.split(':')[0]

        # Set the name of the bucket we're going to grant access to
        cluster_user_bucket_access_struct['bucketName'] = bucket_access_name

        # Look at the access requested and then map to what the endpoint expects
        if bucket_access_requested == 'r':
            cluster_user_bucket_access_struct["bucketAccess"].append(
                "data_reader")
        elif bucket_access_requested == 'w':
            cluster_user_bucket_access_struct["bucketAccess"].append(
                "data_writer")
        elif bucket_access_requested == 'rw':
            cluster_user_bucket_access_struct["bucketAccess"].append(
                "data_writer")
            cluster_user_bucket_access_struct["bucketAccess"].append(
                "data_reader")
        elif bucket_access_requested == 'wr':
            cluster_user_bucket_access_struct["bucketAccess"].append(
                "data_writer")
            cluster_user_bucket_access_struct["bucketAccess"].append(
                "data_reader")
        else:
            print('access not found for ' + bucket_and_access_entry)
            raise UserBucketAccessListError('access not found for ' +
                                            bucket_and_access_entry)

        cluster_user_struct["buckets"].append(
            cluster_user_bucket_access_struct)

    # Check Capella API status
    if capella_api.api_status().status_code == 200:
        capella_api_response = capella_api.create_cluster_user(
            False, cmd_line_args.ClusterID, cluster_user_struct)

        if capella_api_response.status_code == 201:
            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.")