# coding: utf-8
"""
System Initiative API
The API Server for interacting with a System Initiative workspace
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from system_initiative_api_client.models.get_func_v1_response import GetFuncV1Response
class TestGetFuncV1Response(unittest.TestCase):
"""GetFuncV1Response unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> GetFuncV1Response:
"""Test GetFuncV1Response
include_optional is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `GetFuncV1Response`
"""
model = GetFuncV1Response()
if include_optional:
return GetFuncV1Response(
code = 'async function main(input: Input): Promise < Output > {
if (!input.domain?.region) {
return {
result: "failure",
message: "No Region Name to validate",
};
}
const child = await siExec.waitUntilEnd("aws", [
"ec2",
"describe-regions",
"--region-names",
input.domain?.region!,
"--region",
"us-east-1",
]);
if (child.exitCode !== 0) {
console.error(child.stderr);
return {
result: "failure",
message: "Error from API"
}
}
const regionDetails = JSON.parse(child.stdout).Regions;
if (regionDetails.length === 0 || regionDetails.length > 1) {
return {
result: "failure",
message: "Unable to find Region"
}
}
if (regionDetails[0].OptInStatus === "not-opted-in") {
return {
result: "failure",
message: "Region not-opted-in for use"
}
}
return {
result: "success",
message: "Region is available to use",
};
}',
description = 'Validates if an AWS region exists and is available for use',
display_name = 'Validate Region',
is_locked = False,
kind = 'Qualification',
link = 'https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeRegions.html',
name = 'AWS Region Validator'
)
else:
return GetFuncV1Response(
code = 'async function main(input: Input): Promise < Output > {
if (!input.domain?.region) {
return {
result: "failure",
message: "No Region Name to validate",
};
}
const child = await siExec.waitUntilEnd("aws", [
"ec2",
"describe-regions",
"--region-names",
input.domain?.region!,
"--region",
"us-east-1",
]);
if (child.exitCode !== 0) {
console.error(child.stderr);
return {
result: "failure",
message: "Error from API"
}
}
const regionDetails = JSON.parse(child.stdout).Regions;
if (regionDetails.length === 0 || regionDetails.length > 1) {
return {
result: "failure",
message: "Unable to find Region"
}
}
if (regionDetails[0].OptInStatus === "not-opted-in") {
return {
result: "failure",
message: "Region not-opted-in for use"
}
}
return {
result: "success",
message: "Region is available to use",
};
}',
is_locked = False,
kind = 'Qualification',
name = 'AWS Region Validator',
)
"""
def testGetFuncV1Response(self):
"""Test GetFuncV1Response"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()