File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import os
2+
3+ from staxapp .config import Config
4+ from staxapp .openapi import StaxClient
5+
6+ Config .access_key = os .getenv ("ACCESS_KEY" )
7+ Config .secret_key = os .getenv ("SECRET_KEY" )
8+
9+ # Read all tasks
10+ task_client = StaxClient ("tasks" )
11+ all_tasks = task_client .ReadTasks ()
12+ print (all_tasks )
13+
14+ # Task Id in the response of a different StaxClient call
15+ task_id = < Task Id >
16+
17+ # Get a specific task
18+ task = task_client .ReadTask (task_id = task_id )
19+ print (task )
Original file line number Diff line number Diff line change 2626
2727#Upload the cfn to the deployment bucket
2828s3 = boto3 .resource ('s3' )
29- workload_client = StaxClient ("workloads" )
3029cfn_name = f'{ catalogue_version } -{ catalogue_name } .yaml'
3130s3 .Bucket (bucket_name ["Parameter" ]["Value" ]).upload_file (cloudformation_manifest_path , cfn_name )
3231
32+ ## Invoke the Stax SDK
33+ workload_client = StaxClient ("workloads" )
34+
3335# Make the cfn into a workload catalogue item
3436manifest_body = f"""Resources:
3537 - WorkloadSSM:
Original file line number Diff line number Diff line change 11import boto3
22from staxapp .config import Config
33from staxapp .openapi import StaxClient
4-
4+
55# Requirements
66# - Logged into the deployment bucket account
77# - Logged into the SDK
2626
2727#Upload the cfn to the deployment bucket
2828s3 = boto3 .resource ('s3' )
29- workload_client = StaxClient ("workloads" )
3029cfn_name = f'{ catalogue_version } -{ catalogue_name } .yaml'
3130s3 .Bucket (bucket_name ["Parameter" ]["Value" ]).upload_file (cloudformation_manifest_path , cfn_name )
3231
32+ # # Invoke the Stax SDK
33+ workload_client = StaxClient ("workloads" )
34+
3335# Make the cfn into a workload catalogue item
3436manifest_body = f"""Resources:
3537 - WorkloadSSM:
Original file line number Diff line number Diff line change 22from staxapp .openapi import StaxClient
33
44# Requirements
5- # - Logged into the deployment bucket account
65# - Logged into the SDK
76
87Config .access_key = < Access Key >
1211catalogue_id = < Catalogue Id >
1312workload_name = < Workload Name >
1413account_id = < Account Id >
15- parameter_dict = < Dictionary of Parameters
14+ parameter_dict = < Dictionary of Parameters >
1615tags_dict = < Dictionary of Tags >
1716
1817workload_client = StaxClient ('workloads' )
Original file line number Diff line number Diff line change 1+ from staxapp .config import Config
2+ from staxapp .openapi import StaxClient
3+
4+ Config .access_key = < Access Key >
5+ Config .secret_key = < Secret Key >
6+
7+ # The workload to update
8+ workload_id = < Workload Id >
9+ # The catalogue version id to update the worklaod too
10+ catalogue_version_id = < Catalogue Version Id >
11+
12+ workload_client = StaxClient ('workloads' )
13+
14+ response = workload_client .UpdateWorkload (workload_id = workload_id , catalogue_version_id = catalogue_version_id )
15+ print (response )
You can’t perform that action at this time.
0 commit comments