diff --git a/.github/workflows/stainless-sdks.yml b/.github/workflows/stainless-sdks.yml new file mode 100644 index 00000000..b0173fc4 --- /dev/null +++ b/.github/workflows/stainless-sdks.yml @@ -0,0 +1,65 @@ +name: Stainless SDK preview on PRs + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - closed + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +env: + STAINLESS_ORG: ${{ vars.STAINLESS_ORG }} + STAINLESS_PROJECT: ${{ vars.STAINLESS_PROJECT }} + OAS_PATH: openapi.yaml + CONFIG_PATH: stainless.yaml + +jobs: + preview: + if: github.event.action != 'closed' + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Run preview builds + uses: stainless-api/upload-openapi-spec-action/preview@v1 + with: + stainless_api_key: ${{ secrets.STAINLESS_API_KEY }} + org: ${{ env.STAINLESS_ORG }} + project: ${{ env.STAINLESS_PROJECT }} + oas_path: ${{ env.OAS_PATH }} + config_path: ${{ env.CONFIG_PATH }} + make_comment: true + github_token: ${{ secrets.GITHUB_TOKEN }} + + merge: + if: github.event.action == 'closed' && github.event.pull_request.merged == true + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Run merge build + uses: stainless-api/upload-openapi-spec-action/merge@v1 + with: + stainless_api_key: ${{ secrets.STAINLESS_API_KEY }} + org: ${{ env.STAINLESS_ORG }} + project: ${{ env.STAINLESS_PROJECT }} + oas_path: ${{ env.OAS_PATH }} + make_comment: true + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/stainless.yaml b/stainless.yaml new file mode 100644 index 00000000..393b7f26 --- /dev/null +++ b/stainless.yaml @@ -0,0 +1,138 @@ +# yaml-language-server: $schema=https://app.stainless.com/config.schema.json + +# The main edition for the config, see the [docs] for more information. +# +# [docs]: https://www.stainless.com/docs/reference/editions +edition: 2025-10-10 + +organization: + name: hypeman + # Link to your API documentation. + docs: '' + # Contact email for bug reports, questions, and support requests. + contact: '' + +# `targets` define the output targets and their customization options, such as +# whether to emit the Node SDK and what its package name should be. +targets: + go: + # The edition for this target, see the [docs] for more information. + # + # [docs]: https://www.stainless.com/docs/reference/editions + edition: go.2025-10-08 + package_name: hypeman + production_repo: onkernel/hypeman-go + options: + enable_v2: true + cli: + edition: cli.2025-10-08 + binary_name: hypeman + production_repo: onkernel/hypeman-cli + options: + go_sdk_package: github.com/onkernel/hypeman-go + publish: + homebrew: + tap_repo: onkernel/homebrew-tap + homepage: https://github.com/onkernel/hypeman + description: orchestrate cloud-hypervisor VMs + +# `environments` are a map of the name of the environment (e.g. "sandbox", +# "production") to the corresponding url to use. +environments: + production: http://localhost:8080 + +# `resources` define the structure and organization for your API, such as how +# methods and models are grouped together and accessed. See the [configuration +# guide] for more information. +# +# [configuration guide]: https://www.stainless.com/docs/guides/configure#resources +resources: + health: + # Configure the methods defined in this resource. Each key in the object is the + # name of the method and the value is either an endpoint (for example, `get /foo`) + # or an object with more detail. + # + # [reference]: https://www.stainless.com/docs/reference/config#method + methods: + check: get /health + + images: + # Configure the models--named types--defined in the resource. Each key in the + # object is the name of the model and the value is either the name of a schema in + # `#/components/schemas` or an object with more detail. + # + # [reference]: https://www.stainless.com/docs/reference/config#model + models: + image: '#/components/schemas/Image' + methods: + list: get /images + create: post /images + retrieve: get /images/{name} + delete: delete /images/{name} + + instances: + models: + volume_attachment: '#/components/schemas/VolumeAttachment' + port_mapping: '#/components/schemas/PortMapping' + instance: '#/components/schemas/Instance' + methods: + list: get /instances + create: post /instances + retrieve: get /instances/{id} + delete: delete /instances/{id} + put_in_standby: post /instances/{id}/standby + restore_from_standby: post /instances/{id}/restore + stream_logs: get /instances/{id}/logs + # Subresources define resources that are nested within another for more powerful + # logical groupings, e.g. `cards.payments`. + subresources: + volumes: + methods: + attach: post /instances/{id}/volumes/{volumeId} + detach: delete /instances/{id}/volumes/{volumeId} + + volumes: + models: + volume: '#/components/schemas/Volume' + methods: + list: get /volumes + create: post /volumes + retrieve: get /volumes/{id} + delete: delete /volumes/{id} + +settings: + # All generated integration tests that hit the prism mock http server are marked + # as skipped. Removing this setting or setting it to false enables tests, but + # doing so may result in test failures due to bugs in the test server. + # + # [prism mock http server]: https://stoplight.io/open-source/prism + disable_mock_tests: true + license: Apache-2.0 + +# `client_settings` define settings for the API client, such as extra constructor +# arguments (used for authentication), retry behavior, idempotency, etc. +client_settings: + opts: + api_key: + type: string + nullable: false + auth: + security_scheme: bearerAuth + read_env: HYPEMAN_API_KEY + +security: + - bearerAuth: [] + +# `readme` is used to configure the code snippets that will be rendered in the +# README.md of various SDKs. In particular, you can change the `headline` +# snippet's endpoint and the arguments to call it with. +readme: + example_requests: + default: + type: request + endpoint: get /health + params: {} + headline: + type: request + endpoint: get /health + params: {}