Coder Social home page Coder Social logo

Comments (6)

sebsto avatar sebsto commented on July 17, 2024 1

@Andrea-Scuderi the approach I used for SAM is to let the function developer describe its environment in Swift (like a SwiftUI struct) and generate the YAML based on that.

Example :

import AWSLambdaDeploymentDescriptor

DeploymentDescriptor {
  // a mandatory description
  "Description of this deployment descriptor"

  // the lambda function
  Function(name: "HttpApiLambda") {
    EventSources {
      HttpApi(method: .GET, path: "/test") // example of an API for a specific HTTP verb and path
    }
    // optional environment variables
    EnvironmentVariables {
      [ "NAME1": "VALUE1" ]
    }
  }
}

The same file could be generated for SAM or Serverless. It can have DynamoDB, IAM Policies, SQS queues ... The long part is to write the Swift struct that models all SAM/Serverless constructs.

from swift-aws-lambda-runtime.

sebsto avatar sebsto commented on July 17, 2024 1

Closing as there is a proposed SLS plugin on the SLS project.

from swift-aws-lambda-runtime.

sebsto avatar sebsto commented on July 17, 2024

Hello @darylteo
Are you thinking about a SwiftPM plugin to would generate a Serverless deployment descriptor ? Or a serverless plugin to scaffold a Swift project and its associate resources.

I am currently working on a SPM plugin that generates a SAM deployment descriptor. That work / approach could be extended to Serverless too.

Have a look at this PR (#291) and let me know what you think.

from swift-aws-lambda-runtime.

Andrea-Scuderi avatar Andrea-Scuderi commented on July 17, 2024

Hello @darylteo @sebsto,
I've prepared an example of the output required with Serverless using Breeze the library I'm developing: https://github.com/swift-sprinter/Breeze/tree/main/Example.
Using Breeze it's very easy to create a Serverless business logic for APIGateway, Lambda, Dynamo. The difficult part is to help users in the deployment.
That code has been generated by a command line, but it's still in development.

Not sure what could be the best approach:
1 - Have a SPM plugin, but it's not clear how to add additional resources (DynamoDB, ....)
2 - Use a dedicate command line
3 - Have a Plugin in Serverless

Maybe we need all the approaches, happy to contribute.

from swift-aws-lambda-runtime.

Andrea-Scuderi avatar Andrea-Scuderi commented on July 17, 2024

@sebsto @darylteo
Here the dedicated command line I've prepared for 💨Breeze https://github.com/swift-sprinter/Breeze/pull/6

The command line relies on a new library I've prepared to load serverless.yml.
https://github.com/swift-sprinter/swift-sls-adapter.git

Once the solution [1] is ready, I can add the plugin for Serverless

Happy to get suggestions, comments and contributions.

from swift-aws-lambda-runtime.

darylteo avatar darylteo commented on July 17, 2024

Are you thinking about a SwiftPM plugin to would generate a Serverless deployment descriptor ? Or a serverless plugin to scaffold a Swift project and its associate resources.

@sebsto sorry I meant a ServerlessFramework plugin. I want to use SLS to do my deployments.

@Andrea-Scuderi Ah I think this is coming from the opposite direction of what I was thinking of. My use case is to use Swift in a mish mash of other runtimes using ServerlessFramework(SLS), so it's imperative that I work in SLS.

As you can see here, serverless/serverless#11840 (comment) I made a local plugin in SLS for starting a offline server so I can invoke commands into it. There are some minor inconveniences (can't proxy invoke through sls invoke local, but it works for now.

Sorry for the confusion!

from swift-aws-lambda-runtime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.