@orcabus/platform-cdk-constructs 0.0.36 → 0.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/.jsii +2 -2
  2. package/api-gateway/api-gateway.js +1 -1
  3. package/deployment-stack-pipeline/artifact-bucket.js +1 -1
  4. package/deployment-stack-pipeline/pipeline.js +1 -1
  5. package/dynamodb/index.js +2 -2
  6. package/ecs/index.js +1 -1
  7. package/lambda/index.js +1 -1
  8. package/lambda/layers/mart_tools/src/mart_tools/mart/models.py +0 -2
  9. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/data_sharing/__init__.py +4 -4
  10. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/data_sharing/globals.py +0 -1
  11. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/data_sharing/models.py +5 -1
  12. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/data_sharing/update_helpers.py +14 -18
  13. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq/__init__.py +7 -3
  14. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq/create_helpers.py +2 -2
  15. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq/models.py +0 -1
  16. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq/update_helpers.py +5 -5
  17. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq_decompression/__init__.py +6 -6
  18. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq_decompression/create_helpers.py +3 -3
  19. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq_decompression/globals.py +0 -1
  20. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq_decompression/models.py +10 -3
  21. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq_decompression/query_helpers.py +10 -7
  22. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq_decompression/update_helpers.py +13 -19
  23. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq_unarchiving/__init__.py +6 -6
  24. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq_unarchiving/update_helpers.py +1 -1
  25. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/icav2_wes/__init__.py +5 -5
  26. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/icav2_wes/create_helpers.py +5 -5
  27. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/icav2_wes/models.py +6 -1
  28. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/icav2_wes/update_helpers.py +12 -9
  29. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/mart/models.py +0 -2
  30. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/metadata/project_helpers.py +1 -1
  31. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/metadata/sample_helpers.py +2 -2
  32. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/metadata/subject_helpers.py +4 -4
  33. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/sequence/models.py +1 -1
  34. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/utils/requests_helpers.py +18 -16
  35. package/monitored-queue/index.js +1 -1
  36. package/named-lambda-role/index.js +1 -1
  37. package/package.json +1 -1
  38. package/provider-function/index.js +1 -1
  39. package/shared-config/networking.js +2 -2
  40. package/shared-config/slack.js +1 -1
package/.jsii CHANGED
@@ -6756,6 +6756,6 @@
6756
6756
  "symbolId": "shared-config/slack:SlackAlerts"
6757
6757
  }
6758
6758
  },
6759
- "version": "0.0.36",
6760
- "fingerprint": "AQT2JtcqQttpFxgpSQBleYyVLEKOYHPF4q1ii9wJBZ4="
6759
+ "version": "0.0.38",
6760
+ "fingerprint": "4FjPVQ7u4dRTAh4I76FF/w9EfDixVRbUKYR3r1wD8kg="
6761
6761
  }
@@ -15,7 +15,7 @@ const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
15
15
  const aws_route53_targets_1 = require("aws-cdk-lib/aws-route53-targets");
16
16
  const config_1 = require("./config");
