From 9c3cc67175e1ee7bd5123128553d01847caca583 Mon Sep 17 00:00:00 2001 From: exoego Date: Sat, 20 Jun 2020 21:19:24 +0900 Subject: [PATCH 1/5] Setup macros --- build.sbt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/build.sbt b/build.sbt index 86f62e7..78188a3 100644 --- a/build.sbt +++ b/build.sbt @@ -15,5 +15,23 @@ scalacOptions --= Seq( val awsSdkScalajsFacadeVersion = "[0.29.0-v2.624.0,1.0)" libraryDependencies ++= Seq( + "net.exoego" %%% "scalajs-types-util" % "0.2.1", "net.exoego" %%% "aws-sdk-scalajs-facade-dynamodb" % awsSdkScalajsFacadeVersion ) + +Compile / scalacOptions ++= { + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, n)) if n >= 13 => "-Ymacro-annotations" :: Nil + case _ => Nil + } +} + +libraryDependencies ++= { + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, n)) if n >= 13 => Nil + case _ => + compilerPlugin( + "org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full + ) :: Nil + } +} From cb66b3cebd905d64124b0d897a240b3385840144 Mon Sep 17 00:00:00 2001 From: exoego Date: Sat, 20 Jun 2020 21:45:02 +0900 Subject: [PATCH 2/5] Use factory macro to reduce boilerplate --- build.sbt | 4 +- .../exoego/facade/aws_lambda/Handler.scala | 72 +---- .../net/exoego/facade/aws_lambda/alb.scala | 87 +----- .../aws_lambda/apigateway_authorizer.scala | 76 +----- .../facade/aws_lambda/apigateway_proxy.scala | 204 +------------- .../cloudformationcustomresource.scala | 124 ++------- .../exoego/facade/aws_lambda/cloudfront.scala | 174 +----------- .../aws_lambda/cloudfront_request.scala | 30 +-- .../aws_lambda/cloudfront_response.scala | 30 +-- .../facade/aws_lambda/cloudwatch_logs.scala | 66 +---- .../facade/aws_lambda/codepipeline.scala | 149 +---------- .../codepipeline_cloudwatch_laction.scala | 68 +---- .../codepipeline_cloudwatch_pipeline.scala | 46 +--- .../codepipeline_cloudwatch_stage.scala | 48 +--- .../facade/aws_lambda/cognito_userpool.scala | 217 +-------------- .../facade/aws_lambda/dynamodb_stream.scala | 91 +------ .../kinesis_firehose_transformation.scala | 90 +------ .../facade/aws_lambda/kinesis_stream.scala | 61 +---- .../net/exoego/facade/aws_lambda/lex.scala | 251 ++---------------- .../net/exoego/facade/aws_lambda/s3.scala | 173 +----------- .../exoego/facade/aws_lambda/s3_batch.scala | 83 +----- .../net/exoego/facade/aws_lambda/sns.scala | 77 +----- .../net/exoego/facade/aws_lambda/sqs.scala | 88 +----- 23 files changed, 182 insertions(+), 2127 deletions(-) diff --git a/build.sbt b/build.sbt index 78188a3..71cf472 100644 --- a/build.sbt +++ b/build.sbt @@ -5,8 +5,10 @@ organization := "net.exoego" scalacOptions ++= Seq("-P:scalajs:sjsDefinedByDefault").filter { _ => Option(System.getenv("SCALAJS_VERSION")).exists(_.startsWith("0.6.")) } -// false positive on js.native scalacOptions --= Seq( + // Do not fail on macro warning + "-Xfatal-warnings", + // false positive on js.native "-Wdead-code", "-Wunused:params", "-Ywarn-dead-code", diff --git a/src/main/scala/net/exoego/facade/aws_lambda/Handler.scala b/src/main/scala/net/exoego/facade/aws_lambda/Handler.scala index a179f2e..27bf7b9 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/Handler.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/Handler.scala @@ -1,5 +1,7 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js import scala.scalajs.js.annotation.JSName import scala.scalajs.js.| @@ -46,25 +48,14 @@ trait Context extends js.Object { def succeed(message: String, `object`: js.Any): Unit = js.native } +@Factory @js.native trait CognitoIdentity extends js.Object { var cognitoIdentityId: String = js.native var cognitoIdentityPoolId: String = js.native } -object CognitoIdentity { - def apply( - cognitoIdentityId: String, - cognitoIdentityPoolId: String - ): CognitoIdentity = { - val _obj$ = js.Dynamic.literal( - "cognitoIdentityId" -> cognitoIdentityId.asInstanceOf[js.Any], - "cognitoIdentityPoolId" -> cognitoIdentityPoolId.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CognitoIdentity] - } -} - +@Factory @js.native trait ClientContext extends js.Object { var client: ClientContextClient = js.native @@ -72,21 +63,7 @@ trait ClientContext extends js.Object { var env: ClientContextEnv = js.native } -object ClientContext { - def apply( - client: ClientContextClient, - env: ClientContextEnv, - Custom: js.UndefOr[js.Any] = js.undefined - ): ClientContext = { - val _obj$ = js.Dynamic.literal( - "client" -> client.asInstanceOf[js.Any], - "env" -> env.asInstanceOf[js.Any] - ) - Custom.foreach(_v => _obj$.updateDynamic("Custom")(_v.asInstanceOf[js.Any])) - _obj$.asInstanceOf[ClientContext] - } -} - +@Factory @js.native trait ClientContextClient extends js.Object { var installationId: String = js.native @@ -96,25 +73,7 @@ trait ClientContextClient extends js.Object { var appPackageName: String = js.native } -object ClientContextClient { - def apply( - installationId: String, - appTitle: String, - appVersionName: String, - appVersionCode: String, - appPackageName: String - ): ClientContextClient = { - val _obj$ = js.Dynamic.literal( - "installationId" -> installationId.asInstanceOf[js.Any], - "appTitle" -> appTitle.asInstanceOf[js.Any], - "appVersionName" -> appVersionName.asInstanceOf[js.Any], - "appVersionCode" -> appVersionCode.asInstanceOf[js.Any], - "appPackageName" -> appPackageName.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[ClientContextClient] - } -} - +@Factory @js.native trait ClientContextEnv extends js.Object { var platformVersion: String = js.native @@ -123,22 +82,3 @@ trait ClientContextEnv extends js.Object { var model: String = js.native var locale: String = js.native } - -object ClientContextEnv { - def apply( - platformVersion: String, - platform: String, - make: String, - model: String, - locale: String - ): ClientContextEnv = { - val _obj$ = js.Dynamic.literal( - "platformVersion" -> platformVersion.asInstanceOf[js.Any], - "platform" -> platform.asInstanceOf[js.Any], - "make" -> make.asInstanceOf[js.Any], - "model" -> model.asInstanceOf[js.Any], - "locale" -> locale.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[ClientContextEnv] - } -} diff --git a/src/main/scala/net/exoego/facade/aws_lambda/alb.scala b/src/main/scala/net/exoego/facade/aws_lambda/alb.scala index 8608c65..88a1ba3 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/alb.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/alb.scala @@ -1,40 +1,25 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js import scala.scalajs.js.| +@Factory @js.native trait ALBEventRequestContext extends js.Object { var elb: ALBEventRequestContext.Elb = js.native } object ALBEventRequestContext { - def apply( - elb: ALBEventRequestContext.Elb - ): ALBEventRequestContext = { - val _obj$ = js.Dynamic.literal( - "elb" -> elb.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[ALBEventRequestContext] - } - + @Factory(false) @js.native trait Elb extends js.Object { var targetGroupArn: String = js.native } - - object Elb { - def apply( - targetGroupArn: String - ): Elb = { - val _obj$ = js.Dynamic.literal( - "targetGroupArn" -> targetGroupArn.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Elb] - } - } } +@Factory @js.native trait ALBEvent extends js.Object { var requestContext: ALBEventRequestContext = js.native @@ -51,48 +36,13 @@ trait ALBEvent extends js.Object { } object ALBEvent { - def apply( - requestContext: ALBEventRequestContext, - httpMethod: String, - path: String, - isBase64Encoded: Boolean, - body: String | Null = null, - queryStringParameters: js.UndefOr[ALBEvent.QueryStringParameters] = - js.undefined, - headers: js.UndefOr[ALBEvent.Headers] = js.undefined, - multiValueQueryStringParameters: js.UndefOr[ - ALBEvent.MultiValueQueryStringParameters - ] = js.undefined, - multiValueHeaders: js.UndefOr[ALBEvent.MultiValueHeaders] = js.undefined - ): ALBEvent = { - val _obj$ = js.Dynamic.literal( - "requestContext" -> requestContext.asInstanceOf[js.Any], - "httpMethod" -> httpMethod.asInstanceOf[js.Any], - "path" -> path.asInstanceOf[js.Any], - "body" -> body.asInstanceOf[js.Any], - "isBase64Encoded" -> isBase64Encoded.asInstanceOf[js.Any] - ) - queryStringParameters.foreach(_v => - _obj$.updateDynamic("queryStringParameters")(_v.asInstanceOf[js.Any]) - ) - headers.foreach(_v => - _obj$.updateDynamic("headers")(_v.asInstanceOf[js.Any]) - ) - multiValueQueryStringParameters.foreach(_v => - _obj$.updateDynamic("multiValueQueryStringParameters")( - _v.asInstanceOf[js.Any] - ) - ) - multiValueHeaders.foreach(_v => - _obj$.updateDynamic("multiValueHeaders")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[ALBEvent] - } type QueryStringParameters = js.Dictionary[String] type Headers = js.Dictionary[String] type MultiValueQueryStringParameters = js.Dictionary[js.Array[String]] type MultiValueHeaders = js.Dictionary[js.Array[String]] } + +@Factory @js.native trait ALBResult extends js.Object { var statusCode: Double = js.native @@ -104,29 +54,6 @@ trait ALBResult extends js.Object { } object ALBResult { - def apply( - statusCode: Double, - statusDescription: String, - isBase64Encoded: Boolean, - headers: js.UndefOr[ALBResult.Headers] = js.undefined, - multiValueHeaders: js.UndefOr[ALBResult.MultiValueHeaders] = js.undefined, - body: js.UndefOr[String] = js.undefined - ): ALBResult = { - val _obj$ = js.Dynamic.literal( - "statusCode" -> statusCode.asInstanceOf[js.Any], - "statusDescription" -> statusDescription.asInstanceOf[js.Any], - "isBase64Encoded" -> isBase64Encoded.asInstanceOf[js.Any] - ) - headers.foreach(_v => - _obj$.updateDynamic("headers")(_v.asInstanceOf[js.Any]) - ) - multiValueHeaders.foreach(_v => - _obj$.updateDynamic("multiValueHeaders")(_v.asInstanceOf[js.Any]) - ) - body.foreach(_v => _obj$.updateDynamic("body")(_v.asInstanceOf[js.Any])) - _obj$.asInstanceOf[ALBResult] - } - type Headers = HeadersBDS type MultiValueHeaders = MultiValueHeadersBDS } diff --git a/src/main/scala/net/exoego/facade/aws_lambda/apigateway_authorizer.scala b/src/main/scala/net/exoego/facade/aws_lambda/apigateway_authorizer.scala index ba5c327..3e0cf9c 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/apigateway_authorizer.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/apigateway_authorizer.scala @@ -1,14 +1,18 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js import scala.scalajs.js.| +@Factory trait APIGatewayTokenAuthorizerEvent extends js.Object { var `type`: String var methodArn: String var authorizationToken: String } +@Factory trait APIGatewayRequestAuthorizerEvent extends js.Object { var `type`: String var methodArn: String @@ -24,6 +28,7 @@ trait APIGatewayRequestAuthorizerEvent extends js.Object { var requestContext: APIGatewayEventRequestContextWithAuthorizer[Unit] } +@Factory trait APIGatewayAuthorizerResult extends js.Object { var principalId: String var policyDocument: PolicyDocument @@ -31,6 +36,7 @@ trait APIGatewayAuthorizerResult extends js.Object { var usageIdentifierKey: js.UndefOr[String | Null] } +@Factory trait APIGatewayAuthorizerWithContextResult[ TAuthorizerContext <: APIGatewayAuthorizerResultContext ] extends js.Object { @@ -40,6 +46,7 @@ trait APIGatewayAuthorizerWithContextResult[ var usageIdentifierKey: js.UndefOr[String | Null] } +@Factory @js.native trait PolicyDocument extends js.Object { var Version: String = js.native @@ -47,21 +54,7 @@ trait PolicyDocument extends js.Object { var Statement: js.Array[Statement] = js.native } -object PolicyDocument { - def apply( - Version: String, - Statement: js.Array[Statement], - Id: js.UndefOr[String] = js.undefined - ): PolicyDocument = { - val _obj$ = js.Dynamic.literal( - "Version" -> Version.asInstanceOf[js.Any], - "Statement" -> Statement.asInstanceOf[js.Any] - ) - Id.foreach(_v => _obj$.updateDynamic("Id")(_v.asInstanceOf[js.Any])) - _obj$.asInstanceOf[PolicyDocument] - } -} - +@Factory @js.native trait BaseStatement extends js.Object { var Effect: String = js.native @@ -69,65 +62,16 @@ trait BaseStatement extends js.Object { var Condition: js.UndefOr[ConditionBlock] = js.native } -object BaseStatement { - def apply( - Effect: String, - Sid: js.UndefOr[String] = js.undefined, - Condition: js.UndefOr[ConditionBlock] = js.undefined - ): BaseStatement = { - val _obj$ = js.Dynamic.literal( - "Effect" -> Effect.asInstanceOf[js.Any] - ) - Sid.foreach(_v => _obj$.updateDynamic("Sid")(_v.asInstanceOf[js.Any])) - Condition.foreach(_v => - _obj$.updateDynamic("Condition")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[BaseStatement] - } -} - +@Factory @js.native trait MaybeStatementPrincipal extends js.Object { var Principal: js.UndefOr[PrincipalValue] = js.native var NotPrincipal: js.UndefOr[PrincipalValue] = js.native } -object MaybeStatementPrincipal { - def apply( - Principal: js.UndefOr[PrincipalValue] = js.undefined, - NotPrincipal: js.UndefOr[PrincipalValue] = js.undefined - ): MaybeStatementPrincipal = { - val _obj$ = js.Dynamic.literal( - ) - Principal.foreach(_v => - _obj$.updateDynamic("Principal")(_v.asInstanceOf[js.Any]) - ) - NotPrincipal.foreach(_v => - _obj$.updateDynamic("NotPrincipal")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[MaybeStatementPrincipal] - } -} - +@Factory @js.native trait MaybeStatementResource extends js.Object { var Resource: js.UndefOr[String | js.Array[String]] = js.native var NotResource: js.UndefOr[String | js.Array[String]] = js.native } - -object MaybeStatementResource { - def apply( - Resource: js.UndefOr[String | js.Array[String]] = js.undefined, - NotResource: js.UndefOr[String | js.Array[String]] = js.undefined - ): MaybeStatementResource = { - val _obj$ = js.Dynamic.literal( - ) - Resource.foreach(_v => - _obj$.updateDynamic("Resource")(_v.asInstanceOf[js.Any]) - ) - NotResource.foreach(_v => - _obj$.updateDynamic("NotResource")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[MaybeStatementResource] - } -} diff --git a/src/main/scala/net/exoego/facade/aws_lambda/apigateway_proxy.scala b/src/main/scala/net/exoego/facade/aws_lambda/apigateway_proxy.scala index 9f80bb1..a60a263 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/apigateway_proxy.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/apigateway_proxy.scala @@ -1,5 +1,7 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js import scala.scalajs.js.| @@ -7,6 +9,7 @@ import scala.scalajs.js.| * Works with Lambda Proxy Integration for Rest API or HTTP API integration Payload Format version 1.0 * @see - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html */ +@Factory @js.native trait APIGatewayProxyEvent extends js.Object { var body: String | Null = js.native @@ -25,38 +28,6 @@ trait APIGatewayProxyEvent extends js.Object { } object APIGatewayProxyEvent { - def apply( - headers: APIGatewayProxyEvent.Headers, - multiValueHeaders: APIGatewayProxyEvent.MultiValueHeaders, - httpMethod: String, - isBase64Encoded: Boolean, - path: String, - requestContext: APIGatewayEventRequestContext, - resource: String, - body: String | Null = null, - pathParameters: js.Dictionary[String] | Null = null, - queryStringParameters: js.Dictionary[String] | Null = null, - multiValueQueryStringParameters: js.Dictionary[js.Array[String]] | Null = - null, - stageVariables: js.Dictionary[String] | Null = null - ): APIGatewayProxyEvent = { - val _obj$ = js.Dynamic.literal( - "body" -> body.asInstanceOf[js.Any], - "headers" -> headers.asInstanceOf[js.Any], - "multiValueHeaders" -> multiValueHeaders.asInstanceOf[js.Any], - "httpMethod" -> httpMethod.asInstanceOf[js.Any], - "isBase64Encoded" -> isBase64Encoded.asInstanceOf[js.Any], - "path" -> path.asInstanceOf[js.Any], - "pathParameters" -> pathParameters.asInstanceOf[js.Any], - "queryStringParameters" -> queryStringParameters.asInstanceOf[js.Any], - "multiValueQueryStringParameters" -> multiValueQueryStringParameters - .asInstanceOf[js.Any], - "stageVariables" -> stageVariables.asInstanceOf[js.Any], - "requestContext" -> requestContext.asInstanceOf[js.Any], - "resource" -> resource.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[APIGatewayProxyEvent] - } type Headers = js.Dictionary[String] type MultiValueHeaders = js.Dictionary[js.Array[String]] } @@ -65,6 +36,7 @@ object APIGatewayProxyEvent { * Works with Lambda Proxy Integration for Rest API or HTTP API integration Payload Format version 1.0 * @see - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html */ +@Factory @js.native trait APIGatewayProxyResult extends js.Object { var statusCode: Double = js.native @@ -76,29 +48,6 @@ trait APIGatewayProxyResult extends js.Object { } object APIGatewayProxyResult { - def apply( - statusCode: Double, - body: String, - headers: js.UndefOr[APIGatewayProxyResult.Headers] = js.undefined, - multiValueHeaders: js.UndefOr[APIGatewayProxyResult.MultiValueHeaders] = - js.undefined, - isBase64Encoded: js.UndefOr[Boolean] = js.undefined - ): APIGatewayProxyResult = { - val _obj$ = js.Dynamic.literal( - "statusCode" -> statusCode.asInstanceOf[js.Any], - "body" -> body.asInstanceOf[js.Any] - ) - headers.foreach(_v => - _obj$.updateDynamic("headers")(_v.asInstanceOf[js.Any]) - ) - multiValueHeaders.foreach(_v => - _obj$.updateDynamic("multiValueHeaders")(_v.asInstanceOf[js.Any]) - ) - isBase64Encoded.foreach(_v => - _obj$.updateDynamic("isBase64Encoded")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[APIGatewayProxyResult] - } type Headers = HeadersBDS type MultiValueHeaders = MultiValueHeadersBDS } @@ -107,7 +56,7 @@ object APIGatewayProxyResult { * Works with Lambda Proxy Integration for Rest API or HTTP API integration Payload Format version 2.0 * @see - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html */ - +@Factory @js.native trait APIGatewayProxyEventV2 extends js.Object { var version: String = js.native @@ -125,45 +74,7 @@ trait APIGatewayProxyEventV2 extends js.Object { } object APIGatewayProxyEventV2 { - def apply( - version: String, - routeKey: String, - rawPath: String, - rawQueryString: String, - headers: Headers, - requestContext: APIGatewayProxyEventV2.RequestContext, - isBase64Encoded: Boolean, - cookies: js.UndefOr[js.Array[String]] = js.undefined, - queryStringParameters: js.UndefOr[Headers] = js.undefined, - body: js.UndefOr[String] = js.undefined, - pathParameters: js.UndefOr[Headers] = js.undefined, - stageVariables: js.UndefOr[Headers] = js.undefined - ): APIGatewayProxyEventV2 = { - val _obj$ = js.Dynamic.literal( - "version" -> version.asInstanceOf[js.Any], - "routeKey" -> routeKey.asInstanceOf[js.Any], - "rawPath" -> rawPath.asInstanceOf[js.Any], - "rawQueryString" -> rawQueryString.asInstanceOf[js.Any], - "headers" -> headers.asInstanceOf[js.Any], - "requestContext" -> requestContext.asInstanceOf[js.Any], - "isBase64Encoded" -> isBase64Encoded.asInstanceOf[js.Any] - ) - cookies.foreach(_v => - _obj$.updateDynamic("cookies")(_v.asInstanceOf[js.Any]) - ) - queryStringParameters.foreach(_v => - _obj$.updateDynamic("queryStringParameters")(_v.asInstanceOf[js.Any]) - ) - body.foreach(_v => _obj$.updateDynamic("body")(_v.asInstanceOf[js.Any])) - pathParameters.foreach(_v => - _obj$.updateDynamic("pathParameters")(_v.asInstanceOf[js.Any]) - ) - stageVariables.foreach(_v => - _obj$.updateDynamic("stageVariables")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[APIGatewayProxyEventV2] - } - + @Factory(false) @js.native trait RequestContext extends js.Object { var accountId: String = js.native @@ -180,72 +91,22 @@ object APIGatewayProxyEventV2 { } object RequestContext { - def apply( - accountId: String, - apiId: String, - domainName: String, - domainPrefix: String, - http: RequestContext.Http, - requestId: String, - routeKey: String, - stage: String, - time: String, - timeEpoch: Double, - authorizer: js.UndefOr[RequestContext.Authorizer] = js.undefined - ): RequestContext = { - val _obj$ = js.Dynamic.literal( - "accountId" -> accountId.asInstanceOf[js.Any], - "apiId" -> apiId.asInstanceOf[js.Any], - "domainName" -> domainName.asInstanceOf[js.Any], - "domainPrefix" -> domainPrefix.asInstanceOf[js.Any], - "http" -> http.asInstanceOf[js.Any], - "requestId" -> requestId.asInstanceOf[js.Any], - "routeKey" -> routeKey.asInstanceOf[js.Any], - "stage" -> stage.asInstanceOf[js.Any], - "time" -> time.asInstanceOf[js.Any], - "timeEpoch" -> timeEpoch.asInstanceOf[js.Any] - ) - authorizer.foreach(_v => - _obj$.updateDynamic("authorizer")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[RequestContext] - } - + @Factory(false) @js.native trait Authorizer extends js.Object { var jwt: Authorizer.Jwt = js.native } object Authorizer { - def apply( - jwt: Authorizer.Jwt - ): Authorizer = { - val _obj$ = js.Dynamic.literal( - "jwt" -> jwt.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Authorizer] - } - + @Factory(false) @js.native trait Jwt extends js.Object { var claims: HeadersBDSA = js.native var scopes: js.Array[String] = js.native } - - object Jwt { - def apply( - claims: HeadersBDSA, - scopes: js.Array[String] - ): Jwt = { - val _obj$ = js.Dynamic.literal( - "claims" -> claims.asInstanceOf[js.Any], - "scopes" -> scopes.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Jwt] - } - } } + @Factory(false) @js.native trait Http extends js.Object { var method: String = js.native @@ -254,25 +115,6 @@ object APIGatewayProxyEventV2 { var sourceIp: String = js.native var userAgent: String = js.native } - - object Http { - def apply( - method: String, - path: String, - protocol: String, - sourceIp: String, - userAgent: String - ): Http = { - val _obj$ = js.Dynamic.literal( - "method" -> method.asInstanceOf[js.Any], - "path" -> path.asInstanceOf[js.Any], - "protocol" -> protocol.asInstanceOf[js.Any], - "sourceIp" -> sourceIp.asInstanceOf[js.Any], - "userAgent" -> userAgent.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Http] - } - } } } @@ -280,6 +122,7 @@ object APIGatewayProxyEventV2 { * Works with Lambda Proxy Integration for Rest API or HTTP API integration Payload Format version 2.0 * @see - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html */ +@Factory @js.native trait APIGatewayProxyStructuredResultV2 extends js.Object { var statusCode: js.UndefOr[Double] = js.native @@ -288,30 +131,3 @@ trait APIGatewayProxyStructuredResultV2 extends js.Object { var isBase64Encoded: js.UndefOr[Boolean] = js.native var cookies: js.UndefOr[js.Array[String]] = js.native } - -object APIGatewayProxyStructuredResultV2 { - def apply( - statusCode: js.UndefOr[Double] = js.undefined, - headers: js.UndefOr[HeadersBDS] = js.undefined, - body: js.UndefOr[String] = js.undefined, - isBase64Encoded: js.UndefOr[Boolean] = js.undefined, - cookies: js.UndefOr[js.Array[String]] = js.undefined - ): APIGatewayProxyStructuredResultV2 = { - val _obj$ = js.Dynamic.literal( - ) - statusCode.foreach(_v => - _obj$.updateDynamic("statusCode")(_v.asInstanceOf[js.Any]) - ) - headers.foreach(_v => - _obj$.updateDynamic("headers")(_v.asInstanceOf[js.Any]) - ) - body.foreach(_v => _obj$.updateDynamic("body")(_v.asInstanceOf[js.Any])) - isBase64Encoded.foreach(_v => - _obj$.updateDynamic("isBase64Encoded")(_v.asInstanceOf[js.Any]) - ) - cookies.foreach(_v => - _obj$.updateDynamic("cookies")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[APIGatewayProxyStructuredResultV2] - } -} diff --git a/src/main/scala/net/exoego/facade/aws_lambda/cloudformationcustomresource.scala b/src/main/scala/net/exoego/facade/aws_lambda/cloudformationcustomresource.scala index 3b0912e..b1ae03a 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/cloudformationcustomresource.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/cloudformationcustomresource.scala @@ -1,7 +1,10 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js +@Factory @js.native trait CloudFormationCustomResourceEventCommon extends js.Object { var ServiceToken: String = js.native @@ -15,49 +18,22 @@ trait CloudFormationCustomResourceEventCommon extends js.Object { } object CloudFormationCustomResourceEventCommon { - def apply( - ServiceToken: String, - ResponseURL: String, - StackId: String, - RequestId: String, - LogicalResourceId: String, - ResourceType: String, - ResourceProperties: CloudFormationCustomResourceEventCommon.ResourceProperties - ): CloudFormationCustomResourceEventCommon = { - val _obj$ = js.Dynamic.literal( - "ServiceToken" -> ServiceToken.asInstanceOf[js.Any], - "ResponseURL" -> ResponseURL.asInstanceOf[js.Any], - "StackId" -> StackId.asInstanceOf[js.Any], - "RequestId" -> RequestId.asInstanceOf[js.Any], - "LogicalResourceId" -> LogicalResourceId.asInstanceOf[js.Any], - "ResourceType" -> ResourceType.asInstanceOf[js.Any], - "ResourceProperties" -> ResourceProperties.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudFormationCustomResourceEventCommon] - } type ResourceProperties = js.Dictionary[js.Any] } +@Factory @js.native trait CloudFormationCustomResourceCreateEvent - extends CloudFormationCustomResourceEventCommon { + extends js.Object + with CloudFormationCustomResourceEventCommon { var RequestType: String = js.native } -object CloudFormationCustomResourceCreateEvent { - def apply( - RequestType: String - ): CloudFormationCustomResourceCreateEvent = { - val _obj$ = js.Dynamic.literal( - "RequestType" -> RequestType.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudFormationCustomResourceCreateEvent] - } -} - +@Factory @js.native trait CloudFormationCustomResourceUpdateEvent - extends CloudFormationCustomResourceEventCommon { + extends js.Object + with CloudFormationCustomResourceEventCommon { var RequestType: String = js.native var PhysicalResourceId: String = js.native var OldResourceProperties @@ -66,40 +42,19 @@ trait CloudFormationCustomResourceUpdateEvent } object CloudFormationCustomResourceUpdateEvent { - def apply( - RequestType: String, - PhysicalResourceId: String, - OldResourceProperties: CloudFormationCustomResourceUpdateEvent.OldResourceProperties - ): CloudFormationCustomResourceUpdateEvent = { - val _obj$ = js.Dynamic.literal( - "RequestType" -> RequestType.asInstanceOf[js.Any], - "PhysicalResourceId" -> PhysicalResourceId.asInstanceOf[js.Any], - "OldResourceProperties" -> OldResourceProperties.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudFormationCustomResourceUpdateEvent] - } type OldResourceProperties = js.Dictionary[js.Any] } +@Factory @js.native trait CloudFormationCustomResourceDeleteEvent - extends CloudFormationCustomResourceEventCommon { + extends js.Object + with CloudFormationCustomResourceEventCommon { var RequestType: String = js.native var PhysicalResourceId: String = js.native } -object CloudFormationCustomResourceDeleteEvent { - def apply( - RequestType: String, - PhysicalResourceId: String - ): CloudFormationCustomResourceDeleteEvent = { - val _obj$ = js.Dynamic.literal( - "RequestType" -> RequestType.asInstanceOf[js.Any], - "PhysicalResourceId" -> PhysicalResourceId.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudFormationCustomResourceDeleteEvent] - } -} +@Factory @js.native trait CloudFormationCustomResourceResponseCommon extends js.Object { var PhysicalResourceId: String = js.native @@ -111,64 +66,23 @@ trait CloudFormationCustomResourceResponseCommon extends js.Object { } object CloudFormationCustomResourceResponseCommon { - def apply( - PhysicalResourceId: String, - StackId: String, - RequestId: String, - LogicalResourceId: String, - Data: js.UndefOr[CloudFormationCustomResourceResponseCommon.Data] = - js.undefined, - NoEcho: js.UndefOr[Boolean] = js.undefined - ): CloudFormationCustomResourceResponseCommon = { - val _obj$ = js.Dynamic.literal( - "PhysicalResourceId" -> PhysicalResourceId.asInstanceOf[js.Any], - "StackId" -> StackId.asInstanceOf[js.Any], - "RequestId" -> RequestId.asInstanceOf[js.Any], - "LogicalResourceId" -> LogicalResourceId.asInstanceOf[js.Any] - ) - Data.foreach(_v => _obj$.updateDynamic("Data")(_v.asInstanceOf[js.Any])) - NoEcho.foreach(_v => _obj$.updateDynamic("NoEcho")(_v.asInstanceOf[js.Any])) - _obj$.asInstanceOf[CloudFormationCustomResourceResponseCommon] - } type Data = js.Dictionary[js.Any] } +@Factory @js.native trait CloudFormationCustomResourceSuccessResponse - extends CloudFormationCustomResourceResponseCommon { + extends js.Object + with CloudFormationCustomResourceResponseCommon { var Status: String = js.native var Reason: js.UndefOr[String] = js.native } -object CloudFormationCustomResourceSuccessResponse { - def apply( - Status: String, - Reason: js.UndefOr[String] = js.undefined - ): CloudFormationCustomResourceSuccessResponse = { - val _obj$ = js.Dynamic.literal( - "Status" -> Status.asInstanceOf[js.Any] - ) - Reason.foreach(_v => _obj$.updateDynamic("Reason")(_v.asInstanceOf[js.Any])) - _obj$.asInstanceOf[CloudFormationCustomResourceSuccessResponse] - } -} - +@Factory @js.native trait CloudFormationCustomResourceFailedResponse - extends CloudFormationCustomResourceResponseCommon { + extends js.Object + with CloudFormationCustomResourceResponseCommon { var Status: String = js.native var Reason: String = js.native } - -object CloudFormationCustomResourceFailedResponse { - def apply( - Status: String, - Reason: String - ): CloudFormationCustomResourceFailedResponse = { - val _obj$ = js.Dynamic.literal( - "Status" -> Status.asInstanceOf[js.Any], - "Reason" -> Reason.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudFormationCustomResourceFailedResponse] - } -} diff --git a/src/main/scala/net/exoego/facade/aws_lambda/cloudfront.scala b/src/main/scala/net/exoego/facade/aws_lambda/cloudfront.scala index 6cea47d..0408f7d 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/cloudfront.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/cloudfront.scala @@ -1,26 +1,16 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js +@Factory @js.native trait CloudFrontHeadersItem extends js.Object { var key: js.UndefOr[String] = js.native var value: String = js.native } -object CloudFrontHeadersItem { - def apply( - value: String, - key: js.UndefOr[String] = js.undefined - ): CloudFrontHeadersItem = { - val _obj$ = js.Dynamic.literal( - "value" -> value.asInstanceOf[js.Any] - ) - key.foreach(_v => _obj$.updateDynamic("key")(_v.asInstanceOf[js.Any])) - _obj$.asInstanceOf[CloudFrontHeadersItem] - } -} - @js.native trait CloudFrontOrigin extends js.Object { var s3: js.UndefOr[CloudFrontS3Origin] = js.native @@ -42,6 +32,8 @@ object CloudFrontOrigin { _obj$.asInstanceOf[CloudFrontOrigin] } } + +@Factory @js.native trait CloudFrontCustomOrigin extends js.Object { var customHeaders: CloudFrontHeaders = js.native @@ -54,31 +46,7 @@ trait CloudFrontCustomOrigin extends js.Object { var sslProtocols: js.Array[String] = js.native } -object CloudFrontCustomOrigin { - def apply( - customHeaders: CloudFrontHeaders, - domainName: String, - keepaliveTimeout: Double, - path: String, - port: Double, - protocol: String, - readTimeout: Double, - sslProtocols: js.Array[String] - ): CloudFrontCustomOrigin = { - val _obj$ = js.Dynamic.literal( - "customHeaders" -> customHeaders.asInstanceOf[js.Any], - "domainName" -> domainName.asInstanceOf[js.Any], - "keepaliveTimeout" -> keepaliveTimeout.asInstanceOf[js.Any], - "path" -> path.asInstanceOf[js.Any], - "port" -> port.asInstanceOf[js.Any], - "protocol" -> protocol.asInstanceOf[js.Any], - "readTimeout" -> readTimeout.asInstanceOf[js.Any], - "sslProtocols" -> sslProtocols.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudFrontCustomOrigin] - } -} - +@Factory @js.native trait CloudFrontS3Origin extends js.Object { var authMethod: String = js.native @@ -88,25 +56,7 @@ trait CloudFrontS3Origin extends js.Object { var region: String = js.native } -object CloudFrontS3Origin { - def apply( - authMethod: String, - customHeaders: CloudFrontHeaders, - domainName: String, - path: String, - region: String - ): CloudFrontS3Origin = { - val _obj$ = js.Dynamic.literal( - "authMethod" -> authMethod.asInstanceOf[js.Any], - "customHeaders" -> customHeaders.asInstanceOf[js.Any], - "domainName" -> domainName.asInstanceOf[js.Any], - "path" -> path.asInstanceOf[js.Any], - "region" -> region.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudFrontS3Origin] - } -} - +@Factory @js.native trait CloudFrontResponse extends js.Object { var status: String = js.native @@ -114,21 +64,7 @@ trait CloudFrontResponse extends js.Object { var headers: CloudFrontHeaders = js.native } -object CloudFrontResponse { - def apply( - status: String, - statusDescription: String, - headers: CloudFrontHeaders - ): CloudFrontResponse = { - val _obj$ = js.Dynamic.literal( - "status" -> status.asInstanceOf[js.Any], - "statusDescription" -> statusDescription.asInstanceOf[js.Any], - "headers" -> headers.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudFrontResponse] - } -} - +@Factory(false) @js.native trait CloudFrontRequest extends js.Object { var body: js.UndefOr[CloudFrontRequest.Body] = js.native @@ -141,27 +77,7 @@ trait CloudFrontRequest extends js.Object { } object CloudFrontRequest { - def apply( - clientIp: String, - method: String, - uri: String, - querystring: String, - headers: CloudFrontHeaders, - body: js.UndefOr[CloudFrontRequest.Body] = js.undefined, - origin: js.UndefOr[CloudFrontOrigin] = js.undefined - ): CloudFrontRequest = { - val _obj$ = js.Dynamic.literal( - "clientIp" -> clientIp.asInstanceOf[js.Any], - "method" -> method.asInstanceOf[js.Any], - "uri" -> uri.asInstanceOf[js.Any], - "querystring" -> querystring.asInstanceOf[js.Any], - "headers" -> headers.asInstanceOf[js.Any] - ) - body.foreach(_v => _obj$.updateDynamic("body")(_v.asInstanceOf[js.Any])) - origin.foreach(_v => _obj$.updateDynamic("origin")(_v.asInstanceOf[js.Any])) - _obj$.asInstanceOf[CloudFrontRequest] - } - + @Factory(false) @js.native trait Body extends js.Object { var action: String = js.native @@ -169,39 +85,16 @@ object CloudFrontRequest { var encoding: String = js.native def inputTruncated: Boolean = js.native } - - object Body { - def apply( - action: String, - data: String, - encoding: String, - inputTruncated: Boolean - ): Body = { - val _obj$ = js.Dynamic.literal( - "action" -> action.asInstanceOf[js.Any], - "data" -> data.asInstanceOf[js.Any], - "encoding" -> encoding.asInstanceOf[js.Any], - "inputTruncated" -> inputTruncated.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Body] - } - } } + +@Factory @js.native trait CloudFrontEvent extends js.Object { var config: CloudFrontEvent.Config = js.native } object CloudFrontEvent { - def apply( - config: CloudFrontEvent.Config - ): CloudFrontEvent = { - val _obj$ = js.Dynamic.literal( - "config" -> config.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudFrontEvent] - } - + @Factory(false) @js.native trait Config extends js.Object { var distributionDomainName: String = js.native @@ -209,25 +102,9 @@ object CloudFrontEvent { var eventType: String = js.native var requestId: String = js.native } - - object Config { - def apply( - distributionDomainName: String, - distributionId: String, - eventType: String, - requestId: String - ): Config = { - val _obj$ = js.Dynamic.literal( - "distributionDomainName" -> distributionDomainName.asInstanceOf[js.Any], - "distributionId" -> distributionId.asInstanceOf[js.Any], - "eventType" -> eventType.asInstanceOf[js.Any], - "requestId" -> requestId.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Config] - } - } } +@Factory @js.native trait CloudFrontResultResponse extends js.Object { var status: String = js.native @@ -236,28 +113,3 @@ trait CloudFrontResultResponse extends js.Object { var bodyEncoding: js.UndefOr[String] = js.native var body: js.UndefOr[String] = js.native } - -object CloudFrontResultResponse { - def apply( - status: String, - statusDescription: js.UndefOr[String] = js.undefined, - headers: js.UndefOr[CloudFrontHeaders] = js.undefined, - bodyEncoding: js.UndefOr[String] = js.undefined, - body: js.UndefOr[String] = js.undefined - ): CloudFrontResultResponse = { - val _obj$ = js.Dynamic.literal( - "status" -> status.asInstanceOf[js.Any] - ) - statusDescription.foreach(_v => - _obj$.updateDynamic("statusDescription")(_v.asInstanceOf[js.Any]) - ) - headers.foreach(_v => - _obj$.updateDynamic("headers")(_v.asInstanceOf[js.Any]) - ) - bodyEncoding.foreach(_v => - _obj$.updateDynamic("bodyEncoding")(_v.asInstanceOf[js.Any]) - ) - body.foreach(_v => _obj$.updateDynamic("body")(_v.asInstanceOf[js.Any])) - _obj$.asInstanceOf[CloudFrontResultResponse] - } -} diff --git a/src/main/scala/net/exoego/facade/aws_lambda/cloudfront_request.scala b/src/main/scala/net/exoego/facade/aws_lambda/cloudfront_request.scala index d137c0c..a8308ac 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/cloudfront_request.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/cloudfront_request.scala @@ -1,37 +1,17 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js +@Factory @js.native -trait CloudFrontRequestEventRecordItem extends CloudFrontEvent { +trait CloudFrontRequestEventRecordItem extends js.Object with CloudFrontEvent { var request: CloudFrontRequest = js.native } -object CloudFrontRequestEventRecordItem { - def apply( - config: CloudFrontEvent.Config, - requrest: CloudFrontRequest - ): CloudFrontRequestEventRecordItem = { - val _obj$ = js.Dynamic.literal( - "config" -> config.asInstanceOf[js.Any], - "requrest" -> requrest.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudFrontRequestEventRecordItem] - } -} - +@Factory @js.native trait CloudFrontRequestEvent extends js.Object { var Records: js.Array[CloudFrontRequestEventRecordItem] = js.native } - -object CloudFrontRequestEvent { - def apply( - Records: js.Array[CloudFrontRequestEventRecordItem] - ): CloudFrontRequestEvent = { - val _obj$ = js.Dynamic.literal( - "Records" -> Records.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudFrontRequestEvent] - } -} diff --git a/src/main/scala/net/exoego/facade/aws_lambda/cloudfront_response.scala b/src/main/scala/net/exoego/facade/aws_lambda/cloudfront_response.scala index 9684594..d972fea 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/cloudfront_response.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/cloudfront_response.scala @@ -1,7 +1,10 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js +@Factory @js.native trait CloudFrontResponseEventRecordItem extends js.Object { var config: CloudFrontEvent.Config = js.native @@ -9,33 +12,8 @@ trait CloudFrontResponseEventRecordItem extends js.Object { var response: CloudFrontResponse = js.native } -object CloudFrontResponseEventRecordItem { - def apply( - config: CloudFrontEvent.Config, - request: CloudFrontRequest, - response: CloudFrontResponse - ): CloudFrontResponseEventRecordItem = { - val _obj$ = js.Dynamic.literal( - "config" -> config.asInstanceOf[js.Any], - "request" -> request.asInstanceOf[js.Any], - "response" -> response.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudFrontResponseEventRecordItem] - } -} - +@Factory @js.native trait CloudFrontResponseEvent extends js.Object { var Records: js.Array[CloudFrontResponseEventRecordItem] = js.native } - -object CloudFrontResponseEvent { - def apply( - Records: js.Array[js.Any] - ): CloudFrontResponseEvent = { - val _obj$ = js.Dynamic.literal( - "Records" -> Records.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudFrontResponseEvent] - } -} diff --git a/src/main/scala/net/exoego/facade/aws_lambda/cloudwatch_logs.scala b/src/main/scala/net/exoego/facade/aws_lambda/cloudwatch_logs.scala index 93efb60..4a729a1 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/cloudwatch_logs.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/cloudwatch_logs.scala @@ -1,39 +1,22 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js +@Factory @js.native trait CloudWatchLogsEvent extends js.Object { var awslogs: CloudWatchLogsEventData = js.native } -object CloudWatchLogsEvent { - def apply( - awslogs: CloudWatchLogsEventData - ): CloudWatchLogsEvent = { - val _obj$ = js.Dynamic.literal( - "awslogs" -> awslogs.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudWatchLogsEvent] - } -} - +@Factory @js.native trait CloudWatchLogsEventData extends js.Object { var data: String = js.native } -object CloudWatchLogsEventData { - def apply( - data: String - ): CloudWatchLogsEventData = { - val _obj$ = js.Dynamic.literal( - "data" -> data.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudWatchLogsEventData] - } -} - +@Factory @js.native trait CloudWatchLogsDecodedData extends js.Object { var owner: String = js.native @@ -44,27 +27,7 @@ trait CloudWatchLogsDecodedData extends js.Object { var logEvents: js.Array[CloudWatchLogsLogEvent] = js.native } -object CloudWatchLogsDecodedData { - def apply( - owner: String, - logGroup: String, - logStream: String, - subscriptionFilters: js.Array[String], - messageType: String, - logEvents: js.Array[CloudWatchLogsLogEvent] - ): CloudWatchLogsDecodedData = { - val _obj$ = js.Dynamic.literal( - "owner" -> owner.asInstanceOf[js.Any], - "logGroup" -> logGroup.asInstanceOf[js.Any], - "logStream" -> logStream.asInstanceOf[js.Any], - "subscriptionFilters" -> subscriptionFilters.asInstanceOf[js.Any], - "messageType" -> messageType.asInstanceOf[js.Any], - "logEvents" -> logEvents.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CloudWatchLogsDecodedData] - } -} - +@Factory @js.native trait CloudWatchLogsLogEvent extends js.Object { var id: String = js.native @@ -75,22 +38,5 @@ trait CloudWatchLogsLogEvent extends js.Object { } object CloudWatchLogsLogEvent { - def apply( - id: String, - timestamp: Double, - message: String, - extractedFields: js.UndefOr[CloudWatchLogsLogEvent.ExtractedFields] = - js.undefined - ): CloudWatchLogsLogEvent = { - val _obj$ = js.Dynamic.literal( - "id" -> id.asInstanceOf[js.Any], - "timestamp" -> timestamp.asInstanceOf[js.Any], - "message" -> message.asInstanceOf[js.Any] - ) - extractedFields.foreach(_v => - _obj$.updateDynamic("extractedFields")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[CloudWatchLogsLogEvent] - } type ExtractedFields = js.Dictionary[String] } diff --git a/src/main/scala/net/exoego/facade/aws_lambda/codepipeline.scala b/src/main/scala/net/exoego/facade/aws_lambda/codepipeline.scala index 530f33e..6c0a91a 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/codepipeline.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/codepipeline.scala @@ -1,45 +1,25 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js import scala.scalajs.js.| +@Factory @js.native trait S3ArtifactLocation extends js.Object { var bucketName: String = js.native var objectKey: String = js.native } -object S3ArtifactLocation { - def apply( - bucketName: String, - objectKey: String - ): S3ArtifactLocation = { - val _obj$ = js.Dynamic.literal( - "bucketName" -> bucketName.asInstanceOf[js.Any], - "objectKey" -> objectKey.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[S3ArtifactLocation] - } -} - +@Factory @js.native trait S3ArtifactStore extends js.Object { var `type`: String = js.native var s3Location: S3ArtifactLocation = js.native } -object S3ArtifactStore { - def apply( - `type`: String, - s3Location: S3ArtifactLocation - ): S3ArtifactStore = { - val _obj$ = js.Dynamic.literal( - "type" -> `type`.asInstanceOf[js.Any], - "s3Location" -> s3Location.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[S3ArtifactStore] - } -} +@Factory @js.native trait Artifact extends js.Object { var name: String = js.native @@ -47,21 +27,7 @@ trait Artifact extends js.Object { var location: ArtifactLocation = js.native } -object Artifact { - def apply( - name: String, - location: ArtifactLocation, - revision: String | Null = null - ): Artifact = { - val _obj$ = js.Dynamic.literal( - "name" -> name.asInstanceOf[js.Any], - "revision" -> revision.asInstanceOf[js.Any], - "location" -> location.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Artifact] - } -} - +@Factory @js.native trait Credentials extends js.Object { var accessKeyId: String = js.native @@ -69,57 +35,21 @@ trait Credentials extends js.Object { var sessionToken: js.UndefOr[String] = js.native } -object Credentials { - def apply( - accessKeyId: String, - secretAccessKey: String, - sessionToken: js.UndefOr[String] = js.undefined - ): Credentials = { - val _obj$ = js.Dynamic.literal( - "accessKeyId" -> accessKeyId.asInstanceOf[js.Any], - "secretAccessKey" -> secretAccessKey.asInstanceOf[js.Any] - ) - sessionToken.foreach(_v => - _obj$.updateDynamic("sessionToken")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[Credentials] - } -} - +@Factory @js.native trait EncryptionKey extends js.Object { var `type`: String = js.native var id: String = js.native } -object EncryptionKey { - def apply( - `type`: String, - id: String - ): EncryptionKey = { - val _obj$ = js.Dynamic.literal( - "type" -> `type`.asInstanceOf[js.Any], - "id" -> id.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[EncryptionKey] - } -} - +@Factory(false) @js.native trait CodePipelineEvent extends js.Object { var `CodePipeline.job`: CodePipelineEvent.`CodePipeline.job` = js.native } object CodePipelineEvent { - def apply( - `CodePipeline.job`: CodePipelineEvent.`CodePipeline.job` - ): CodePipelineEvent = { - val _obj$ = js.Dynamic.literal( - "CodePipeline.job" -> `CodePipeline.job`.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CodePipelineEvent] - } - + @Factory(false) @js.native trait `CodePipeline.job` extends js.Object { var id: String = js.native @@ -128,19 +58,7 @@ object CodePipelineEvent { } object `CodePipeline.job` { - def apply( - id: String, - accountId: String, - data: `CodePipeline.job`.Data - ): `CodePipeline.job` = { - val _obj$ = js.Dynamic.literal( - "id" -> id.asInstanceOf[js.Any], - "accountId" -> accountId.asInstanceOf[js.Any], - "data" -> data.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[`CodePipeline.job`] - } - + @Factory(false) @js.native trait Data extends js.Object { var actionConfiguration: Data.ActionConfiguration = js.native @@ -152,62 +70,19 @@ object CodePipelineEvent { } object Data { - def apply( - actionConfiguration: Data.ActionConfiguration, - inputArtifacts: js.Array[Artifact], - outputArtifacts: js.Array[Artifact], - artifactCredentials: Credentials, - encryptionKey: js.UndefOr[EncryptionKey with js.Any] = js.undefined, - continuationToken: js.UndefOr[String] = js.undefined - ): Data = { - val _obj$ = js.Dynamic.literal( - "actionConfiguration" -> actionConfiguration.asInstanceOf[js.Any], - "inputArtifacts" -> inputArtifacts.asInstanceOf[js.Any], - "outputArtifacts" -> outputArtifacts.asInstanceOf[js.Any], - "artifactCredentials" -> artifactCredentials.asInstanceOf[js.Any] - ) - encryptionKey.foreach(_v => - _obj$.updateDynamic("encryptionKey")(_v.asInstanceOf[js.Any]) - ) - continuationToken.foreach(_v => - _obj$.updateDynamic("continuationToken")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[Data] - } - + @Factory(false) @js.native trait ActionConfiguration extends js.Object { var configuration: ActionConfiguration.Configuration = js.native } object ActionConfiguration { - def apply( - configuration: ActionConfiguration.Configuration - ): ActionConfiguration = { - val _obj$ = js.Dynamic.literal( - "configuration" -> configuration.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[ActionConfiguration] - } - + @Factory(false) @js.native trait Configuration extends js.Object { var FunctionName: String = js.native var UserParameters: String = js.native } - - object Configuration { - def apply( - FunctionName: String, - UserParameters: String - ): Configuration = { - val _obj$ = js.Dynamic.literal( - "FunctionName" -> FunctionName.asInstanceOf[js.Any], - "UserParameters" -> UserParameters.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Configuration] - } - } } } } diff --git a/src/main/scala/net/exoego/facade/aws_lambda/codepipeline_cloudwatch_laction.scala b/src/main/scala/net/exoego/facade/aws_lambda/codepipeline_cloudwatch_laction.scala index e83af24..1500620 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/codepipeline_cloudwatch_laction.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/codepipeline_cloudwatch_laction.scala @@ -1,7 +1,10 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js +@Factory @js.native trait CodePipelineCloudWatchActionEvent extends js.Object { var version: String = js.native @@ -16,31 +19,7 @@ trait CodePipelineCloudWatchActionEvent extends js.Object { } object CodePipelineCloudWatchActionEvent { - def apply( - version: String, - id: String, - `detail-type`: String, - source: String, - account: String, - time: String, - region: String, - resources: js.Array[String], - detail: CodePipelineCloudWatchActionEvent.Detail - ): CodePipelineCloudWatchActionEvent = { - val _obj$ = js.Dynamic.literal( - "version" -> version.asInstanceOf[js.Any], - "id" -> id.asInstanceOf[js.Any], - "detail-type" -> `detail-type`.asInstanceOf[js.Any], - "source" -> source.asInstanceOf[js.Any], - "account" -> account.asInstanceOf[js.Any], - "time" -> time.asInstanceOf[js.Any], - "region" -> region.asInstanceOf[js.Any], - "resources" -> resources.asInstanceOf[js.Any], - "detail" -> detail.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CodePipelineCloudWatchActionEvent] - } - + @Factory(false) @js.native trait Detail extends js.Object { var pipeline: String = js.native @@ -53,27 +32,7 @@ object CodePipelineCloudWatchActionEvent { } object Detail { - def apply( - pipeline: String, - version: Double, - `execution-id`: String, - stage: String, - action: String, - state: CodePipelineActionState, - `type`: Detail.Type - ): Detail = { - val _obj$ = js.Dynamic.literal( - "pipeline" -> pipeline.asInstanceOf[js.Any], - "version" -> version.asInstanceOf[js.Any], - "execution-id" -> `execution-id`.asInstanceOf[js.Any], - "stage" -> stage.asInstanceOf[js.Any], - "action" -> action.asInstanceOf[js.Any], - "state" -> state.asInstanceOf[js.Any], - "type" -> `type`.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Detail] - } - + @Factory(false) @js.native trait Type extends js.Object { var owner: String = js.native @@ -81,22 +40,5 @@ object CodePipelineCloudWatchActionEvent { var provider: String = js.native var version: Double = js.native } - - object Type { - def apply( - owner: String, - category: CodePipelineActionCategory, - provider: String, - version: Double - ): Type = { - val _obj$ = js.Dynamic.literal( - "owner" -> owner.asInstanceOf[js.Any], - "category" -> category.asInstanceOf[js.Any], - "provider" -> provider.asInstanceOf[js.Any], - "version" -> version.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Type] - } - } } } diff --git a/src/main/scala/net/exoego/facade/aws_lambda/codepipeline_cloudwatch_pipeline.scala b/src/main/scala/net/exoego/facade/aws_lambda/codepipeline_cloudwatch_pipeline.scala index 109962c..c8b4b79 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/codepipeline_cloudwatch_pipeline.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/codepipeline_cloudwatch_pipeline.scala @@ -1,7 +1,10 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js +@Factory @js.native trait CodePipelineCloudWatchPipelineEvent extends js.Object { var version: String = js.native @@ -16,31 +19,7 @@ trait CodePipelineCloudWatchPipelineEvent extends js.Object { } object CodePipelineCloudWatchPipelineEvent { - def apply( - version: String, - id: String, - `detail-type`: String, - source: String, - account: String, - time: String, - region: String, - resources: js.Array[String], - detail: CodePipelineCloudWatchPipelineEvent.Detail - ): CodePipelineCloudWatchPipelineEvent = { - val _obj$ = js.Dynamic.literal( - "version" -> version.asInstanceOf[js.Any], - "id" -> id.asInstanceOf[js.Any], - "detail-type" -> `detail-type`.asInstanceOf[js.Any], - "source" -> source.asInstanceOf[js.Any], - "account" -> account.asInstanceOf[js.Any], - "time" -> time.asInstanceOf[js.Any], - "region" -> region.asInstanceOf[js.Any], - "resources" -> resources.asInstanceOf[js.Any], - "detail" -> detail.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CodePipelineCloudWatchPipelineEvent] - } - + @Factory(false) @js.native trait Detail extends js.Object { var pipeline: String = js.native @@ -48,21 +27,4 @@ object CodePipelineCloudWatchPipelineEvent { var state: CodePipelineState = js.native var `execution-id`: String = js.native } - - object Detail { - def apply( - pipeline: String, - version: Double, - state: CodePipelineState, - `execution-id`: String - ): Detail = { - val _obj$ = js.Dynamic.literal( - "pipeline" -> pipeline.asInstanceOf[js.Any], - "version" -> version.asInstanceOf[js.Any], - "state" -> state.asInstanceOf[js.Any], - "execution-id" -> `execution-id`.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Detail] - } - } } diff --git a/src/main/scala/net/exoego/facade/aws_lambda/codepipeline_cloudwatch_stage.scala b/src/main/scala/net/exoego/facade/aws_lambda/codepipeline_cloudwatch_stage.scala index 918a0f9..7aa5e4c 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/codepipeline_cloudwatch_stage.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/codepipeline_cloudwatch_stage.scala @@ -1,7 +1,10 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js +@Factory @js.native trait CodePipelineCloudWatchStageEvent extends js.Object { var version: String = js.native @@ -16,31 +19,7 @@ trait CodePipelineCloudWatchStageEvent extends js.Object { } object CodePipelineCloudWatchStageEvent { - def apply( - version: String, - id: String, - `detail-type`: String, - source: String, - account: String, - time: String, - region: String, - resources: js.Array[String], - detail: CodePipelineCloudWatchStageEvent.Detail - ): CodePipelineCloudWatchStageEvent = { - val _obj$ = js.Dynamic.literal( - "version" -> version.asInstanceOf[js.Any], - "id" -> id.asInstanceOf[js.Any], - "detail-type" -> `detail-type`.asInstanceOf[js.Any], - "source" -> source.asInstanceOf[js.Any], - "account" -> account.asInstanceOf[js.Any], - "time" -> time.asInstanceOf[js.Any], - "region" -> region.asInstanceOf[js.Any], - "resources" -> resources.asInstanceOf[js.Any], - "detail" -> detail.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CodePipelineCloudWatchStageEvent] - } - + @Factory(false) @js.native trait Detail extends js.Object { var pipeline: String = js.native @@ -49,23 +28,4 @@ object CodePipelineCloudWatchStageEvent { var stage: String = js.native var state: CodePipelineStageState = js.native } - - object Detail { - def apply( - pipeline: String, - version: Double, - `execution-id`: String, - stage: String, - state: CodePipelineStageState - ): Detail = { - val _obj$ = js.Dynamic.literal( - "pipeline" -> pipeline.asInstanceOf[js.Any], - "version" -> version.asInstanceOf[js.Any], - "execution-id" -> `execution-id`.asInstanceOf[js.Any], - "stage" -> stage.asInstanceOf[js.Any], - "state" -> state.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Detail] - } - } } diff --git a/src/main/scala/net/exoego/facade/aws_lambda/cognito_userpool.scala b/src/main/scala/net/exoego/facade/aws_lambda/cognito_userpool.scala index 46303df..e3499fb 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/cognito_userpool.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/cognito_userpool.scala @@ -1,8 +1,11 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js import scala.scalajs.js.| +@Factory @js.native trait CognitoUserPoolTriggerEvent extends js.Object { var version: Double = js.native @@ -16,50 +19,14 @@ trait CognitoUserPoolTriggerEvent extends js.Object { } object CognitoUserPoolTriggerEvent { - def apply( - version: Double, - triggerSource: String, - region: String, - userPoolId: String, - callerContext: CognitoUserPoolTriggerEvent.CallerContext, - request: CognitoUserPoolTriggerEvent.Request, - response: CognitoUserPoolTriggerEvent.Response, - userName: js.UndefOr[String] = js.undefined - ): CognitoUserPoolTriggerEvent = { - val _obj$ = js.Dynamic.literal( - "version" -> version.asInstanceOf[js.Any], - "triggerSource" -> triggerSource.asInstanceOf[js.Any], - "region" -> region.asInstanceOf[js.Any], - "userPoolId" -> userPoolId.asInstanceOf[js.Any], - "callerContext" -> callerContext.asInstanceOf[js.Any], - "request" -> request.asInstanceOf[js.Any], - "response" -> response.asInstanceOf[js.Any] - ) - userName.foreach(_v => - _obj$.updateDynamic("userName")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[CognitoUserPoolTriggerEvent] - } - + @Factory(false) @js.native trait CallerContext extends js.Object { var awsSdkVersion: String = js.native var clientId: String = js.native } - object CallerContext { - def apply( - awsSdkVersion: String, - clientId: String - ): CallerContext = { - val _obj$ = js.Dynamic.literal( - "awsSdkVersion" -> awsSdkVersion.asInstanceOf[js.Any], - "clientId" -> clientId.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CallerContext] - } - } - + @Factory(false) @js.native trait Request extends js.Object { var userAttributes: Request.UserAttributes = js.native @@ -79,72 +46,13 @@ object CognitoUserPoolTriggerEvent { } object Request { - def apply( - userAttributes: Request.UserAttributes, - validationData: js.UndefOr[Request.ValidationData] = js.undefined, - codeParameter: js.UndefOr[String] = js.undefined, - linkParameter: js.UndefOr[String] = js.undefined, - usernameParameter: js.UndefOr[String] = js.undefined, - newDeviceUsed: js.UndefOr[Boolean] = js.undefined, - session: js.UndefOr[js.Array[js.Any]] = js.undefined, - challengeName: js.UndefOr[String] = js.undefined, - privateChallengeParameters: js.UndefOr[ - Request.PrivateChallengeParameters - ] = js.undefined, - challengeAnswer: js.UndefOr[String] = js.undefined, - password: js.UndefOr[String] = js.undefined, - clientMetadata: js.UndefOr[Request.ClientMetadata] = js.undefined, - userNotFound: js.UndefOr[Boolean] = js.undefined - ): Request = { - val _obj$ = js.Dynamic.literal( - "userAttributes" -> userAttributes.asInstanceOf[js.Any] - ) - validationData.foreach(_v => - _obj$.updateDynamic("validationData")(_v.asInstanceOf[js.Any]) - ) - codeParameter.foreach(_v => - _obj$.updateDynamic("codeParameter")(_v.asInstanceOf[js.Any]) - ) - linkParameter.foreach(_v => - _obj$.updateDynamic("linkParameter")(_v.asInstanceOf[js.Any]) - ) - usernameParameter.foreach(_v => - _obj$.updateDynamic("usernameParameter")(_v.asInstanceOf[js.Any]) - ) - newDeviceUsed.foreach(_v => - _obj$.updateDynamic("newDeviceUsed")(_v.asInstanceOf[js.Any]) - ) - session.foreach(_v => - _obj$.updateDynamic("session")(_v.asInstanceOf[js.Any]) - ) - challengeName.foreach(_v => - _obj$.updateDynamic("challengeName")(_v.asInstanceOf[js.Any]) - ) - privateChallengeParameters.foreach(_v => - _obj$.updateDynamic("privateChallengeParameters")( - _v.asInstanceOf[js.Any] - ) - ) - challengeAnswer.foreach(_v => - _obj$.updateDynamic("challengeAnswer")(_v.asInstanceOf[js.Any]) - ) - password.foreach(_v => - _obj$.updateDynamic("password")(_v.asInstanceOf[js.Any]) - ) - clientMetadata.foreach(_v => - _obj$.updateDynamic("clientMetadata")(_v.asInstanceOf[js.Any]) - ) - userNotFound.foreach(_v => - _obj$.updateDynamic("userNotFound")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[Request] - } type UserAttributes = js.Dictionary[String] type ValidationData = js.Dictionary[String] type PrivateChallengeParameters = js.Dictionary[String] type ClientMetadata = js.Dictionary[String] } + @Factory(false) @js.native trait Response extends js.Object { var autoConfirmUser: js.UndefOr[Boolean] = js.native @@ -172,101 +80,11 @@ object CognitoUserPoolTriggerEvent { } object Response { - def apply( - autoConfirmUser: js.UndefOr[Boolean] = js.undefined, - autoVerifyPhone: js.UndefOr[Boolean] = js.undefined, - autoVerifyEmail: js.UndefOr[Boolean] = js.undefined, - smsMessage: js.UndefOr[String] = js.undefined, - emailMessage: js.UndefOr[String] = js.undefined, - emailSubject: js.UndefOr[String] = js.undefined, - challengeName: js.UndefOr[String] = js.undefined, - issueTokens: js.UndefOr[Boolean] = js.undefined, - failAuthentication: js.UndefOr[Boolean] = js.undefined, - publicChallengeParameters: js.UndefOr[ - Response.PublicChallengeParameters - ] = js.undefined, - privateChallengeParameters: js.UndefOr[ - Response.PrivateChallengeParameters - ] = js.undefined, - challengeMetadata: js.UndefOr[String] = js.undefined, - answerCorrect: js.UndefOr[Boolean] = js.undefined, - userAttributes: js.UndefOr[Response.UserAttributes] = js.undefined, - finalUserStatus: js.UndefOr[String] = js.undefined, - messageAction: js.UndefOr[String] = js.undefined, - desiredDeliveryMediums: js.UndefOr[js.Array[String]] = js.undefined, - forceAliasCreation: js.UndefOr[Boolean] = js.undefined, - claimsOverrideDetails: js.UndefOr[Response.ClaimsOverrideDetails] = - js.undefined - ): Response = { - val _obj$ = js.Dynamic.literal( - ) - autoConfirmUser.foreach(_v => - _obj$.updateDynamic("autoConfirmUser")(_v.asInstanceOf[js.Any]) - ) - autoVerifyPhone.foreach(_v => - _obj$.updateDynamic("autoVerifyPhone")(_v.asInstanceOf[js.Any]) - ) - autoVerifyEmail.foreach(_v => - _obj$.updateDynamic("autoVerifyEmail")(_v.asInstanceOf[js.Any]) - ) - smsMessage.foreach(_v => - _obj$.updateDynamic("smsMessage")(_v.asInstanceOf[js.Any]) - ) - emailMessage.foreach(_v => - _obj$.updateDynamic("emailMessage")(_v.asInstanceOf[js.Any]) - ) - emailSubject.foreach(_v => - _obj$.updateDynamic("emailSubject")(_v.asInstanceOf[js.Any]) - ) - challengeName.foreach(_v => - _obj$.updateDynamic("challengeName")(_v.asInstanceOf[js.Any]) - ) - issueTokens.foreach(_v => - _obj$.updateDynamic("issueTokens")(_v.asInstanceOf[js.Any]) - ) - failAuthentication.foreach(_v => - _obj$.updateDynamic("failAuthentication")(_v.asInstanceOf[js.Any]) - ) - publicChallengeParameters.foreach(_v => - _obj$.updateDynamic("publicChallengeParameters")( - _v.asInstanceOf[js.Any] - ) - ) - privateChallengeParameters.foreach(_v => - _obj$.updateDynamic("privateChallengeParameters")( - _v.asInstanceOf[js.Any] - ) - ) - challengeMetadata.foreach(_v => - _obj$.updateDynamic("challengeMetadata")(_v.asInstanceOf[js.Any]) - ) - answerCorrect.foreach(_v => - _obj$.updateDynamic("answerCorrect")(_v.asInstanceOf[js.Any]) - ) - userAttributes.foreach(_v => - _obj$.updateDynamic("userAttributes")(_v.asInstanceOf[js.Any]) - ) - finalUserStatus.foreach(_v => - _obj$.updateDynamic("finalUserStatus")(_v.asInstanceOf[js.Any]) - ) - messageAction.foreach(_v => - _obj$.updateDynamic("messageAction")(_v.asInstanceOf[js.Any]) - ) - desiredDeliveryMediums.foreach(_v => - _obj$.updateDynamic("desiredDeliveryMediums")(_v.asInstanceOf[js.Any]) - ) - forceAliasCreation.foreach(_v => - _obj$.updateDynamic("forceAliasCreation")(_v.asInstanceOf[js.Any]) - ) - claimsOverrideDetails.foreach(_v => - _obj$.updateDynamic("claimsOverrideDetails")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[Response] - } type PublicChallengeParameters = js.Dictionary[String] type PrivateChallengeParameters = js.Dictionary[String] type UserAttributes = js.Dictionary[String] + @Factory(false) @js.native trait ClaimsOverrideDetails extends js.Object { var claimsToAddOrOverride @@ -276,27 +94,6 @@ object CognitoUserPoolTriggerEvent { } object ClaimsOverrideDetails { - def apply( - claimsToAddOrOverride: js.UndefOr[ - ClaimsOverrideDetails.ClaimsToAddOrOverride - ] = js.undefined, - claimsToSuppress: js.UndefOr[js.Array[String]] = js.undefined, - groupOverrideDetails: js.UndefOr[Null | js.Any] = js.undefined - ): ClaimsOverrideDetails = { - val _obj$ = js.Dynamic.literal( - ) - claimsToAddOrOverride.foreach(_v => - _obj$.updateDynamic("claimsToAddOrOverride")(_v.asInstanceOf[js.Any]) - ) - claimsToSuppress.foreach(_v => - _obj$.updateDynamic("claimsToSuppress")(_v.asInstanceOf[js.Any]) - ) - groupOverrideDetails.foreach(_v => - _obj$.updateDynamic("groupOverrideDetails")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[ClaimsOverrideDetails] - } - type ClaimsToAddOrOverride = js.Dictionary[String] } } diff --git a/src/main/scala/net/exoego/facade/aws_lambda/dynamodb_stream.scala b/src/main/scala/net/exoego/facade/aws_lambda/dynamodb_stream.scala index 61eb116..1995170 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/dynamodb_stream.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/dynamodb_stream.scala @@ -1,7 +1,10 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js +@Factory @js.native trait StreamRecord extends js.Object { var ApproximateCreationDateTime: js.UndefOr[Double] = js.native @@ -14,45 +17,12 @@ trait StreamRecord extends js.Object { } object StreamRecord { - def apply( - ApproximateCreationDateTime: js.UndefOr[Double] = js.undefined, - Keys: js.UndefOr[StreamRecord.Keys] = js.undefined, - NewImage: js.UndefOr[StreamRecord.NewImage] = js.undefined, - OldImage: js.UndefOr[StreamRecord.OldImage] = js.undefined, - SequenceNumber: js.UndefOr[String] = js.undefined, - SizeBytes: js.UndefOr[Double] = js.undefined, - StreamViewType: js.UndefOr[String] = js.undefined - ): StreamRecord = { - val _obj$ = js.Dynamic.literal( - ) - ApproximateCreationDateTime.foreach(_v => - _obj$.updateDynamic("ApproximateCreationDateTime")( - _v.asInstanceOf[js.Any] - ) - ) - Keys.foreach(_v => _obj$.updateDynamic("Keys")(_v.asInstanceOf[js.Any])) - NewImage.foreach(_v => - _obj$.updateDynamic("NewImage")(_v.asInstanceOf[js.Any]) - ) - OldImage.foreach(_v => - _obj$.updateDynamic("OldImage")(_v.asInstanceOf[js.Any]) - ) - SequenceNumber.foreach(_v => - _obj$.updateDynamic("SequenceNumber")(_v.asInstanceOf[js.Any]) - ) - SizeBytes.foreach(_v => - _obj$.updateDynamic("SizeBytes")(_v.asInstanceOf[js.Any]) - ) - StreamViewType.foreach(_v => - _obj$.updateDynamic("StreamViewType")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[StreamRecord] - } type Keys = js.Dictionary[AttributeValue] type NewImage = js.Dictionary[AttributeValue] type OldImage = js.Dictionary[AttributeValue] } +@Factory @js.native trait DynamoDBRecord extends js.Object { var awsRegion: js.UndefOr[String] = js.native @@ -65,59 +35,8 @@ trait DynamoDBRecord extends js.Object { var userIdentity: js.UndefOr[js.Any] = js.native } -object DynamoDBRecord { - def apply( - awsRegion: js.UndefOr[String] = js.undefined, - dynamodb: js.UndefOr[StreamRecord] = js.undefined, - eventID: js.UndefOr[String] = js.undefined, - eventName: js.UndefOr[String] = js.undefined, - eventSource: js.UndefOr[String] = js.undefined, - eventSourceARN: js.UndefOr[String] = js.undefined, - eventVersion: js.UndefOr[String] = js.undefined, - userIdentity: js.UndefOr[js.Any] = js.undefined - ): DynamoDBRecord = { - val _obj$ = js.Dynamic.literal( - ) - awsRegion.foreach(_v => - _obj$.updateDynamic("awsRegion")(_v.asInstanceOf[js.Any]) - ) - dynamodb.foreach(_v => - _obj$.updateDynamic("dynamodb")(_v.asInstanceOf[js.Any]) - ) - eventID.foreach(_v => - _obj$.updateDynamic("eventID")(_v.asInstanceOf[js.Any]) - ) - eventName.foreach(_v => - _obj$.updateDynamic("eventName")(_v.asInstanceOf[js.Any]) - ) - eventSource.foreach(_v => - _obj$.updateDynamic("eventSource")(_v.asInstanceOf[js.Any]) - ) - eventSourceARN.foreach(_v => - _obj$.updateDynamic("eventSourceARN")(_v.asInstanceOf[js.Any]) - ) - eventVersion.foreach(_v => - _obj$.updateDynamic("eventVersion")(_v.asInstanceOf[js.Any]) - ) - userIdentity.foreach(_v => - _obj$.updateDynamic("userIdentity")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[DynamoDBRecord] - } -} - +@Factory @js.native trait DynamoDBStreamEvent extends js.Object { var Records: js.Array[DynamoDBRecord] = js.native } - -object DynamoDBStreamEvent { - def apply( - Records: js.Array[DynamoDBRecord] - ): DynamoDBStreamEvent = { - val _obj$ = js.Dynamic.literal( - "Records" -> Records.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[DynamoDBStreamEvent] - } -} diff --git a/src/main/scala/net/exoego/facade/aws_lambda/kinesis_firehose_transformation.scala b/src/main/scala/net/exoego/facade/aws_lambda/kinesis_firehose_transformation.scala index 631259a..dd31dd4 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/kinesis_firehose_transformation.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/kinesis_firehose_transformation.scala @@ -1,7 +1,10 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js +@Factory @js.native trait FirehoseTransformationEvent extends js.Object { var invocationId: String = js.native @@ -10,23 +13,7 @@ trait FirehoseTransformationEvent extends js.Object { var records: js.Array[FirehoseTransformationEventRecord] = js.native } -object FirehoseTransformationEvent { - def apply( - invocationId: String, - deliveryStreamArn: String, - region: String, - records: js.Array[FirehoseTransformationEventRecord] - ): FirehoseTransformationEvent = { - val _obj$ = js.Dynamic.literal( - "invocationId" -> invocationId.asInstanceOf[js.Any], - "deliveryStreamArn" -> deliveryStreamArn.asInstanceOf[js.Any], - "region" -> region.asInstanceOf[js.Any], - "records" -> records.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[FirehoseTransformationEvent] - } -} - +@Factory @js.native trait FirehoseTransformationEventRecord extends js.Object { var recordId: String = js.native @@ -35,26 +22,7 @@ trait FirehoseTransformationEventRecord extends js.Object { var kinesisRecordMetadata: js.UndefOr[FirehoseRecordMetadata] = js.native } -object FirehoseTransformationEventRecord { - def apply( - recordId: String, - approximateArrivalTimestamp: Double, - data: String, - kinesisRecordMetadata: js.UndefOr[FirehoseRecordMetadata] = js.undefined - ): FirehoseTransformationEventRecord = { - val _obj$ = js.Dynamic.literal( - "recordId" -> recordId.asInstanceOf[js.Any], - "approximateArrivalTimestamp" -> approximateArrivalTimestamp - .asInstanceOf[js.Any], - "data" -> data.asInstanceOf[js.Any] - ) - kinesisRecordMetadata.foreach(_v => - _obj$.updateDynamic("kinesisRecordMetadata")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[FirehoseTransformationEventRecord] - } -} - +@Factory @js.native trait FirehoseRecordMetadata extends js.Object { var shardId: String = js.native @@ -64,26 +32,7 @@ trait FirehoseRecordMetadata extends js.Object { var subsequenceNumber: String = js.native } -object FirehoseRecordMetadata { - def apply( - shardId: String, - partitionKey: String, - approximateArrivalTimestamp: Double, - sequenceNumber: String, - subsequenceNumber: String - ): FirehoseRecordMetadata = { - val _obj$ = js.Dynamic.literal( - "shardId" -> shardId.asInstanceOf[js.Any], - "partitionKey" -> partitionKey.asInstanceOf[js.Any], - "approximateArrivalTimestamp" -> approximateArrivalTimestamp - .asInstanceOf[js.Any], - "sequenceNumber" -> sequenceNumber.asInstanceOf[js.Any], - "subsequenceNumber" -> subsequenceNumber.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[FirehoseRecordMetadata] - } -} - +@Factory @js.native trait FirehoseTransformationResultRecord extends js.Object { var recordId: String = js.native @@ -91,33 +40,8 @@ trait FirehoseTransformationResultRecord extends js.Object { var data: String = js.native } -object FirehoseTransformationResultRecord { - def apply( - recordId: String, - result: FirehoseRecordTransformationStatus, - data: String - ): FirehoseTransformationResultRecord = { - val _obj$ = js.Dynamic.literal( - "recordId" -> recordId.asInstanceOf[js.Any], - "result" -> result.asInstanceOf[js.Any], - "data" -> data.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[FirehoseTransformationResultRecord] - } -} - +@Factory @js.native trait FirehoseTransformationResult extends js.Object { var records: js.Array[FirehoseTransformationResultRecord] = js.native } - -object FirehoseTransformationResult { - def apply( - records: js.Array[FirehoseTransformationResultRecord] - ): FirehoseTransformationResult = { - val _obj$ = js.Dynamic.literal( - "records" -> records.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[FirehoseTransformationResult] - } -} diff --git a/src/main/scala/net/exoego/facade/aws_lambda/kinesis_stream.scala b/src/main/scala/net/exoego/facade/aws_lambda/kinesis_stream.scala index 732da45..4dc75b3 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/kinesis_stream.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/kinesis_stream.scala @@ -1,7 +1,10 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js +@Factory @js.native trait KinesisStreamRecordPayload extends js.Object { var approximateArrivalTimestamp: Double = js.native @@ -11,26 +14,7 @@ trait KinesisStreamRecordPayload extends js.Object { var sequenceNumber: String = js.native } -object KinesisStreamRecordPayload { - def apply( - approximateArrivalTimestamp: Double, - data: String, - kinesisSchemaVersion: String, - partitionKey: String, - sequenceNumber: String - ): KinesisStreamRecordPayload = { - val _obj$ = js.Dynamic.literal( - "approximateArrivalTimestamp" -> approximateArrivalTimestamp - .asInstanceOf[js.Any], - "data" -> data.asInstanceOf[js.Any], - "kinesisSchemaVersion" -> kinesisSchemaVersion.asInstanceOf[js.Any], - "partitionKey" -> partitionKey.asInstanceOf[js.Any], - "sequenceNumber" -> sequenceNumber.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[KinesisStreamRecordPayload] - } -} - +@Factory @js.native trait KinesisStreamRecord extends js.Object { var awsRegion: String = js.native @@ -43,43 +27,8 @@ trait KinesisStreamRecord extends js.Object { var kinesis: KinesisStreamRecordPayload = js.native } -object KinesisStreamRecord { - def apply( - awsRegion: String, - eventID: String, - eventName: String, - eventSource: String, - eventSourceARN: String, - eventVersion: String, - invokeIdentityArn: String, - kinesis: KinesisStreamRecordPayload - ): KinesisStreamRecord = { - val _obj$ = js.Dynamic.literal( - "awsRegion" -> awsRegion.asInstanceOf[js.Any], - "eventID" -> eventID.asInstanceOf[js.Any], - "eventName" -> eventName.asInstanceOf[js.Any], - "eventSource" -> eventSource.asInstanceOf[js.Any], - "eventSourceARN" -> eventSourceARN.asInstanceOf[js.Any], - "eventVersion" -> eventVersion.asInstanceOf[js.Any], - "invokeIdentityArn" -> invokeIdentityArn.asInstanceOf[js.Any], - "kinesis" -> kinesis.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[KinesisStreamRecord] - } -} - +@Factory @js.native trait KinesisStreamEvent extends js.Object { var Records: js.Array[KinesisStreamRecord] = js.native } - -object KinesisStreamEvent { - def apply( - Records: js.Array[KinesisStreamRecord] - ): KinesisStreamEvent = { - val _obj$ = js.Dynamic.literal( - "Records" -> Records.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[KinesisStreamEvent] - } -} diff --git a/src/main/scala/net/exoego/facade/aws_lambda/lex.scala b/src/main/scala/net/exoego/facade/aws_lambda/lex.scala index c731a60..b3a47ed 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/lex.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/lex.scala @@ -1,8 +1,11 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory + import scala.scalajs.js import scala.scalajs.js.| +@Factory @js.native trait LexEvent extends js.Object { var currentIntent: LexEvent.CurrentIntent = js.native @@ -17,31 +20,7 @@ trait LexEvent extends js.Object { } object LexEvent { - def apply( - currentIntent: LexEvent.CurrentIntent, - bot: LexEvent.Bot, - userId: String, - inputTranscript: String, - invocationSource: String, - outputDialogMode: String, - messageVersion: String, - sessionAttributes: LexEvent.SessionAttributes, - requestAttributes: js.Dictionary[String] | Null = null - ): LexEvent = { - val _obj$ = js.Dynamic.literal( - "currentIntent" -> currentIntent.asInstanceOf[js.Any], - "bot" -> bot.asInstanceOf[js.Any], - "userId" -> userId.asInstanceOf[js.Any], - "inputTranscript" -> inputTranscript.asInstanceOf[js.Any], - "invocationSource" -> invocationSource.asInstanceOf[js.Any], - "outputDialogMode" -> outputDialogMode.asInstanceOf[js.Any], - "messageVersion" -> messageVersion.asInstanceOf[js.Any], - "sessionAttributes" -> sessionAttributes.asInstanceOf[js.Any], - "requestAttributes" -> requestAttributes.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[LexEvent] - } - + @Factory(false) @js.native trait CurrentIntent extends js.Object { var name: String = js.native @@ -51,23 +30,10 @@ object LexEvent { } object CurrentIntent { - def apply( - name: String, - slots: CurrentIntent.Slots, - slotDetails: LexSlotDetails, - confirmationStatus: String - ): CurrentIntent = { - val _obj$ = js.Dynamic.literal( - "name" -> name.asInstanceOf[js.Any], - "slots" -> slots.asInstanceOf[js.Any], - "slotDetails" -> slotDetails.asInstanceOf[js.Any], - "confirmationStatus" -> confirmationStatus.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[CurrentIntent] - } type Slots = js.Dictionary[String] } + @Factory(false) @js.native trait Bot extends js.Object { var name: String = js.native @@ -75,60 +41,24 @@ object LexEvent { var version: String = js.native } - object Bot { - def apply( - name: String, - alias: String, - version: String - ): Bot = { - val _obj$ = js.Dynamic.literal( - "name" -> name.asInstanceOf[js.Any], - "alias" -> alias.asInstanceOf[js.Any], - "version" -> version.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Bot] - } - } - + @Factory(false) @js.native trait LexSlotDetailsItem extends js.Object { var resolutions: js.Array[LexSlotResolution] = js.native var originalValue: String = js.native } - object LexSlotDetailsItem { - def apply( - resolutions: js.Array[LexSlotResolution], - originalValue: String - ): LexSlotDetailsItem = { - val _obj$ = js.Dynamic.literal( - "resolutions" -> resolutions.asInstanceOf[js.Any], - "originalValue" -> originalValue.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[LexSlotDetailsItem] - } - } - type SessionAttributes = js.Dictionary[String] type LexSlotDetails = js.Dictionary[LexSlotDetailsItem] } +@Factory @js.native trait LexSlotResolution extends js.Object { var value: String = js.native } -object LexSlotResolution { - def apply( - value: String - ): LexSlotResolution = { - val _obj$ = js.Dynamic.literal( - "value" -> value.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[LexSlotResolution] - } -} - +@Factory @js.native trait LexGenericAttachment extends js.Object { var title: String = js.native @@ -139,43 +69,15 @@ trait LexGenericAttachment extends js.Object { } object LexGenericAttachment { - def apply( - title: String, - subTitle: String, - imageUrl: String, - attachmentLinkUrl: String, - buttons: js.Array[ButtonsItem] - ): LexGenericAttachment = { - val _obj$ = js.Dynamic.literal( - "title" -> title.asInstanceOf[js.Any], - "subTitle" -> subTitle.asInstanceOf[js.Any], - "imageUrl" -> imageUrl.asInstanceOf[js.Any], - "attachmentLinkUrl" -> attachmentLinkUrl.asInstanceOf[js.Any], - "buttons" -> buttons.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[LexGenericAttachment] - } - + @Factory(false) @js.native trait ButtonsItem extends js.Object { var text: String = js.native var value: String = js.native } - - object ButtonsItem { - def apply( - text: String, - value: String - ): ButtonsItem = { - val _obj$ = js.Dynamic.literal( - "text" -> text.asInstanceOf[js.Any], - "value" -> value.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[ButtonsItem] - } - } } +@Factory @js.native trait LexDialogActionBase extends js.Object { var `type`: String = js.native @@ -184,144 +86,56 @@ trait LexDialogActionBase extends js.Object { } object LexDialogActionBase { - def apply( - `type`: String, - message: js.UndefOr[LexDialogActionBase.Message] = js.undefined, - responseCard: js.UndefOr[LexDialogActionBase.ResponseCard] = js.undefined - ): LexDialogActionBase = { - val _obj$ = js.Dynamic.literal( - "type" -> `type`.asInstanceOf[js.Any] - ) - message.foreach(_v => - _obj$.updateDynamic("message")(_v.asInstanceOf[js.Any]) - ) - responseCard.foreach(_v => - _obj$.updateDynamic("responseCard")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[LexDialogActionBase] - } - + @Factory(false) @js.native trait Message extends js.Object { var contentType: String = js.native var content: String = js.native } - object Message { - def apply( - contentType: String, - content: String - ): Message = { - val _obj$ = js.Dynamic.literal( - "contentType" -> contentType.asInstanceOf[js.Any], - "content" -> content.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Message] - } - } - + @Factory(false) @js.native trait ResponseCard extends js.Object { var version: Double = js.native var contentType: String = js.native var genericAttachments: js.Array[LexGenericAttachment] = js.native } - - object ResponseCard { - def apply( - version: Double, - contentType: String, - genericAttachments: js.Array[LexGenericAttachment] - ): ResponseCard = { - val _obj$ = js.Dynamic.literal( - "version" -> version.asInstanceOf[js.Any], - "contentType" -> contentType.asInstanceOf[js.Any], - "genericAttachments" -> genericAttachments.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[ResponseCard] - } - } } +@Factory @js.native -trait LexDialogActionClose extends LexDialogActionBase { +trait LexDialogActionClose extends js.Object with LexDialogActionBase { var fulfillmentState: String = js.native } -object LexDialogActionClose { - def apply( - `type`: String, - fulfillmentState: String - ): LexDialogActionClose = { - val _obj$ = js.Dynamic.literal( - "type" -> `type`.asInstanceOf[js.Any], - "fulfillmentState" -> fulfillmentState.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[LexDialogActionClose] - } -} - +@Factory @js.native -trait LexDialogActionElicitIntent extends LexDialogActionBase {} - -object LexDialogActionElicitIntent { - def apply( - `type`: String - ): LexDialogActionElicitIntent = { - val _obj$ = js.Dynamic.literal( - "type" -> `type`.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[LexDialogActionElicitIntent] - } -} +trait LexDialogActionElicitIntent extends js.Object with LexDialogActionBase {} +@Factory @js.native -trait LexDialogActionElicitSlot extends LexDialogActionBase { +trait LexDialogActionElicitSlot extends js.Object with LexDialogActionBase { var intentName: String = js.native var slots: LexDialogActionElicitSlot.Slots = js.native var slotToElicit: String = js.native } object LexDialogActionElicitSlot { - def apply( - `type`: String, - intentName: String, - slots: LexDialogActionElicitSlot.Slots, - slotToElicit: String - ): LexDialogActionElicitSlot = { - val _obj$ = js.Dynamic.literal( - "type" -> `type`.asInstanceOf[js.Any], - "intentName" -> intentName.asInstanceOf[js.Any], - "slots" -> slots.asInstanceOf[js.Any], - "slotToElicit" -> slotToElicit.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[LexDialogActionElicitSlot] - } type Slots = js.Dictionary[String] } +@Factory @js.native -trait LexDialogActionConfirmIntent extends LexDialogActionBase { +trait LexDialogActionConfirmIntent extends js.Object with LexDialogActionBase { var intentName: String = js.native var slots: LexDialogActionConfirmIntent.Slots = js.native } object LexDialogActionConfirmIntent { - def apply( - `type`: String, - intentName: String, - slots: LexDialogActionConfirmIntent.Slots - ): LexDialogActionConfirmIntent = { - val _obj$ = js.Dynamic.literal( - "type" -> `type`.asInstanceOf[js.Any], - "intentName" -> intentName.asInstanceOf[js.Any], - "slots" -> slots.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[LexDialogActionConfirmIntent] - } type Slots = js.Dictionary[String] } +@Factory @js.native trait LexDialogActionDelegate extends js.Object { var `type`: String = js.native @@ -329,19 +143,10 @@ trait LexDialogActionDelegate extends js.Object { } object LexDialogActionDelegate { - def apply( - `type`: String, - slots: LexDialogActionDelegate.Slots - ): LexDialogActionDelegate = { - val _obj$ = js.Dynamic.literal( - "type" -> `type`.asInstanceOf[js.Any], - "slots" -> slots.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[LexDialogActionDelegate] - } type Slots = js.Dictionary[String] } +@Factory @js.native trait LexResult extends js.Object { var sessionAttributes: js.UndefOr[LexResult.SessionAttributes] = js.native @@ -349,17 +154,5 @@ trait LexResult extends js.Object { } object LexResult { - def apply( - dialogAction: LexDialogAction, - sessionAttributes: js.UndefOr[LexResult.SessionAttributes] = js.undefined - ): LexResult = { - val _obj$ = js.Dynamic.literal( - "dialogAction" -> dialogAction.asInstanceOf[js.Any] - ) - sessionAttributes.foreach(_v => - _obj$.updateDynamic("sessionAttributes")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[LexResult] - } type SessionAttributes = js.Dictionary[String] } diff --git a/src/main/scala/net/exoego/facade/aws_lambda/s3.scala b/src/main/scala/net/exoego/facade/aws_lambda/s3.scala index f029d3c..3e76c47 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/s3.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/s3.scala @@ -1,44 +1,22 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory import scala.scalajs.js +@Factory @js.native trait S3EventRecordGlacierRestoreEventData extends js.Object { var lifecycleRestorationExpiryTime: String = js.native var lifecycleRestoreStorageClass: String = js.native } -object S3EventRecordGlacierRestoreEventData { - def apply( - lifecycleRestorationExpiryTime: String, - lifecycleRestoreStorageClass: String - ): S3EventRecordGlacierRestoreEventData = { - val _obj$ = js.Dynamic.literal( - "lifecycleRestorationExpiryTime" -> lifecycleRestorationExpiryTime - .asInstanceOf[js.Any], - "lifecycleRestoreStorageClass" -> lifecycleRestoreStorageClass - .asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[S3EventRecordGlacierRestoreEventData] - } -} - +@Factory @js.native trait S3EventRecordGlacierEventData extends js.Object { var restoreEventData: S3EventRecordGlacierRestoreEventData = js.native } -object S3EventRecordGlacierEventData { - def apply( - restoreEventData: S3EventRecordGlacierRestoreEventData - ): S3EventRecordGlacierEventData = { - val _obj$ = js.Dynamic.literal( - "restoreEventData" -> restoreEventData.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[S3EventRecordGlacierEventData] - } -} - +@Factory @js.native trait S3EventRecord extends js.Object { var eventVersion: String = js.native @@ -54,86 +32,26 @@ trait S3EventRecord extends js.Object { } object S3EventRecord { - def apply( - eventVersion: String, - eventSource: String, - awsRegion: String, - eventTime: String, - eventName: String, - userIdentity: S3EventRecord.UserIdentity, - requestParameters: S3EventRecord.RequestParameters, - responseElements: S3EventRecord.ResponseElements, - s3: S3EventRecord.S3, - glacierEventData: js.UndefOr[S3EventRecordGlacierEventData] = js.undefined - ): S3EventRecord = { - val _obj$ = js.Dynamic.literal( - "eventVersion" -> eventVersion.asInstanceOf[js.Any], - "eventSource" -> eventSource.asInstanceOf[js.Any], - "awsRegion" -> awsRegion.asInstanceOf[js.Any], - "eventTime" -> eventTime.asInstanceOf[js.Any], - "eventName" -> eventName.asInstanceOf[js.Any], - "userIdentity" -> userIdentity.asInstanceOf[js.Any], - "requestParameters" -> requestParameters.asInstanceOf[js.Any], - "responseElements" -> responseElements.asInstanceOf[js.Any], - "s3" -> s3.asInstanceOf[js.Any] - ) - glacierEventData.foreach(_v => - _obj$.updateDynamic("glacierEventData")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[S3EventRecord] - } - + @Factory(false) @js.native trait UserIdentity extends js.Object { var principalId: String = js.native } - object UserIdentity { - def apply( - principalId: String - ): UserIdentity = { - val _obj$ = js.Dynamic.literal( - "principalId" -> principalId.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[UserIdentity] - } - } - + @Factory(false) @js.native trait RequestParameters extends js.Object { var sourceIPAddress: String = js.native } - object RequestParameters { - def apply( - sourceIPAddress: String - ): RequestParameters = { - val _obj$ = js.Dynamic.literal( - "sourceIPAddress" -> sourceIPAddress.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[RequestParameters] - } - } - + @Factory(false) @js.native trait ResponseElements extends js.Object { var `x-amz-request-id`: String = js.native var `x-amz-id-2`: String = js.native } - object ResponseElements { - def apply( - `x-amz-request-id`: String, - `x-amz-id-2`: String - ): ResponseElements = { - val _obj$ = js.Dynamic.literal( - "x-amz-request-id" -> `x-amz-request-id`.asInstanceOf[js.Any], - "x-amz-id-2" -> `x-amz-id-2`.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[ResponseElements] - } - } - + @Factory(false) @js.native trait S3 extends js.Object { var s3SchemaVersion: String = js.native @@ -143,21 +61,7 @@ object S3EventRecord { } object S3 { - def apply( - s3SchemaVersion: String, - configurationId: String, - bucket: S3.Bucket, - `object`: S3.Object - ): S3 = { - val _obj$ = js.Dynamic.literal( - "s3SchemaVersion" -> s3SchemaVersion.asInstanceOf[js.Any], - "configurationId" -> configurationId.asInstanceOf[js.Any], - "bucket" -> bucket.asInstanceOf[js.Any], - "object" -> `object`.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[S3] - } - + @Factory(false) @js.native trait Bucket extends js.Object { var name: String = js.native @@ -166,36 +70,14 @@ object S3EventRecord { } object Bucket { - def apply( - name: String, - ownerIdentity: Bucket.OwnerIdentity, - arn: String - ): Bucket = { - val _obj$ = js.Dynamic.literal( - "name" -> name.asInstanceOf[js.Any], - "ownerIdentity" -> ownerIdentity.asInstanceOf[js.Any], - "arn" -> arn.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[Bucket] - } - + @Factory(false) @js.native trait OwnerIdentity extends js.Object { var principalId: String = js.native } - - object OwnerIdentity { - def apply( - principalId: String - ): OwnerIdentity = { - val _obj$ = js.Dynamic.literal( - "principalId" -> principalId.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[OwnerIdentity] - } - } } + @Factory(false) @js.native trait Object extends js.Object { var key: String = js.native @@ -204,42 +86,11 @@ object S3EventRecord { var versionId: js.UndefOr[String] = js.native var sequencer: String = js.native } - - object Object { - def apply( - key: String, - size: Double, - eTag: String, - sequencer: String, - versionId: js.UndefOr[String] = js.undefined - ): Object = { - val _obj$ = js.Dynamic.literal( - "key" -> key.asInstanceOf[js.Any], - "size" -> size.asInstanceOf[js.Any], - "eTag" -> eTag.asInstanceOf[js.Any], - "sequencer" -> sequencer.asInstanceOf[js.Any] - ) - versionId.foreach(_v => - _obj$.updateDynamic("versionId")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[Object] - } - } } } +@Factory @js.native trait S3Event extends js.Object { var Records: js.Array[S3EventRecord] = js.native } - -object S3Event { - def apply( - Records: js.Array[S3EventRecord] - ): S3Event = { - val _obj$ = js.Dynamic.literal( - "Records" -> Records.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[S3Event] - } -} diff --git a/src/main/scala/net/exoego/facade/aws_lambda/s3_batch.scala b/src/main/scala/net/exoego/facade/aws_lambda/s3_batch.scala index e9eb8b4..9b344b9 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/s3_batch.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/s3_batch.scala @@ -1,8 +1,10 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory import scala.scalajs.js import scala.scalajs.js.| +@Factory @js.native trait S3BatchEvent extends js.Object { var invocationSchemaVersion: String = js.native @@ -11,39 +13,13 @@ trait S3BatchEvent extends js.Object { var tasks: js.Array[S3BatchEventTask] = js.native } -object S3BatchEvent { - def apply( - invocationSchemaVersion: String, - invocationId: String, - job: S3BatchEventJob, - tasks: js.Array[S3BatchEventTask] - ): S3BatchEvent = { - val _obj$ = js.Dynamic.literal( - "invocationSchemaVersion" -> invocationSchemaVersion.asInstanceOf[js.Any], - "invocationId" -> invocationId.asInstanceOf[js.Any], - "job" -> job.asInstanceOf[js.Any], - "tasks" -> tasks.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[S3BatchEvent] - } -} - +@Factory @js.native trait S3BatchEventJob extends js.Object { var id: String = js.native } -object S3BatchEventJob { - def apply( - id: String - ): S3BatchEventJob = { - val _obj$ = js.Dynamic.literal( - "id" -> id.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[S3BatchEventJob] - } -} - +@Factory @js.native trait S3BatchEventTask extends js.Object { var taskId: String = js.native @@ -52,23 +28,7 @@ trait S3BatchEventTask extends js.Object { var s3BucketArn: String = js.native } -object S3BatchEventTask { - def apply( - taskId: String, - s3Key: String, - s3BucketArn: String, - s3VersionId: String | Null = null - ): S3BatchEventTask = { - val _obj$ = js.Dynamic.literal( - "taskId" -> taskId.asInstanceOf[js.Any], - "s3Key" -> s3Key.asInstanceOf[js.Any], - "s3VersionId" -> s3VersionId.asInstanceOf[js.Any], - "s3BucketArn" -> s3BucketArn.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[S3BatchEventTask] - } -} - +@Factory @js.native trait S3BatchResult extends js.Object { var invocationSchemaVersion: String = js.native @@ -77,41 +37,10 @@ trait S3BatchResult extends js.Object { var results: js.Array[S3BatchResultResult] = js.native } -object S3BatchResult { - def apply( - invocationSchemaVersion: String, - treatMissingKeysAs: S3BatchResultResultCode, - invocationId: String, - results: js.Array[S3BatchResultResult] - ): S3BatchResult = { - val _obj$ = js.Dynamic.literal( - "invocationSchemaVersion" -> invocationSchemaVersion.asInstanceOf[js.Any], - "treatMissingKeysAs" -> treatMissingKeysAs.asInstanceOf[js.Any], - "invocationId" -> invocationId.asInstanceOf[js.Any], - "results" -> results.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[S3BatchResult] - } -} - +@Factory @js.native trait S3BatchResultResult extends js.Object { var taskId: String = js.native var resultCode: S3BatchResultResultCode = js.native var resultString: String = js.native } - -object S3BatchResultResult { - def apply( - taskId: String, - resultCode: S3BatchResultResultCode, - resultString: String - ): S3BatchResultResult = { - val _obj$ = js.Dynamic.literal( - "taskId" -> taskId.asInstanceOf[js.Any], - "resultCode" -> resultCode.asInstanceOf[js.Any], - "resultString" -> resultString.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[S3BatchResultResult] - } -} diff --git a/src/main/scala/net/exoego/facade/aws_lambda/sns.scala b/src/main/scala/net/exoego/facade/aws_lambda/sns.scala index a0eaa71..2c1980c 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/sns.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/sns.scala @@ -1,26 +1,16 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory import scala.scalajs.js +@Factory @js.native trait SNSMessageAttribute extends js.Object { var Type: String = js.native var Value: String = js.native } -object SNSMessageAttribute { - def apply( - Type: String, - Value: String - ): SNSMessageAttribute = { - val _obj$ = js.Dynamic.literal( - "Type" -> Type.asInstanceOf[js.Any], - "Value" -> Value.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[SNSMessageAttribute] - } -} - +@Factory @js.native trait SNSMessage extends js.Object { var SignatureVersion: String = js.native @@ -36,37 +26,7 @@ trait SNSMessage extends js.Object { var Subject: String = js.native } -object SNSMessage { - def apply( - SignatureVersion: String, - Timestamp: String, - Signature: String, - SigningCertUrl: String, - MessageId: String, - Message: String, - MessageAttributes: SNSMessageAttributes, - Type: String, - UnsubscribeUrl: String, - TopicArn: String, - Subject: String - ): SNSMessage = { - val _obj$ = js.Dynamic.literal( - "SignatureVersion" -> SignatureVersion.asInstanceOf[js.Any], - "Timestamp" -> Timestamp.asInstanceOf[js.Any], - "Signature" -> Signature.asInstanceOf[js.Any], - "SigningCertUrl" -> SigningCertUrl.asInstanceOf[js.Any], - "MessageId" -> MessageId.asInstanceOf[js.Any], - "Message" -> Message.asInstanceOf[js.Any], - "MessageAttributes" -> MessageAttributes.asInstanceOf[js.Any], - "Type" -> Type.asInstanceOf[js.Any], - "UnsubscribeUrl" -> UnsubscribeUrl.asInstanceOf[js.Any], - "TopicArn" -> TopicArn.asInstanceOf[js.Any], - "Subject" -> Subject.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[SNSMessage] - } -} - +@Factory @js.native trait SNSEventRecord extends js.Object { var EventVersion: String = js.native @@ -75,35 +35,8 @@ trait SNSEventRecord extends js.Object { var Sns: SNSMessage = js.native } -object SNSEventRecord { - def apply( - EventVersion: String, - EventSubscriptionArn: String, - EventSource: String, - Sns: SNSMessage - ): SNSEventRecord = { - val _obj$ = js.Dynamic.literal( - "EventVersion" -> EventVersion.asInstanceOf[js.Any], - "EventSubscriptionArn" -> EventSubscriptionArn.asInstanceOf[js.Any], - "EventSource" -> EventSource.asInstanceOf[js.Any], - "Sns" -> Sns.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[SNSEventRecord] - } -} - +@Factory @js.native trait SNSEvent extends js.Object { var Records: js.Array[SNSEventRecord] = js.native } - -object SNSEvent { - def apply( - Records: js.Array[SNSEventRecord] - ): SNSEvent = { - val _obj$ = js.Dynamic.literal( - "Records" -> Records.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[SNSEvent] - } -} diff --git a/src/main/scala/net/exoego/facade/aws_lambda/sqs.scala b/src/main/scala/net/exoego/facade/aws_lambda/sqs.scala index 9b988f5..85ccd4e 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/sqs.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/sqs.scala @@ -1,7 +1,9 @@ package net.exoego.facade.aws_lambda +import net.exoego.scalajs.types.util.Factory import scala.scalajs.js +@Factory @js.native trait SQSRecord extends js.Object { var messageId: String = js.native @@ -15,49 +17,13 @@ trait SQSRecord extends js.Object { var awsRegion: String = js.native } -object SQSRecord { - def apply( - messageId: String, - receiptHandle: String, - body: String, - attributes: SQSRecordAttributes, - messageAttributes: SQSMessageAttributes, - md5OfBody: String, - eventSource: String, - eventSourceARN: String, - awsRegion: String - ): SQSRecord = { - val _obj$ = js.Dynamic.literal( - "messageId" -> messageId.asInstanceOf[js.Any], - "receiptHandle" -> receiptHandle.asInstanceOf[js.Any], - "body" -> body.asInstanceOf[js.Any], - "attributes" -> attributes.asInstanceOf[js.Any], - "messageAttributes" -> messageAttributes.asInstanceOf[js.Any], - "md5OfBody" -> md5OfBody.asInstanceOf[js.Any], - "eventSource" -> eventSource.asInstanceOf[js.Any], - "eventSourceARN" -> eventSourceARN.asInstanceOf[js.Any], - "awsRegion" -> awsRegion.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[SQSRecord] - } -} - +@Factory @js.native trait SQSEvent extends js.Object { var Records: js.Array[SQSRecord] = js.native } -object SQSEvent { - def apply( - Records: js.Array[SQSRecord] - ): SQSEvent = { - val _obj$ = js.Dynamic.literal( - "Records" -> Records.asInstanceOf[js.Any] - ) - _obj$.asInstanceOf[SQSEvent] - } -} - +@Factory @js.native trait SQSRecordAttributes extends js.Object { var ApproximateReceiveCount: String = js.native @@ -67,28 +33,7 @@ trait SQSRecordAttributes extends js.Object { var AWSTraceHeader: js.UndefOr[String] = js.native } -object SQSRecordAttributes { - def apply( - ApproximateReceiveCount: String, - SentTimestamp: String, - SenderId: String, - ApproximateFirstReceiveTimestamp: String, - AWSTraceHeader: js.UndefOr[String] = js.undefined - ): SQSRecordAttributes = { - val _obj$ = js.Dynamic.literal( - "ApproximateReceiveCount" -> ApproximateReceiveCount.asInstanceOf[js.Any], - "SentTimestamp" -> SentTimestamp.asInstanceOf[js.Any], - "SenderId" -> SenderId.asInstanceOf[js.Any], - "ApproximateFirstReceiveTimestamp" -> ApproximateFirstReceiveTimestamp - .asInstanceOf[js.Any] - ) - AWSTraceHeader.foreach(_v => - _obj$.updateDynamic("AWSTraceHeader")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[SQSRecordAttributes] - } -} - +@Factory @js.native trait SQSMessageAttribute extends js.Object { var stringValue: js.UndefOr[String] = js.native @@ -97,26 +42,3 @@ trait SQSMessageAttribute extends js.Object { var binaryListValues: js.Array[Nothing] = js.native var dataType: SQSMessageAttributeDataType = js.native } - -object SQSMessageAttribute { - def apply( - stringListValues: js.Array[Nothing], - binaryListValues: js.Array[Nothing], - dataType: SQSMessageAttributeDataType, - stringValue: js.UndefOr[String] = js.undefined, - binaryValue: js.UndefOr[String] = js.undefined - ): SQSMessageAttribute = { - val _obj$ = js.Dynamic.literal( - "stringListValues" -> stringListValues.asInstanceOf[js.Any], - "binaryListValues" -> binaryListValues.asInstanceOf[js.Any], - "dataType" -> dataType.asInstanceOf[js.Any] - ) - stringValue.foreach(_v => - _obj$.updateDynamic("stringValue")(_v.asInstanceOf[js.Any]) - ) - binaryValue.foreach(_v => - _obj$.updateDynamic("binaryValue")(_v.asInstanceOf[js.Any]) - ) - _obj$.asInstanceOf[SQSMessageAttribute] - } -} From 3fece81d2dab8399683707c2e4b09a551800d7b4 Mon Sep 17 00:00:00 2001 From: exoego Date: Wed, 24 Jun 2020 09:42:49 +0900 Subject: [PATCH 3/5] Add more intention-full methods and deprecate intention-less methods --- .../net/exoego/facade/aws_lambda/cloudfront.scala | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/scala/net/exoego/facade/aws_lambda/cloudfront.scala b/src/main/scala/net/exoego/facade/aws_lambda/cloudfront.scala index 0408f7d..2370d99 100644 --- a/src/main/scala/net/exoego/facade/aws_lambda/cloudfront.scala +++ b/src/main/scala/net/exoego/facade/aws_lambda/cloudfront.scala @@ -18,14 +18,18 @@ trait CloudFrontOrigin extends js.Object { } object CloudFrontOrigin { - // mutual exclusive - def apply(s3: CloudFrontS3Origin): CloudFrontOrigin = { + @deprecated("Use CloudFrontOrigin.ofS3 instead", "0.10.0") + def apply(s3: CloudFrontS3Origin): CloudFrontOrigin = ofS3(s3) + @deprecated("Use CloudFrontOrigin.ofCustom instead", "0.10.0") + def apply(custom: CloudFrontCustomOrigin): CloudFrontOrigin = ofCustom(custom) + + def ofS3(s3: CloudFrontS3Origin): CloudFrontOrigin = { val _obj$ = js.Dynamic.literal( "s3" -> s3 ) _obj$.asInstanceOf[CloudFrontOrigin] } - def apply(custom: CloudFrontCustomOrigin): CloudFrontOrigin = { + def ofCustom(custom: CloudFrontCustomOrigin): CloudFrontOrigin = { val _obj$ = js.Dynamic.literal( "custom" -> custom ) From 3c958a3351d2a128512a7c4010e52ca38c60d660 Mon Sep 17 00:00:00 2001 From: exoego Date: Thu, 25 Jun 2020 10:00:17 +0900 Subject: [PATCH 4/5] Avoid fullOptJS error due to scala.meta's export --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 71cf472..878a756 100644 --- a/build.sbt +++ b/build.sbt @@ -5,6 +5,7 @@ organization := "net.exoego" scalacOptions ++= Seq("-P:scalajs:sjsDefinedByDefault").filter { _ => Option(System.getenv("SCALAJS_VERSION")).exists(_.startsWith("0.6.")) } +scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)) scalacOptions --= Seq( // Do not fail on macro warning "-Xfatal-warnings", From d4601d0712628581bccd6705ac99526910f7e5ff Mon Sep 17 00:00:00 2001 From: exoego Date: Thu, 25 Jun 2020 10:07:38 +0900 Subject: [PATCH 5/5] Enable fatal-warnings again since macro uses info instead of warning --- build.sbt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 878a756..7ec196a 100644 --- a/build.sbt +++ b/build.sbt @@ -7,8 +7,6 @@ scalacOptions ++= Seq("-P:scalajs:sjsDefinedByDefault").filter { _ => } scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)) scalacOptions --= Seq( - // Do not fail on macro warning - "-Xfatal-warnings", // false positive on js.native "-Wdead-code", "-Wunused:params", @@ -18,7 +16,7 @@ scalacOptions --= Seq( val awsSdkScalajsFacadeVersion = "[0.29.0-v2.624.0,1.0)" libraryDependencies ++= Seq( - "net.exoego" %%% "scalajs-types-util" % "0.2.1", + "net.exoego" %%% "scalajs-types-util" % "0.2.2", "net.exoego" %%% "aws-sdk-scalajs-facade-dynamodb" % awsSdkScalajsFacadeVersion )