Coder Social home page Coder Social logo

acme-weather-station's Introduction

ACME Weather Station

A mock IOT weather station with support for BOM retrieval.

Please note: this is a basic example. The web server is not fully standards compliant. It should support most basic requests. If handling is missing for any required functionality feel free to raise an issue, or, even better, create a pull request :)

It supports BOM discovery and access via the well known URIs /.well-known/sbom and /.well-known/sbom/base.

Please note: there is an existing internet draft draft-ietf-opsawg-sbom-access. At present, this service simply responds with a redirect to the BOM. This may change in the future to match what the final standard specifies.

Alternatively, the BOM can be retrieved directly from /bom.

Usage

Note: Docker is required.

The simplest way to use this is to clone the repository and run build-and-run.sh...

git clone https://github.com/CycloneDX/acme-weather-station.git
cd acme-weather-station
./build-and-run.sh

By default the service listens on port 8000. The build-and-run.sh script can be modified to change this.

Supported Media Types

CycloneDX XML, JSON and Protobuf media types are supported for BOM retrieval:

  • application/vnd.cyclonedx+xml
  • application/vnd.cyclonedx+json
  • application/x.vnd.cyclonedx+protobuf

The version parameter is also supported to specify what CycloneDX specification version you want to retrieve. By default, the latest supported version will be returned.

For example, to request a v1.2 JSON BOM, use the following header:

Accept: application/vnd.cyclonedx+json; version=1.2

You can also retrieve the BOM in SPDX tag/value format by using the media type text/spdx. The SPDX media type doesn't support a version parameter. Only v2.2 is returned.

Or, you can just specify */* to retrieve the default, which, for this service, is currently CycloneDX v1.3 JSON.

Browsers, by default, add */* to the Accept header meaning you can also just browse to the relevant URL. i.e. http://localhost:8000/.well-known/sbom

Weather Information

Weather information is retrieved from the OpenWeather Map API. This API requires an API key. If you don't provide an API key a mock response will be returned.

To provide an API key set the environment variable OPENWEATHER_API_KEY.

To override the default weather location, London, set the environment variable OPENWEATHER_CITY_NAME.

Services

Services are supported in CycloneDX specification v1.2 onwards.

The OpenWeather Map API call, https://api.openweathermap.org/data/2.5/weather, is documented in the BOM.

However, there is an undocumented service call to https://www.example.com. This is an intentional omission for anyone testing network monitoring use cases.

acme-weather-station's People

Contributors

coderpatros avatar

Watchers

 avatar  avatar  avatar

acme-weather-station's Issues

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.