17
17
  class OrcaBusApiGateway extends constructs_1.Construct {
18
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.apigateway.OrcaBusApiGateway", version: "0.0.36" };
18
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.apigateway.OrcaBusApiGateway", version: "0.0.38" };
19
19
  /**
20
20
  * The AWS region where the API Gateway is deployed.
21
21
  */
@@ -13,7 +13,7 @@ exports.CROSS_DEPLOYMENT_ARTIFACT_BUCKET_NAME = "orcabus-cross-deployment-codepi
13
13
  exports.CROSS_DEPLOYMENT_ARTIFACT_KMS_ALIAS = "orcabus-cross-deployment-codepipeline-artifact";
14
14
  exports.CROSS_DEPLOYMENT_ARTIFACT_KMS_ARN_SSM_PARAMETER_NAME = "/orcabus/deployment-stack-pipeline/artifact-bucket/kms-key-arn";
15
15
  class CrossDeploymentArtifactBucket extends constructs_1.Construct {
16
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.deploymentPipeline.CrossDeploymentArtifactBucket", version: "0.0.36" };
16
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.deploymentPipeline.CrossDeploymentArtifactBucket", version: "0.0.38" };
17
17
  /**
18
18
  * The S3 bucket used to store artifacts for cross-deployment pipelines.
19
19
  */
@@ -32,7 +32,7 @@ exports.DEFAULT_SYNTH_STEP_PARTIAL_BUILD_SPEC = {
32
32
  * before using this construct.
33
33
  */
34
34
  class DeploymentStackPipeline extends constructs_1.Construct {
35
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.deploymentPipeline.DeploymentStackPipeline", version: "0.0.36" };
35
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.deploymentPipeline.DeploymentStackPipeline", version: "0.0.38" };
36
36
  /**
37
37
  * The code pipeline construct that is created.
38
38
  */
package/dynamodb/index.js CHANGED
@@ -40,7 +40,7 @@ const dynamodb = __importStar(require("aws-cdk-lib/aws-dynamodb"));
40
40
  const aws_cdk_lib_1 = require("aws-cdk-lib");
41
41
  const config_1 = require("./config");
42
42
  class DynamoDbPartitionedConstruct extends constructs_1.Construct {
43
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.dynamodb.DynamoDbPartitionedConstruct", version: "0.0.36" };
43
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.dynamodb.DynamoDbPartitionedConstruct", version: "0.0.38" };
44
44
  table;
45
45
  constructor(scope, id, props) {
46
46
  super(scope, id);
@@ -75,7 +75,7 @@ class DynamoDbPartitionedConstruct extends constructs_1.Construct {
75
75
  }
76
76
  exports.DynamoDbPartitionedConstruct = DynamoDbPartitionedConstruct;
77
77
  class DynamoDbNonPartitionedConstruct extends constructs_1.Construct {
78
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.dynamodb.DynamoDbNonPartitionedConstruct", version: "0.0.36" };
78
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.dynamodb.DynamoDbNonPartitionedConstruct", version: "0.0.38" };
79
79
  table;
80
80
  constructor(scope, id, props) {
81
81
  super(scope, id);
package/ecs/index.js CHANGED
@@ -55,7 +55,7 @@ exports.LAMBDA_ARCHITECTURE_MAP = {
55
55
  ['ARM64']: lambda.Architecture.ARM_64
56
56
  };
57
57
  class EcsFargateTaskConstruct extends constructs_1.Construct {
58
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.ecs.EcsFargateTaskConstruct", version: "0.0.36" };
58
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.ecs.EcsFargateTaskConstruct", version: "0.0.38" };
59
59
  cluster;
60
60
  taskDefinition;
61
61
  taskExecutionRole;
package/lambda/index.js CHANGED
@@ -56,7 +56,7 @@ function getPythonUvDockerImage() {
56
56
  return aws_cdk_lib_1.DockerImage.fromBuild(path_1.default.join(__dirname, 'build_python'));
57
57
  }
58
58
  class PythonUvFunction extends aws_lambda_python_alpha_1.PythonFunction {
59
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.lambda.PythonUvFunction", version: "0.0.36" };
59
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.lambda.PythonUvFunction", version: "0.0.38" };
60
60
  // Class constructs, to be used for caching the layers
61
61
  // This means that if there are multiple lambdas throughout the stack
62
62
  // They will all use the same layer
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env python
2
2
 
3
3
  from enum import Enum
4
- from typing import Literal
5
-
6
4
 
7
5
  class AthenaDMLTypes(Enum):
8
6
  # https://docs.aws.amazon.com/athena/latest/ug/data-types.html
@@ -41,21 +41,21 @@ def get_data_sharing_request_response_results(
41
41
 
42
42
  def data_sharing_patch_request(
43
43
  endpoint: str,
44
- params: Optional[Dict] = None,
44
+ json_data: Optional[Dict] = None,
45
45
  ):
46
46
  return patch_request(
47
47
  url=get_data_sharing_url(endpoint),
48
- params=params
48
+ json_data=json_data
49
49
  )
50
50
 
51
51
 
52
52
  def data_sharing_post_request(
53
53
  endpoint: str,
54
- params: Optional[Dict] = None,
54
+ json_data: Optional[Dict] = None,
55
55
  ):
56
56
  return patch_request(
57
57
  url=get_data_sharing_url(endpoint),
58
- params=params
58
+ json_data=json_data
59
59
  )
60
60
 
61
61
 
@@ -1,6 +1,5 @@
1
1
  # Imports
2
2
  import re
3
- from typing import Literal
4
3
 
5
4
  # AWS PARAMETERS
6
5
  DATA_SHARING_SUBDOMAIN_NAME = "data-sharing"
@@ -17,7 +17,6 @@ PushJobStatusType = Literal[
17
17
  ]
18
18
 
19
19
 
20
-
21
20
  class PackageObject(TypedDict):
22
21
  id: str
23
22
  packageName: str
@@ -26,3 +25,8 @@ class PackageObject(TypedDict):
26
25
  requestTime: str
27
26
  completionTime: NotRequired[str]
28
27
  hasExpired: NotRequired[bool]
28
+
29
+
30
+ class JobPatchParameters(TypedDict):
31
+ status: str
32
+ errorMessage: NotRequired[str]
@@ -1,38 +1,37 @@
1
- from typing import Optional
1
+ from typing import Unpack
2
2
 
3
3
  from . import data_sharing_patch_request
4
4
  from .globals import PACKAGE_ENDPOINT, PUSH_ENDPOINT
5
- from .models import PackageStatusType, PackageObject, PushJobStatusType
5
+ from .models import PackageObject, JobPatchParameters
6
6
 
7
7
 
8
8
  def update_package_status(
9
9
  package_id: str,
10
- package_status: PackageStatusType,
11
- error_message: Optional[str] = None
10
+ **kwargs: Unpack[JobPatchParameters]
12
11
  ) -> PackageObject:
13
12
  """
14
13
  Add QC stats to a fastq_id.
15
14
 
16
15
  :param package_id: The package id
17
- :param package_status: The package status to set
18
- :param error_message: Optional error message
16
+ :param kwargs: JobPatchParameters to update the package with.
19
17
  """
18
+ # Raise error if any of the kwargs are not in the FastqListRowQueryParameters
19
+ for key in kwargs.keys():
20
+ if key not in JobPatchParameters.__annotations__:
21
+ raise ValueError(f"Invalid parameter: {key}")
22
+
20
23
  return data_sharing_patch_request(
21
24
  f"{PACKAGE_ENDPOINT}/{package_id}",
22
- params=dict(filter(
25
+ json_data=dict(filter(
23
26
  lambda x: x[1] is not None,
24
- {
25
- "status": package_status,
26
- "error_message": error_message
27
- }.items()
27
+ kwargs.items()
28
28
  ))
29
29
  )
30
30
 
31
31
 
32
32
  def update_push_job_status(
33
33
  push_job_id: str,
34
- push_job_status: PushJobStatusType,
35
- error_message: Optional[str] = None
34
+ **kwargs: Unpack[JobPatchParameters]
36
35
  ) -> PackageObject:
37
36
  """
38
37
  Add push job status to a push job.
@@ -43,11 +42,8 @@ def update_push_job_status(
43
42
  """
44
43
  return data_sharing_patch_request(
45
44
  f"{PUSH_ENDPOINT}/{push_job_id}",
46
- params=dict(filter(
45
+ json_data=dict(filter(
47
46
  lambda x: x[1] is not None,
48
- {
49
- "status": push_job_status,
50
- "error_message": error_message
51
- }.items()
47
+ kwargs.items()
52
48
  ))
53
49
  )
@@ -40,27 +40,31 @@ def get_fastq_request_response_results(
40
40
  ):
41
41
  return get_request_response_results(
42
42
  url=get_fastq_url(endpoint),
43
- params=params
43
+ params=params,
44
44
  )
45
45
 
46
46
 
47
47
  def fastq_patch_request(
48
48
  endpoint: str,
49
49
  params: Optional[Dict] = None,
50
+ json_data: Optional[Dict] = None,
50
51
  ):
51
52
  return patch_request(
52
53
  url=get_fastq_url(endpoint),
53
- params=params
54
+ params=params,
55
+ json_data=json_data,
54
56
  )
55
57
 
56
58
 
57
59
  def fastq_post_request(
58
60
  endpoint: str,
59
61
  params: Optional[Dict] = None,
62
+ json_data: Optional[Dict] = None,
60
63
  ):
61
64
  return post_request(
62
65
  url=get_fastq_url(endpoint),
63
- params=params
66
+ params=params,
67
+ json_data=json_data,
64
68
  )
65
69
 
66
70
 
@@ -41,7 +41,7 @@ def create_fastq_object(**kwargs: Unpack[FastqCreate]) -> Fastq:
41
41
  return Fastq(
42
42
  **fastq_post_request(
43
43
  endpoint=FASTQ_ENDPOINT,
44
- params=dict(kwargs)
44
+ json_data=dict(kwargs)
45
45
  )
46
46
  )
47
47
 
@@ -59,6 +59,6 @@ def create_fastq_set_object(**kwargs: Unpack[FastqSetCreate]) -> FastqSet:
59
59
  return FastqSet(
60
60
  **fastq_post_request(
61
61
  endpoint=FASTQ_SET_ENDPOINT,
62
- params=dict(kwargs)
62
+ json_data=dict(kwargs)
63
63
  )
64
64
  )
@@ -35,7 +35,6 @@
35
35
  }
36
36
  """
37
37
 
38
- from enum import Enum
39
38
  from typing import (
40
39
  TypedDict,
41
40
  Optional,
@@ -37,7 +37,7 @@ def add_qc_stats(fastq_id: str, qc_stats: QcStats) -> Fastq:
37
37
 
38
38
  return fastq_patch_request(
39
39
  f"{FASTQ_ENDPOINT}/{fastq_id}/addQcStats",
40
- params=dict(qc_stats)
40
+ json_data=dict(qc_stats)
41
41
  )
42
42
 
43
43
 
@@ -54,7 +54,7 @@ def add_read_count(fastq_id: str, read_count: ReadCount) -> Fastq:
54
54
 
55
55
  return fastq_patch_request(
56
56
  f"{FASTQ_ENDPOINT}/{fastq_id}/addReadCount",
57
- params=dict(read_count)
57
+ json_data=dict(read_count)
58
58
  )
59
59
 
60
60
 
@@ -71,7 +71,7 @@ def add_file_compression_information(fastq_id: str, file_compression_information
71
71
 
72
72
  return fastq_patch_request(
73
73
  f"{FASTQ_ENDPOINT}/{fastq_id}/addFileCompressionInformation",
74
- params=dict(file_compression_information)
74
+ json_data=dict(file_compression_information)
75
75
  )
76
76
 
77
77
 
@@ -88,7 +88,7 @@ def add_ntsm_storage_object(fastq_id: str, ntsm_fastq_storage_object: FileStorag
88
88
 
89
89
  return fastq_patch_request(
90
90
  f"{FASTQ_ENDPOINT}/{fastq_id}/addNtsmStorageObject",
91
- params=dict(ntsm_fastq_storage_object)
91
+ json_data=dict(ntsm_fastq_storage_object)
92
92
  )
93
93
 
94
94
 
@@ -105,7 +105,7 @@ def add_read_set(fastq_id: str, read_set: ReadSet) -> Fastq:
105
105
 
106
106
  return fastq_patch_request(
107
107
  f"{FASTQ_ENDPOINT}/{fastq_id}/addFastqPairStorageObject",
108
- params=dict(read_set)
108
+ json_data=dict(read_set)
109
109
  )
110
110
 
111
111
 
@@ -6,7 +6,7 @@ from typing import Dict, Optional
6
6
  # Local imports
7
7
  from .globals import FASTQ_DECOMPRESSION_SUBDOMAIN_NAME
8
8
  from ..utils.requests_helpers import (
9
- get_request_response_results, get_url, patch_request, get_request
9
+ get_request_response_results, get_url, patch_request, get_request, post_request
10
10
  )
11
11
 
12
12
 
@@ -46,21 +46,21 @@ def get_fastq_decompression_request_response_results(
46
46
 
47
47
  def fastq_decompression_patch_request(
48
48
  endpoint: str,
49
- params: Optional[Dict] = None,
49
+ json_data: Optional[Dict] = None,
50
50
  ):
51
51
  return patch_request(
52
52
  url=get_fastq_decompression_url(endpoint),
53
- params=params
53
+ json_data=json_data
54
54
  )
55
55
 
56
56
 
57
57
  def fastq_decompression_post_request(
58
58
  endpoint: str,
59
- params: Optional[Dict] = None,
59
+ json_data: Optional[Dict] = None,
60
60
  ):
61
- return patch_request(
61
+ return post_request(
62
62
  url=get_fastq_decompression_url(endpoint),
63
- params=params
63
+ json_data=json_data
64
64
  )
65
65
 
66
66
  # Create imports
@@ -4,11 +4,11 @@
4
4
  Create the job
5
5
  """
6
6
 
7
- from typing import List, Optional, Unpack
7
+ from typing import Unpack
8
8
 
9
9
  from . import fastq_decompression_post_request
10
10
  from .globals import JOB_ENDPOINT
11
- from .models import Job, JobType, JobCreateParameters
11
+ from .models import Job, JobCreateParameters
12
12
 
13
13
 
14
14
  def create_job(
@@ -30,5 +30,5 @@ def create_job(
30
30
 
31
31
  return fastq_decompression_post_request(
32
32
  JOB_ENDPOINT,
33
- params=non_null_kwargs
33
+ json_data=non_null_kwargs
34
34
  )
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
3
  import re
4
- from enum import Enum
5
4
 
6
5
  # AWS PARAMETERS
7
6
  FASTQ_DECOMPRESSION_SUBDOMAIN_NAME = "fastq-decompression"
@@ -16,7 +16,7 @@ from typing import (
16
16
  )
17
17
 
18
18
  JobType = Literal['FASTQ_DECOMPRESSION']
19
- JobStatus = Literal['PENDING', 'RUNNING', 'FAILED', 'ABORTED', 'SUCCEEDED']
19
+ JobStatusType = Literal['PENDING', 'RUNNING', 'FAILED', 'ABORTED', 'SUCCEEDED']
20
20
 
21
21
  # Output jobs
22
22
  class DecompressionJobOutputObjectItem(TypedDict):
@@ -73,7 +73,7 @@ class Job(TypedDict):
73
73
  id: str
74
74
  jobType: JobType
75
75
  stepsExecutionArn: str
76
- status: JobStatus
76
+ status: JobStatusType
77
77
  startTime: str
78
78
  endTime: str
79
79
  errorMessages: NotRequired[str]
@@ -90,10 +90,17 @@ class JobCreateParameters(TypedDict):
90
90
  class JobQueryParameters(TypedDict):
91
91
  fastqId: NotRequired[str]
92
92
  fastqSetId: NotRequired[str]
93
- status: NotRequired[JobStatus]
93
+ status: NotRequired[JobStatusType]
94
94
  createdAfter: NotRequired[str]
95
95
  createdBefore: NotRequired[str]
96
96
  completedAfter: NotRequired[str]
97
97
  completedBefore: NotRequired[str]
98
98
  page: NotRequired[int]
99
99
  rowsPerPage: NotRequired[int]
100
+
101
+
102
+ class JobUpdateParameters(TypedDict):
103
+ status: JobStatusType
104
+ errorMessage: NotRequired[str]
105
+ stepsExecutionArn: NotRequired[str]
106
+ output: NotRequired[JobOutputType]
@@ -10,11 +10,11 @@ get_unarchiving_job_list
10
10
  """
11
11
 
12
12
  # Type hints
13
- from typing import List, Unpack
13
+ from typing import List, Unpack, Optional
14
14
 
15
15
  # Local imports
16
16
  from . import get_fastq_decompression_request_response_results
17
- from .models import Job, JobStatus, JobQueryParameters
17
+ from .models import Job, JobStatusType, JobQueryParameters
18
18
  from .globals import JOB_ENDPOINT
19
19
 
20
20
 
@@ -39,13 +39,16 @@ def get_decompression_job_list(**kwargs: Unpack[JobQueryParameters]) -> List[Job
39
39
 
40
40
  def get_job_list_for_fastq(
41
41
  fastq_id: str,
42
- job_status: JobStatus
42
+ status: Optional[JobStatusType] = None
43
43
  ) -> List[Job]:
44
44
  """
45
45
  Check if fastq in job list
46
46
  :return:
47
47
  """
48
- return get_decompression_job_list(
49
- fastqId=fastq_id,
50
- status=job_status
51
- )
48
+ return get_decompression_job_list(**dict(filter(
49
+ lambda kv_iter_: kv_iter_[1] is not None,
50
+ {
51
+ "fastqId": fastq_id,
52
+ "status": status
53
+ }.items()
54
+ )))
@@ -5,39 +5,33 @@ Update helpers for the update script.
5
5
  """
6
6
 
7
7
  # Standard imports
8
- from typing import Optional, Dict, Any
8
+ from typing import Unpack
9
9
 
10
10
  # Local imports
11
11
  from . import fastq_decompression_patch_request
12
12
  from .globals import JOB_ENDPOINT
13
- from .models import Job, JobStatus, JobOutputType
13
+ from .models import Job, JobUpdateParameters
14
14
 
15
15
 
16
16
  def update_status(
17
17
  job_id: str,
18
- job_status: JobStatus,
19
- steps_execution_arn: Optional[str] = None,
20
- error_message: Optional[str] = None,
21
- output: Optional[Dict[str, JobOutputType]] = None
18
+ **kwargs: Unpack[JobUpdateParameters]
22
19
  ) -> Job:
23
20
  """
24
21
  Add QC stats to a fastq_id.
25
22
 
26
- :param job_id: The job id
27
- :param job_status: Dictionary of QC stats
28
- :param steps_execution_arn:
29
- :param output:
30
- :param error_message: Optional error message
23
+ :param job_id:
24
+ :param kwargs: JobUpdateStatusParameters
31
25
  """
26
+ # Raise error if any of the kwargs are not in the JobUpdateParameters
27
+ for key in kwargs.keys():
28
+ if key not in JobUpdateParameters.__annotations__:
29
+ raise ValueError(f"Invalid parameter: {key}")
30
+
32
31
  return fastq_decompression_patch_request(
33
32
  f"{JOB_ENDPOINT}/{job_id}",
34
- params=dict(filter(
35
- lambda x: x[1] is not None,
36
- {
37
- "status": job_status,
38
- "errorMessage": error_message,
39
- "stepsExecutionArn": steps_execution_arn,
40
- "output": output
41
- }.items()
33
+ json_data=dict(filter(
34
+ lambda kv_iter_: kv_iter_[1] is not None,
35
+ kwargs.items()
42
36
  ))
43
37
  )
@@ -9,7 +9,7 @@ from ..utils.requests_helpers import (
9
9
  get_request_response_results,
10
10
  get_url,
11
11
  patch_request,
12
- get_request
12
+ get_request, post_request
13
13
  )
14
14
 
15
15
 
@@ -49,21 +49,21 @@ def get_fastq_unarchiving_request_response_results(
49
49
 
50
50
  def fastq_unarchiving_patch_request(
51
51
  endpoint: str,
52
- params: Optional[Dict] = None,
52
+ json_data: Optional[Dict] = None,
53
53
  ):
54
54
  return patch_request(
55
55
  url=get_fastq_unarchiving_url(endpoint),
56
- params=params
56
+ json_data=json_data
57
57
  )
58
58
 
59
59
 
60
60
  def fastq_unarchiving_post_request(
61
61
  endpoint: str,
62
- params: Optional[Dict] = None,
62
+ json_data: Optional[Dict] = None,
63
63
  ):
64
- return patch_request(
64
+ return post_request(
65
65
  url=get_fastq_unarchiving_url(endpoint),
66
- params=params
66
+ json_data=json_data
67
67
  )
68
68
 
69
69
  # Create imports
@@ -35,7 +35,7 @@ def update_status(
35
35
  """
36
36
  return fastq_unarchiving_patch_request(
37
37
  f"{JOB_ENDPOINT}/{job_id}",
38
- params=dict(filter(
38
+ json_data=dict(filter(
39
39
  lambda x: x[1] is not None,
40
40
  {
41
41
  "status": job_status,
@@ -4,7 +4,7 @@
4
4
  from typing import Optional, Dict
5
5
 
6
6
  from .globals import ICAV2_WES_SUBDOMAIN_NAME
7
- from .models import WESRequest
7
+ from .models import WESPostRequest
8
8
  from ..utils.requests_helpers import (
9
9
  get_request, get_url, patch_request, get_request_response_results, post_request
10
10
  )
@@ -45,22 +45,22 @@ def get_icav2_wes_request_response_results(
45
45
 
46
46
  def icav2_wes_patch_request(
47
47
  endpoint: str,
48
- params: Optional[Dict] = None,
48
+ json_data: Optional[Dict] = None,
49
49
  ):
50
50
  return patch_request(
51
51
  url=get_icav2_wes_url(endpoint),
52
- params=params
52
+ json_data=json_data
53
53
  )
54
54
 
55
55
 
56
56
  def icav2_wes_post_request(
57
57
  endpoint: str,
58
- params: Dict
58
+ json_data: Dict
59
59
  ):
60
60
  # Confirm param keys are valid
61
61
  return post_request(
62
62
  url=get_icav2_wes_url(endpoint),
63
- params=params
63
+ json_data=json_data
64
64
  )
65
65
 
66
66
 
@@ -8,22 +8,22 @@ from typing import Unpack
8
8
 
9
9
  from . import icav2_wes_post_request
10
10
  from .globals import ANALYSES_ENDPOINT
11
- from .models import WESRequest, WESResponse
11
+ from .models import WESPostRequest, WESResponse
12
12
 
13
13
 
14
14
  def create_icav2_wes_analysis(
15
- **kwargs: Unpack[WESRequest]
15
+ **kwargs: Unpack[WESPostRequest]
16
16
  ) -> WESResponse:
17
17
  """
18
18
  Launch an icav2 analysis in the ICAV2 WES API.
19
19
  """
20
20
  # Confirm param keys are valid
21
21
  for key in kwargs.keys():
22
- if key not in WESRequest.__annotations__:
23
- raise ValueError(f"Invalid parameter key: {key}. Valid keys are: {', '.join(WESRequest.__annotations__.keys())}")
22
+ if key not in WESPostRequest.__annotations__:
23
+ raise ValueError(f"Invalid parameter key: {key}. Valid keys are: {', '.join(WESPostRequest.__annotations__.keys())}")
24
24
 
25
25
  # Confirm param values are valid
26
26
  return icav2_wes_post_request(
27
27
  ANALYSES_ENDPOINT,
28
- params=dict(**kwargs)
28
+ json_data=dict(**kwargs)
29
29
  )
@@ -25,7 +25,7 @@ class EngineParameters(TypedDict):
25
25
  logsUri: str
26
26
 
27
27
 
28
- class WESRequest(TypedDict):
28
+ class WESPostRequest(TypedDict):
29
29
  """WES request object."""
30
30
  name: str
31
31
  inputs: Dict[str, Any]
@@ -33,6 +33,11 @@ class WESRequest(TypedDict):
33
33
  tags: NotRequired[Dict[str, Any]]
34
34
 
35
35
 
36
+ class WESPatchRequest(TypedDict):
37
+ status: str
38
+ icav2AnalysisId: NotRequired[str]
39
+
40
+
36
41
  class WESResponse(TypedDict):
37
42
  """WES response object."""
38
43
  id: str
@@ -1,26 +1,29 @@
1
1
  #!/usr/bin/env python3
2
- from typing import Optional
2
+ from typing import Unpack
3
3
 
4
4
  from . import icav2_wes_patch_request
5
5
  from .globals import ANALYSES_ENDPOINT
6
- from .models import WESResponse
6
+ from .models import WESResponse, WESPatchRequest
7
+
7
8
 
8
9
  # Get the icav2 wes analysis by analysis name
9
10
  def update_icav2_wes_analysis_status(
10
11
  icav2_wes_orcabus_id: str,
11
- status: str,
12
- icav2_analysis_id: Optional[str] = None
12
+ **kwargs: Unpack[WESPatchRequest]
13
13
  ) -> WESResponse:
14
14
  """
15
15
  Get the icav2 wes analysis by analysis name
16
16
  """
17
+ # Confirm param keys are valid
18
+ for key in kwargs.keys():
19
+ if key not in WESPatchRequest.__annotations__:
20
+ raise ValueError(f"Invalid parameter key: {key}. Valid keys are: {', '.join(WESPatchRequest.__annotations__.keys())}")
21
+
22
+
17
23
  return icav2_wes_patch_request(
18
24
  f"{ANALYSES_ENDPOINT}/{icav2_wes_orcabus_id}",
19
- params=dict(filter(
25
+ json_data=dict(filter(
20
26
  lambda kv_iter_: kv_iter_[1] is not None,
21
- {
22
- "status": status,
23
- "icav2AnalysisId": icav2_analysis_id
24
- }.items()
27
+ kwargs.items()
25
28
  ))
26
29
  )
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env python
2
2
 
3
3
  from enum import Enum
4
- from typing import Literal
5
-
6
4
 
7
5
  class AthenaDMLTypes(Enum):
8
6
  # https://docs.aws.amazon.com/athena/latest/ug/data-types.html
@@ -42,7 +42,7 @@ def get_project_from_project_id(project_id: str) -> Project:
42
42
  def get_projects_list_from_project_id_list(project_id_list: List[str], accept_missing: bool = False) -> List[Project]:
43
43
  """
44
44
  Get project from the project id
45
- :param project_id:
45
+ :param project_id_list:
46
46
  :return:
47
47
  """
48
48
  # We have an internal id, convert to int
@@ -44,7 +44,7 @@ def get_sample_from_sample_id(sample_id: str) -> Sample:
44
44
  def get_samples_list_from_sample_id_list(sample_id_list: List[str], accept_missing: bool = False) -> List[Sample]:
45
45
  """
46
46
  Get sample from the sample id
47
- :param sample_id:
47
+ :param sample_id_list:
48
48
  :return:
49
49
  """
50
50
  # We have an internal id, convert to int
@@ -88,7 +88,7 @@ def get_sample_from_sample_orcabus_id(sample_orcabus_id: str) -> Sample:
88
88
  def get_samples_list_from_sample_orcabus_id_list(sample_orcabus_id_list: List[str], accept_missing: bool = False) -> List[Project]:
89
89
  """
90
90
  Get sample from the sample id
91
- :param sample_id:
91
+ :param sample_orcabus_id_list:
92
92
  :return:
93
93
  """
94
94
  # We have an internal id, convert to int
@@ -40,8 +40,8 @@ def get_subject_from_subject_id(subject_id: str) -> Subject:
40
40
 
41
41
  def get_subjects_list_from_subject_id_list(subject_id_list: List[str], accept_missing: bool = False) -> List[Sample]:
42
42
  """
43
- Get sample from the sample id
44
- :param sample_id:
43
+ Get subject objects from subject id list
44
+ :param subject_id_list:
45
45
  :return:
46
46
  """
47
47
  # We have an internal id, convert to int
@@ -74,8 +74,8 @@ def get_subject_orcabus_id_from_subject_id(subject_id: str) -> str:
74
74
 
75
75
  def get_subjects_list_from_subject_orcabus_id_list(subject_orcabus_id_list: List[str], accept_missing: bool = False) -> List[Sample]:
76
76
  """
77
- Get sample from the sample id
78
- :param sample_id:
77
+ Get subject objects from subject orcabus id list
78
+ :param subject_orcabus_id_list:
79
79
  :return:
80
80
  """
81
81
  # We have an internal id, convert to int
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
- from typing import TypedDict, Literal, NotRequired, Optional, Dict
3
+ from typing import TypedDict, Literal, Optional, Dict
4
4
 
5
5
  statusLiteral = Literal['STARTED', 'FAILED', 'SUCCEEDED', 'ABORTED', 'RESOLVED']
6
6
 
@@ -9,8 +9,6 @@ from copy import deepcopy
9
9
 
10
10
  from requests import HTTPError
11
11
 
12
- from fastapi.encoders import jsonable_encoder
13
-
14
12
  # Locals
15
13
  from .aws_helpers import (
16
14
  get_orcabus_token, get_hostname
@@ -115,17 +113,16 @@ def patch_request(
115
113
  "Authorization": f"Bearer {get_orcabus_token()}"
116
114
  }
117
115
 
118
- req_params = deepcopy(DEFAULT_REQUEST_PARAMS)
119
-
120
- req_params.update(
121
- params if params is not None else {}
122
- )
116
+ if json_data is not None:
117
+ headers.update({
118
+ "Content-Type": "application/json"
119
+ })
123
120
 
124
121
  # Make the request
125
122
  response = requests.patch(
126
123
  url,
127
124
  headers=headers,
128
- params=req_params,
125
+ params=params,
129
126
  json=json_data
130
127
  )
131
128
 
@@ -137,29 +134,34 @@ def patch_request(
137
134
  return response.json()
138
135
 
139
136
 
140
- def post_request(url: str, params: Optional[Dict] = None) -> Dict:
137
+ def post_request(
138
+ url: str,
139
+ json_data: Optional[Dict] = None,
140
+ params: Optional[Dict] = None
141
+ ) -> Dict:
141
142
  """
142
143
  Run post request against the fastq endpoint
144
+ :param json_data:
143
145
  :param url:
144
146
  :param params:
145
147
  :return:
146
148
  """
147
149
  # Get authorization header
148
150
  headers = {
149
- "Authorization": f"Bearer {get_orcabus_token()}"
151
+ "Authorization": f"Bearer {get_orcabus_token()}",
150
152
  }
151
153
 
152
- req_params = deepcopy(DEFAULT_REQUEST_PARAMS)
153
-
154
- req_params.update(
155
- params if params is not None else {}
156
- )
154
+ if json_data is not None:
155
+ headers.update({
156
+ "Content-Type": "application/json"
157
+ })
157
158
 
158
159
  # Make the request
159
160
  response = requests.post(
160
161
  url,
161
162
  headers=headers,
162
- json=req_params
163
+ json=json_data,
164
+ params=params
163
165
  )
164
166
 
165
167
  try:
@@ -13,7 +13,7 @@ const aws_cloudwatch_actions_1 = require("aws-cdk-lib/aws-cloudwatch-actions");
13
13
  * SNS topic.
14
14
  */
15
15
  class MonitoredQueue extends constructs_1.Construct {
16
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.monitoredQueue.MonitoredQueue", version: "0.0.36" };
16
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.monitoredQueue.MonitoredQueue", version: "0.0.38" };
17
17
  queue;
18
18
  deadLetterQueue;
19
19
  alarm;
@@ -7,7 +7,7 @@ const aws_iam_1 = require("aws-cdk-lib/aws-iam");
7
7
  * A construct which represents a named role that a Lambda function can assume.
8
8
  */
9
9
  class NamedLambdaRole extends aws_iam_1.Role {
10
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.namedLambdaRole.NamedLambdaRole", version: "0.0.36" };
10
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.namedLambdaRole.NamedLambdaRole", version: "0.0.38" };
11
11
  constructor(scope, id, props) {
12
12
  super(scope, id, {
13
13
  assumedBy: new aws_iam_1.ServicePrincipal("lambda.amazonaws.com"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orcabus/platform-cdk-constructs",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "description": "CDK Package for OrcaBus infrastructure.",
5
5
  "main": "index.ts",
6
6
  "types": "index.d.ts",
@@ -15,7 +15,7 @@ const aws_cdk_lib_1 = require("aws-cdk-lib");
15
15
  * to the provider framework.
16
16
  */
17
17
  class ProviderFunction extends constructs_1.Construct {
18
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.provider.ProviderFunction", version: "0.0.36" };
18
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.provider.ProviderFunction", version: "0.0.38" };
19
19
  _function;
20
20
  _response;
21
21
  constructor(scope, id, props) {
@@ -23,7 +23,7 @@ exports.VPC_LOOKUP_PROPS = {
23
23
  * Helper for looking up the shared OrcaBus VPC.
24
24
  */
25
25
  class OrcaBusVpc {
26
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.networking.OrcaBusVpc", version: "0.0.36" };
26
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.networking.OrcaBusVpc", version: "0.0.38" };
27
27
  /**
28
28
  * The shared VPC that is used by OrcaBus.
29
29
  * @param scope
@@ -42,7 +42,7 @@ exports.SHARED_SECURITY_GROUP_NAME = "OrcaBusSharedComputeSecurityGroup";
42
42
  * Helper for looking up the shared compute security group by name.
43
43
  */
44
44
  class OrcaBusSharedComputeSecurityGroup {
45
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.networking.OrcaBusSharedComputeSecurityGroup", version: "0.0.36" };
45
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.networking.OrcaBusSharedComputeSecurityGroup", version: "0.0.38" };
46
46
  /**
47
47
  * The shared security group that is used by compute resources to access the database.
48
48
  * @param scope
@@ -11,7 +11,7 @@ exports.SLACK_ALERTS_SNS_TOPIC = "AwsChatBotTopic-alerts";
11
11
  * A helper class to construct the arn for the slack SNS topic.
12
12
  */
13
13
  class SlackAlerts {
14
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.slack.SlackAlerts", version: "0.0.36" };
14
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.slack.SlackAlerts", version: "0.0.38" };
15
15
  /**
16
16
  * Format the ARN for the slack alerts SNS topic for the current stack.
17
17
  * @param stack