Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert api-url to api-domain #341

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Resources required for BaseSpace TES stack
*/

export const basespaceAccessTokenSecretName = '/manual/BaseSpaceAccessTokenSecret'; // pragma: allowlist secret
export const ssCheckApiUrlSsmParameterName = '/sscheck/lambda-api-domain';
export const ssCheckApiDomainSsmParameterName = '/sscheck/lambda-api-domain';

/*
ICAv2 Resources - required by various stacks
Expand Down
4 changes: 2 additions & 2 deletions config/stacks/bsRunsUploadManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
basespaceAccessTokenSecretName,
eventBusName,
gdsBsRunsUploadLogPath,
ssCheckApiUrlSsmParameterName,
ssCheckApiDomainSsmParameterName,
} from '../constants';
import { BsRunsUploadManagerConfig } from '../../lib/workload/stateless/stacks/bs-runs-upload-manager/deploy/stack';

Expand All @@ -14,7 +14,7 @@ export const getBsRunsUploadManagerStackProps = (stage: AppStage): BsRunsUploadM
icaTokenSecretId: icaAccessTokenSecretName,
portalTokenSecretId: jwtSecretName,
basespaceTokenSecretId: basespaceAccessTokenSecretName,
ssCheckApiUrlSsmParameterName: ssCheckApiUrlSsmParameterName,
ssCheckApiDomainSsmParameterName: ssCheckApiDomainSsmParameterName,
eventbusName: eventBusName,
gdsSystemFilesPath: gdsBsRunsUploadLogPath[stage],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface BsRunsUploadManagerConstructProps {
icaTokenSecretObj: secretsManager.ISecret;
portalTokenSecretObj: secretsManager.ISecret;
basespaceSecretObj: secretsManager.ISecret;
ssCheckApiUrlSsmParameterObj: ssm.IStringParameter;
ssCheckApiDomainSsmParameterObj: ssm.IStringParameter;
eventBusObj: events.IEventBus;
/* Lambda layer paths */
uploadV2SamplesheetToGdsBsshLambdaPath: string; // __dirname + '/../../../lambdas/upload_v2_samplesheet_to_gds_bssh'
Expand Down Expand Up @@ -51,7 +51,7 @@ export class BsRunsUploadManagerConstruct extends Construct {
environment: {
ICA_BASE_URL: 'https://aps2.platform.illumina.com',
ICA_ACCESS_TOKEN_SECRET_ID: props.icaTokenSecretObj.secretName,
SS_CHECK_API_URL_PARAMETER_NAME: props.ssCheckApiUrlSsmParameterObj.parameterName,
SS_CHECK_API_DOMAIN_PARAMETER_NAME: props.ssCheckApiDomainSsmParameterObj.parameterName,
PORTAL_TOKEN_SECRET_ID: props.portalTokenSecretObj.secretName,
},
}
Expand Down Expand Up @@ -92,7 +92,7 @@ export class BsRunsUploadManagerConstruct extends Construct {
props.portalTokenSecretObj.grantRead(<IRole>upload_v2_samplesheet_to_gds_bssh_lambda.role);

// Give the lambda permission to read the ssm parameter value of the data portal api url
props.ssCheckApiUrlSsmParameterObj.grantRead(
props.ssCheckApiDomainSsmParameterObj.grantRead(
<IRole>upload_v2_samplesheet_to_gds_bssh_lambda.role
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface BsRunsUploadManagerConfig {
icaTokenSecretId: string; // IcaSecretsPortal
portalTokenSecretId: string; // orcabus/token-service-jwt
basespaceTokenSecretId: string; // /manual/BaseSpaceAccessTokenSecret
ssCheckApiUrlSsmParameterName: string; // /sscheck/lambda-api-domain
ssCheckApiDomainSsmParameterName: string; // /sscheck/lambda-api-domain
gdsSystemFilesPath: string; // gds://development/primary_data/temp/bs_runs_upload_tes/
eventbusName: string; // /umccr/orcabus/stateful/eventbridge
}
Expand Down Expand Up @@ -50,8 +50,8 @@ export class BsRunsUploadManagerStack extends cdk.Stack {

const ss_check_api_ssm_parameter_obj = ssm.StringParameter.fromStringParameterName(
this,
'SsCheckApiUrlSsmParameter',
props.ssCheckApiUrlSsmParameterName
'SsCheckApiDomainSsmParameter',
props.ssCheckApiDomainSsmParameterName
);

const event_bus_obj = events.EventBus.fromEventBusName(this, 'event_bus', props.eventbusName);
Expand All @@ -62,7 +62,7 @@ export class BsRunsUploadManagerStack extends cdk.Stack {
icaTokenSecretObj: ica_access_token_secret_obj,
portalTokenSecretObj: portal_secret_obj,
basespaceSecretObj: basespace_secret_obj,
ssCheckApiUrlSsmParameterObj: ss_check_api_ssm_parameter_obj,
ssCheckApiDomainSsmParameterObj: ss_check_api_ssm_parameter_obj,
eventBusObj: event_bus_obj,
/* Lambda paths */
uploadV2SamplesheetToGdsBsshLambdaPath: path.join(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
ICA_BASE_URL
ICA_ACCESS_TOKEN_SECRET_ID
PORTAL_TOKEN_SECRET_ID
SS_CHECK_API_URL_PARAMETER_NAME
SS_CHECK_API_DOMAIN_PARAMETER_NAME

And performs the following operations:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def set_portal_token():


def set_api_url():
os.environ["SS_CHECK_API_URL"] = get_api_url_from_ssm_parameter()
os.environ["SS_CHECK_API_DOMAIN"] = get_api_url_from_ssm_parameter()


def get_portal_token_from_aws_secrets_manager():
Expand All @@ -34,7 +34,7 @@ def get_portal_token_from_aws_secrets_manager():


def get_api_url_from_ssm_parameter():
ssm_parameter_name = os.environ.get("SS_CHECK_API_URL_PARAMETER_NAME", None)
ssm_parameter_name = os.environ.get("SS_CHECK_API_DOMAIN_PARAMETER_NAME", None)

if ssm_parameter_name is None:
logger.error("API_URL_PARAMETER_NAME env var is not set")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"""
from pathlib import Path
import os
from urllib.parse import urlunparse

import requests
from tempfile import NamedTemporaryFile
import json
Expand All @@ -26,7 +28,7 @@ def generate_v2_samplesheet(v1_samplesheet_file: Path) -> Path:
}

response = requests.post(
url=os.getenv("SS_CHECK_API_URL", None),
url=urlunparse(["https", os.getenv("SS_CHECK_API_DOMAIN", None), "", None, None, None]),
headers=headers,
files=files
)
Expand Down