Skip to content

Commit

Permalink
lifecycle-ec2 (#427)
Browse files Browse the repository at this point in the history
Summary:

- `ec2` lifecycle methods through no code changes.
- Added robot test `AWS EC2 Insert Start Instance Exemplifies Lifecycle Insert Verb Form Encoded Request`.
- Added robot test `AWS EC2 Update Start Instance Exemplifies Lifecycle Update Verb Form Encoded Request`.
  • Loading branch information
general-kroll-4-life committed Jun 11, 2024
1 parent b959d2f commit a033a1c
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 11 deletions.
27 changes: 27 additions & 0 deletions test/mockserver/expectations/static-aws-expectations.json
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,33 @@
}
}
},
{
"httpRequest": {
"method": "POST",
"path": "/",
"headers": {
"Authorization": ["^.*SignedHeaders=.*content-type;host;x-amz-date.*$" ]
},
"body" : {
"type" : "PARAMETERS",
"parameters": {
"Action": [ "^StartInstances$" ],
"Version": [ "^2016\\-11\\-15$" ],
"InstanceId.1": [ "id-001" ]
}
}
},
"httpResponse": {
"headers": {
"content-type": [ "text/xml" ]
},
"statusCode": 200,
"body": {
"type": "STRING",
"value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <StartInstancesResponse xmlns=\"http://ec2.amazonaws.com/doc/2016-11-15/\"> <requestId>0000001-0001-0001-0001-0000000001</requestId> <instancesSet> <item> <instanceId>id-001</instanceId> <currentState> <code>0</code> <name>pending</name> </currentState> <previousState> <code>80</code> <name>stopped</name> </previousState> </item> </instancesSet> </StartInstancesResponse>"
}
}
},
{
"httpRequest": {
"method": "POST",
Expand Down
38 changes: 27 additions & 11 deletions test/registry/src/aws/v0.1.0/services/ec2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39560,10 +39560,7 @@ paths:
schema:
type: array
items:
allOf:
- $ref: '#/components/schemas/InstanceId'
- xml:
name: InstanceId
$ref: '#/components/schemas/InstanceId'
- name: AdditionalInfo
in: query
required: false
Expand Down Expand Up @@ -42475,6 +42472,9 @@ components:
instances_Start:
operation:
$ref: '#/paths/~1?Action=StartInstances&Version=2016-11-15/get'
# request:
# mediaType: text/xml
# xmlRootAnnotation: 'xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"'
response:
mediaType: text/xml
openAPIDocKey: '200'
Expand Down Expand Up @@ -42502,8 +42502,28 @@ components:
insert: []
select:
- $ref: '#/components/x-stackQL-resources/instances/methods/instances_Describe'
update:
- $ref: '#/components/x-stackQL-resources/instances/methods/instances_Start'
instances_start:
name: instances_start
methods:
instances_Start:
operation:
$ref: '#/paths/~1?Action=StartInstances&Version=2016-11-15/get'
# request:
# mediaType: text/xml
# xmlRootAnnotation: 'xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"'
response:
mediaType: text/xml
openAPIDocKey: '200'
id: aws.ec2.instances
sqlVerbs:
delete: []
insert:
- $ref: '#/components/x-stackQL-resources/instances/methods/instances_Start'
select: []
update: []
title: instances
title: instances_Start
internet_gateways:
name: internet_gateways
methods:
Expand Down Expand Up @@ -78373,13 +78393,9 @@ components:
title: StartInstancesRequest
properties:
InstanceId:
allOf:
- $ref: '#/components/schemas/InstanceIdStringList'
- description: The IDs of the instances.
$ref: '#/components/schemas/InstanceIdStringList'
additionalInfo:
allOf:
- $ref: '#/components/schemas/String'
- description: Reserved.
$ref: '#/components/schemas/String'
dryRun:
allOf:
- $ref: '#/components/schemas/Boolean'
Expand Down
47 changes: 47 additions & 0 deletions test/robot/functional/stackql_mocked_from_cmd_line.robot
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,53 @@ AWS Route53 Create Record Set Simple Exemplifies XML Request Body
... stdout=${CURDIR}/tmp/AWS-Route53-Create-Record-Set-Simple-Exemplifies-XML-Request-Body.tmp
... stderr=${CURDIR}/tmp/AWS-Route53-Create-Record-Set-Simple-Exemplifies-XML-Request-Body-stderr.tmp

AWS EC2 Insert Start Instance Exemplifies Lifecycle Insert Verb Form Encoded Request
${inputStr} = Catenate
... insert into
... aws.ec2.instances_start
... (InstanceId, region)
... select
... JSON('[ "id-001" ]'),
... 'ap-southeast-2'
... ;
Should Stackql Exec Inline Equal Both Streams
... ${STACKQL_EXE}
... ${OKTA_SECRET_STR}
... ${GITHUB_SECRET_STR}
... ${K8S_SECRET_STR}
... ${REGISTRY_NO_VERIFY_CFG_STR}
... ${AUTH_CFG_STR}
... ${SQL_BACKEND_CFG_STR_CANONICAL}
... ${inputStr}
... ${EMPTY}
... The operation was despatched successfully
... stdout=${CURDIR}/tmp/AWS-EC2-Insert-Start-Instance-Exemplifies-Lifecycle-Insert-Verb-Form-Encoded-Request.tmp
... stderr=${CURDIR}/tmp/AWS-EC2-Insert-Start-Instance-Exemplifies-Lifecycle-Insert-Verb-Form-Encoded-Request-stderr.tmp


AWS EC2 Update Start Instance Exemplifies Lifecycle Update Verb Form Encoded Request
${inputStr} = Catenate
... update
... aws.ec2.instances
... set
... InstanceId = JSON('[ "id-001" ]'),
... region = 'ap-southeast-2'
... ;
Should Stackql Exec Inline Equal Both Streams
... ${STACKQL_EXE}
... ${OKTA_SECRET_STR}
... ${GITHUB_SECRET_STR}
... ${K8S_SECRET_STR}
... ${REGISTRY_NO_VERIFY_CFG_STR}
... ${AUTH_CFG_STR}
... ${SQL_BACKEND_CFG_STR_CANONICAL}
... ${inputStr}
... ${EMPTY}
... The operation was despatched successfully
... stdout=${CURDIR}/tmp/AWS-EC2-Update-Start-Instance-Exemplifies-Lifecycle-Update-Verb-Form-Encoded-Request.tmp
... stderr=${CURDIR}/tmp/AWS-EC2-Update-Start-Instance-Exemplifies-Lifecycle-Update-Verb-Form-Encoded-Request-stderr.tmp


AWS Route53 Create Record Set CNAME Simple Exemplifies XML Request Body In Real Life
${inputStr} = Catenate
... insert into
Expand Down

0 comments on commit a033a1c

Please sign in to comment.