def create_pks_compute_profile(request_data,
                               request_context: ctx.RequestContext,
                               pks_context):
    ovdc_id = request_data.get(RequestKey.OVDC_ID)
    org_name = request_data.get(RequestKey.ORG_NAME)
    ovdc_name = request_data.get(RequestKey.OVDC_NAME)
    # Compute profile creation
    pks_compute_profile_name = _construct_pks_compute_profile_name(
        request_context.sysadmin_client, ovdc_id)
    pks_compute_profile_description = f"{org_name}--{ovdc_name}--{ovdc_id}"
    pks_az_name = f"az-{ovdc_name}"
    ovdc_rp_name = f"{ovdc_name} ({ovdc_id})"

    compute_profile_params = PksComputeProfileParams(
        pks_compute_profile_name, pks_az_name, pks_compute_profile_description,
        pks_context.get('cpi'), pks_context.get('datacenter'),
        pks_context.get('cluster'), ovdc_rp_name).to_dict()

    LOGGER.debug(f"Creating PKS Compute Profile with name:"
                 f"{pks_compute_profile_name}")

    pksbroker = PksBroker(pks_context, request_context)
    try:
        pksbroker.create_compute_profile(**compute_profile_params)
    except e.PksServerError as err:
        if err.status == requests.codes.conflict:
            LOGGER.debug(f"Compute profile name {pks_compute_profile_name}"
                         f" already exists\n{str(err)}")
        else:
            raise
def create_pks_compute_profile(pks_ctx,
                               tenant_auth_token,
                               is_jwt_token,
                               request_data):
    ovdc_id = request_data.get(RequestKey.OVDC_ID)
    org_name = request_data.get(RequestKey.ORG_NAME)
    ovdc_name = request_data.get(RequestKey.OVDC_NAME)
    # Compute profile creation
    pks_compute_profile_name = \
        _construct_pks_compute_profile_name(ovdc_id)
    pks_compute_profile_description = f"{org_name}--{ovdc_name}" \
        f"--{ovdc_id}"
    pks_az_name = f"az-{ovdc_name}"
    ovdc_rp_name = f"{ovdc_name} ({ovdc_id})"

    compute_profile_params = PksComputeProfileParams(
        pks_compute_profile_name, pks_az_name,
        pks_compute_profile_description,
        pks_ctx.get('cpi'),
        pks_ctx.get('datacenter'),
        pks_ctx.get('cluster'),
        ovdc_rp_name).to_dict()

    LOGGER.debug(f"Creating PKS Compute Profile with name:"
                 f"{pks_compute_profile_name}")

    pksbroker = PksBroker(pks_ctx, tenant_auth_token, is_jwt_token)
    try:
        pksbroker.create_compute_profile(**compute_profile_params)
    except PksServerError as ex:
        if ex.status == requests.codes.conflict:
            LOGGER.debug(f"Compute profile name {pks_compute_profile_name}"
                         f" already exists\n{str(ex)}")
        else:
            raise