emolero's picture
Upload folder using huggingface_hub
ab74ec2 verified
|
Raw
History Blame Contribute Delete
44 kB

energy-footprint-notification

---
openapi: 3.0.3
############################################################################
#                                     API info                             #
############################################################################
info:
  title: Energy Footprint Notification
  description: |
    ## Overview
    The Energy Footprint Notification API provides the API Consumer
    with information about the energy consumption and carbon footprint of a
    service exposed by a set of applications instances.
    ## Introduction
    The scenario foresees a service provided by many applications, the Energy
    Footprint API provides the API Consumer (e.g. the Service Provider)
    with the information about the energy consumption and carbon
    footprint (greenhouse gases emissions) of the service produced by the
    active applications instances hosted by the Telco Operator.
    Note: This API is expected to be used in conjunction with, for example,
    the CAMARA Edge Cloud APIs.

    **Example use case and flow:**

    [**Edge Service energy report**](https://github.com/camaraproject/EnergyFootprintNotification/blob/r1.3/documentation/API_documentation/EFN_UserStory_UseCase_1.md)

    ## API Documentation
    ## Details
    The Energy Footprint Notification API provides, to the API Consumer,
    information about the energy consumption and carbon footprint for a
    specified service that is provided by a certain number of active instances
    of some applications. The API provides information about the aggregated
    energy consumption and carbon footprint considering all the active instances
    and network involvement, in a specific time period in which the service is
    provided to end users. The application instances that are monitored
    for their energy consumption are the one managed by the Operator and that
    run on top of the Operator’s infrastructure. The service is deployed and
    managed via the Operator Platform (e.g via the [CAMARA Edge Cloud APIs](htt\
    ps://github.com/camaraproject/EdgeCloud)). Consequently, the Operator
    Platform is aware of all the active instances supporting the service and it
    is also aware of the energy consumption in the Data Centers hosting the
    applications instances providing the service. The Operator's Network is
    deeply involved in the service provisioning, so its energy consumption is
    relevant to have and view. The Energy Footprint Notification API also considers the energy
    consumption and the carbon footprint for the network traffic generated by
    the Operator's subscribers consuming the service. The Service Provider
    activates a service using the Operator Platform to instantiate and activate
    the application supporting the service in different Edge Data Centers.
    The Service Provider onboards the applications, deploys and activates some
    instances to enable the service. Service customers use their devices to
    access the service. The use of the service produces an energy
    consumption alongside the Operator's Network and on the Data Centers hosting
    the applications instances. The Energy Footprint Notification API is used by a Service Provider to be
    aware of the energy consumption of the service. The Service Provider,
    via an Energy Footprint Notification API Consumer, invokes the Energy Footprint Notification API with the identifiers of the
    application instances supporting the target service. A period of
    time can be specified; it must start after the API subscription and can be limited.
    The Energy Footprint Notification API provides back the energy consumption by
    the service in that period of time.  The Energy Footprint Notification API also provides back the
    carbon footprint related to the running of the service.
    The Energy Footprint Notification API is an intent based API.

    The Energy Footprint Notification API supports the following Intents:
    - Intent1: Which is the overall energy consumption for my service in this
    period of time?
    - Intent2: Which is the overall carbon footprint for my service in this
    period of time?

    The input for the above intents is:
    - Input_Intent1: Set of applications identifiers and period of time.
    - Input_Intent2: Set of applications identifiers and period of time.

    The output for the above intents is:
    - Output_Intent1: energy consumption in Kw/h.
    - Output_Intent2: greenhouse gases emission in tonnes.

    The related endpoints are:
    - Intent1: /calculate-energy-consumption
    - Intent2: /calculate-carbon-footprint

    **The main elements of the Energy Footprint Notification API are:**

    **ReportCreationRequest:**
    Information about the target service (as a
    set of applications) and the period of time of interest.
    The period must start after the API subscription and can be limited.
    It includes the parameter "service" which is an array of application
    identifiers. The application identifiers are provided by the CAMARA API
    used to deploy the applications (e.g. the Edge Application Management API).

    **EnergyResponse:**
    Provides to the API Consumer the requested information about the energy
    consumption for the target service, considering all the active instances,
    in the period of time of interest.

    **CarbonFootprintResponse:**
    Provides to the API Consumer the information about the carbon footprint for
    the target service, considering all the active instances, in the period of
    time of interest.
    # Authorization and authentication
    The "Camara Security and Interoperability Profile" provides details of how
    an API consumer requests an access token. Please refer to Identity and
    Consent Management
    (https://github.com/camaraproject/IdentityAndConsentManagement/)
    for the released version of the profile.

    The specific authorization flows to be used will be agreed upon during the
    onboarding process, happening between the API consumer and the API
    provider, taking into account the declared purpose for accessing the API,
    whilst also being subject to the prevailing legal framework dictated by
    local legislation.

    In cases where personal data is processed by the API and users can
    exercise their rights through mechanisms such as opt-in and/or opt-out,
    the use of three-legged access tokens is mandatory. This ensures that
    the API remains in compliance with privacy regulations, upholding the
    principles of transparency and user-centric privacy-by-design.
    # Additional CAMARA error responses
    The list of error codes in this API specification is not exhaustive.
    Therefore the API specification may not document some non-mandatory error
    statuses as indicated in `CAMARA API Design Guide`.

    Please refer to the `CAMARA_common.yaml` of the Commonalities Release
    associated to this API version for a complete list of error responses.
    The applicable Commonalities Release can be identified in the
    `API Readiness Checklist` document associated to this API version.

    As a specific rule, error `501 - NOT_IMPLEMENTED` can be only a possible
    error response if it is explicitly documented in the API.

  version: wip
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  x-camara-commonalities: 0.6
externalDocs:
  description: Product documentation at CAMARA
  url: https://github.com/camaraproject/EnergyFootprintNotification
############################################################################
#                                     Servers                              #
############################################################################
servers:
  - url: "{apiRoot}/energy-footprint-notification/vwip"
    variables:
      apiRoot:
        default: http://localhost:9091
        description: API root, defined by the service provider, e.g.
         `api.example.com` or `api.example.com/somepath`
security:
  - notificationsBearerAuth: []
############################################################################
#                                     Tags                                #
############################################################################
tags:
  - name: Energy consumption information retrieval
    description: Request information on the energy consumption of the service.
  - name: Carbon footprint information retrieval
    description: Request information on the carbon footprint for the service.
############################################################################
#                                     Paths                                #
############################################################################
paths:
  /calculate-energy-consumption:
    post:
      tags:
        - Energy consumption information retrieval
      summary: Provides the overall Energy Consumption for the target
        Application instances in a certain period of time.
      description: Receives as input an object containing the intents from the
       API Consumer and provides back the energy consumption with a callback.
      operationId: calculateEnergyConsumption
      parameters:
        - $ref: '#/components/parameters/x-correlator'
      security:
        - openId:
            - 'energy-footprint-notification:calculate-energy-consumption'
      requestBody:
        description: Defines the application that provides the service and the
         time period under analysis.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReportCreationRequest'
      responses:
        "201":
          description: The request has been acquired. The request identifier is
           returned.
          headers:
            x-correlator:
              $ref: '#/components/headers/x-correlator'
            Location:
              description: Link to the created resource
              schema:
                type: string
                description: Link to the created resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportCreationRequest'
        "400":
          $ref: "#/components/responses/Generic400"
        "401":
          $ref: "#/components/responses/Generic401"
        "403":
          $ref: "#/components/responses/Generic403"
        "404":
          $ref: "#/components/responses/Generic404"
        "422":
          $ref: "#/components/responses/Generic422"
      callbacks:
        onEnergyConsumption:
          $ref: "#/components/callbacks/onEnergyConsumptionCalculation"
  /calculate-carbon-footprint:
    post:
      tags:
        - Carbon footprint information retrieval
      summary: Retrieves the overall carbon footprint for the target Application
        instances in a certain period of time.
      description: Receives as input an object containing the intents from the
       API Consumer and provides back the carbon footprint with a callback.
      operationId: calculateCarbonFootprint
      parameters:
        - $ref: '#/components/parameters/x-correlator'
      security:
        - openId:
            - 'energy-footprint-notification:calculate-carbon-footprint'
      requestBody:
        description: Defines the application that provides the service and the
         time period under analysis.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReportCreationRequest'
      responses:
        '201':
          description: The request has been acquired. The request identifier is
           returned.
          headers:
            x-correlator:
              $ref: '#/components/headers/x-correlator'
            Location:
              description: Link to the created resource
              schema:
                type: string
                description: Link to the created resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportCreationRequest'
        "400":
          $ref: "#/components/responses/Generic400"
        "401":
          $ref: "#/components/responses/Generic401"
        "403":
          $ref: "#/components/responses/Generic403"
        "404":
          $ref: "#/components/responses/Generic404"
        "422":
          $ref: "#/components/responses/Generic422"
      callbacks:
        onCarbonFootprintCalculation:
          $ref: "#/components/callbacks/onCarbonFootprintCalculation"
############################################################################
#                                 Components                               #
############################################################################
components:
  securitySchemes:
    openId:
      type: openIdConnect
      openIdConnectUrl: https://example.com/.well-known/openid-configuration
    notificationsBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: "{$request.body#/sinkCredential.credentialType}"
  parameters:
    x-correlator:
      name: x-correlator
      in: header
      description: Correlation id for the different services
      schema:
        $ref: "#/components/schemas/XCorrelator"
  headers:
    x-correlator:
      description: Correlation id for the different services
      schema:
        $ref: "#/components/schemas/XCorrelator"
  #########################################################################
  #                             Events/Callbacks                          #
  #########################################################################
  callbacks:
    onEnergyConsumptionCalculation:
      # when data is sent, it will be sent to the callback url provided
      "{$request.body.subscriptionRequest.sink}":
        post:
          summary: Provides back the result of the analysis on the energy
           consumption
          description: once the system has calculated the energy consumption of
           the service, this information is provided back to the API Consumer
          operationId: energyConsumptionNotification
          parameters:
            - $ref: '#/components/parameters/x-correlator'
          security:
            - notificationsBearerAuth: []
          requestBody:
            description: payload containing the calculated energy consumption
            required: true
            content:
              application/cloudevents+json:
                schema:
                  allOf:
                    - $ref: '#/components/schemas/CloudEvent'
                  example:
                    id: "string"
                    source: "https://notificationSendServer12.example.com"
                    type: "org.camaraproject.energy-footprint-notification.v1.energy"
                    specversion: "1.0"
                    datacontenttype: "application/json"
                    data:
                      requestId: "3fa85f64-5717-4562-b3fc-2c963f66afa6"
                      energyConsumption: 12.87
                    time: "2018-04-05T17:31:00Z"
          responses:
            "202":
              description: Your server implementation should return this HTTP
                status code if the data was received successfully
              headers:
                x-correlator:
                  $ref: '#/components/headers/x-correlator'
            "204":
              description: Your server should return this HTTP status code if
               no longer interested in further updates
              headers:
                x-correlator:
                  $ref: '#/components/headers/x-correlator'
            "400":
              $ref: "#/components/responses/Generic400"
            "401":
              $ref: "#/components/responses/Generic401"
            "403":
              $ref: "#/components/responses/Generic403"
            "410":
              $ref: "#/components/responses/Generic410"
            "429":
              $ref: "#/components/responses/Generic429"
    onCarbonFootprintCalculation:
      # when data is sent, it will be sent to the callback url provided
      '{$request.body.subscriptionRequest.sink}':
        post:
          summary: Provides back the result of the analysis on the carbon
            footprint
          description: once the system has calculated the carbon footprint of
           the service, this information is provided back to the API Consumer
          operationId: carbonFootprintNotification
          parameters:
            - $ref: '#/components/parameters/x-correlator'
          security:
            - notificationsBearerAuth: []
          requestBody:
            description: payload containing the calculated energy consumption
            content:
              application/cloudevents+json:
                schema:
                  $ref: '#/components/schemas/CloudEvent'
                example:
                  id: "string"
                  source: "https://notificationSendServer12.example.com"
                  type: "org.camaraproject.energy-footprint-notification.v1.carbon-footprint"
                  specversion: "1.0"
                  datacontenttype: "application/json"
                  data:
                    requestId: "3fa85f64-5717-4562-b3fc-2c963f66afa6"
                    carbonFootprint: 45.568
                  time: "2018-04-05T17:31:00Z"
          responses:
            "202":
              description: Your server implementation should return this HTTP
                status code if the data was received successfully
              headers:
                x-correlator:
                  $ref: '#/components/headers/x-correlator'
            "204":
              description: Your server should return this HTTP status code if
               no longer interested in further updates
              headers:
                x-correlator:
                  $ref: '#/components/headers/x-correlator'
            "400":
              $ref: "#/components/responses/Generic400"
            "401":
              $ref: "#/components/responses/Generic401"
            "403":
              $ref: "#/components/responses/Generic403"
            "410":
              $ref: "#/components/responses/Generic410"
            "429":
              $ref: "#/components/responses/Generic429"
  ############################################################################
  #                                 Resources                                #
  ############################################################################
  schemas:
    SubscriptionRequest:
      description: The request for creating a event-type event subscription
      type: object
      required:
        - sink
        - protocol
        - config
        - types
      properties:
        protocol:
          $ref: "#/components/schemas/Protocol"
        sink:
          type: string
          format: uri
          pattern: ^https:\/\/.+$
          description: The address to which events shall be delivered using the selected protocol.
          example: "https://endpoint.example.com/sink"
        sinkCredential:
          $ref: "#/components/schemas/SinkCredential"
        types:
          description: |
            Camara Event types eligible to be delivered by this subscription.
            Note: the maximum number of event types per subscription will be decided at API project level
          type: array
          minItems: 1
          maxItems: 2
          items:
            $ref: "#/components/schemas/SubscriptionEventType"
        config:
          $ref: "#/components/schemas/Config"
      discriminator:
        propertyName: protocol
        mapping:
          HTTP: "#/components/schemas/HTTPSubscriptionRequest"
    HTTPSubscriptionRequest:
      allOf:
        - $ref: "#/components/schemas/SubscriptionRequest"
        - type: object
          properties:
            protocolSettings:
              $ref: "#/components/schemas/HTTPSettings"
    HTTPSettings:
      type: object
      properties:
        headers:
          type: object
          description: |-
            A set of key/value pairs that is copied into the HTTP request as custom headers.

            NOTE: Use/Applicability of this concept has not been discussed in Commonalities under the scope of Meta Release v0.4. When required by an API project as an option to meet a UC/Requirement, please generate an issue for Commonalities discussion about it.
          additionalProperties:
            type: string
        method:
          type: string
          description: The HTTP method to use for sending the message.
          enum:
            - POST
    Protocol:
      type: string
      enum: ["HTTP", "MQTT3", "MQTT5", "AMQP", "NATS", "KAFKA"]
      description: Identifier of a delivery protocol. Only HTTP is allowed for now
      example: "HTTP"
    Config:
      description: |
        Implementation-specific configuration parameters needed by the subscription manager for acquiring events.
        In CAMARA we have predefined attributes like `subscriptionExpireTime`, `subscriptionMaxEvents`, `initialEvent`
        Specific event type attributes must be defined in `subscriptionDetail`
        Note: if a request is performed for several event type, all subscribed event will use same `config` parameters.
      type: object
      required:
        - subscriptionDetail
      properties:
        subscriptionDetail:
          $ref: "#/components/schemas/CreateSubscriptionDetail"
        subscriptionExpireTime:
          type: string
          format: date-time
          example: 2023-01-17T13:18:23.682Z
          description: The subscription expiration time (in date-time format) requested by the API consumer. It must follow [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) and must have time zone. Up to API project decision to keep it.
        subscriptionMaxEvents:
          type: integer
          description: Identifies the maximum number of event reports to be generated (>=1) requested by the API consumer - Once this number is reached, the subscription ends. Up to API project decision to keep it.
          minimum: 1
          example: 5
        initialEvent:
          type: boolean
          description: |
            Set to `true` by API consumer if consumer wants to get an event as soon as the subscription is created and current situation reflects event request.
            Example: Consumer request Roaming event. If consumer sets initialEvent to true and device is in roaming situation, an event is triggered
            Up to API project decision to keep it.
    SinkCredential:
      description: A sink credential provides authentication or authorization information necessary to enable delivery of events to a target.
      type: object
      example:
        credentialType: ACCESSTOKEN
      properties:
        credentialType:
          type: string
          enum:
            - PLAIN
            - ACCESSTOKEN
            - REFRESHTOKEN
          description: |
            The type of the credential.
            Note: Type of the credential - MUST be set to ACCESSTOKEN for now
      discriminator:
        propertyName: credentialType
        mapping:
          PLAIN: "#/components/schemas/PlainCredential"
          ACCESSTOKEN: "#/components/schemas/AccessTokenCredential"
          REFRESHTOKEN: "#/components/schemas/RefreshTokenCredential"
      required:
        - credentialType
    PlainCredential:
      type: object
      description: A plain credential as a combination of an identifier and a secret.
      allOf:
        - $ref: "#/components/schemas/SinkCredential"
        - type: object
          required:
            - identifier
            - secret
          properties:
            identifier:
              description: The identifier might be an account or username.
              type: string
            secret:
              description: The secret might be a password or passphrase.
              type: string
    AccessTokenCredential:
      type: object
      description: An access token credential.
      allOf:
        - $ref: "#/components/schemas/SinkCredential"
        - type: object
          properties:
            accessToken:
              description: REQUIRED. An access token is a previously acquired token granting access to the target resource.
              type: string
            accessTokenExpiresUtc:
              type: string
              format: date-time
              description: |
                REQUIRED. An absolute (UTC) timestamp at which the token shall be considered expired.
                In the case of an ACCESS_TOKEN_EXPIRED termination reason, implementation should notify the client before the expiration date.
                If the access token is a JWT and registered "exp" (Expiration Time) claim is present, the two expiry times should match.
                It must follow [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) and must have time zone.
              example: "2023-07-03T12:27:08.312Z"
            accessTokenType:
              description: REQUIRED. Type of the access token (See [OAuth 2.0](https://tools.ietf.org/html/rfc6749#section-7.1)).
              type: string
              enum:
                - bearer
          required:
            - accessToken
            - accessTokenExpiresUtc
            - accessTokenType
    RefreshTokenCredential:
      type: object
      description: An access token credential with a refresh token.
      allOf:
        - $ref: "#/components/schemas/SinkCredential"
        - type: object
          properties:
            accessToken:
              description: REQUIRED. An access token is a previously acquired token granting access to the target resource.
              type: string
            accessTokenExpiresUtc:
              type: string
              format: date-time
              description: |
                REQUIRED. An absolute (UTC) timestamp at which the token shall be considered expired.
                In the case of an ACCESS_TOKEN_EXPIRED termination reason, implementation should notify the client before the expiration date.
                If the access token is a JWT and registered "exp" (Expiration Time) claim is present, the two expiry times should match.
                It must follow [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) and must have time zone.
              example: "2023-07-03T12:27:08.312Z"
            accessTokenType:
              description: REQUIRED. Type of the access token (See [OAuth 2.0](https://tools.ietf.org/html/rfc6749#section-7.1)).
              type: string
              enum:
                - bearer
            refreshToken:
              description: REQUIRED. An refresh token credential used to acquire access tokens.
              type: string
            refreshTokenEndpoint:
              type: string
              format: uri
              description: REQUIRED. A URL at which the refresh token can be traded for an access token.
      required:
        - accessToken
        - accessTokenExpiresUtc
        - accessTokenType
        - refreshToken
        - refreshTokenEndpoint
    CreateSubscriptionDetail:
      description: The detail of the requested event subscription.
      type: object
    EventTypeNotification:
      type: string
      description: Event triggered when an event-type event occurred.
      enum:
        - org.camaraproject.energy-footprint-notification.v1.energy
        - org.camaraproject.energy-footprint-notification.v1.carbon-footprint
    SubscriptionEventType:
      type: string
      description: |
        event-type that could be subscribed through this subscription. Several event-type could be defined.
      enum:
        - org.camaraproject.energy-footprint-notification.v1.energy
        - org.camaraproject.energy-footprint-notification.v1.carbon-footprint
    ReportCreationRequest:
      description: resource containing the service under analysis and the
        callback information for the API Consumer to be notified with the
        results of the analysis. If no "timePeriod" is provided the analysis
        is performed from the activation of the first instance of the
        Application.
      type: object
      properties:
        service:
          type: array
          description: list of Application Instance Identifiers. This are the
            instances of the applications producing the service under analysis.
          items:
            $ref: '#/components/schemas/AppInstanceId'
        timePeriod:
          $ref: "#/components/schemas/TimePeriod"
        subscriptionRequest:
          $ref: '#/components/schemas/SubscriptionRequest'
        requestId:
          type: string
          description: Identifier for the request. This
           parameter is returned by the API and must be used to update it.
          readOnly: true
      required:
        - service
        - subscriptionRequest
    AppInstanceId:
      type: string
      format: uuid
      description: |
        A globally unique identifier associated with a running
        instance of an application.
        Edge Cloud Platform generates this identifier when the
        instantiation in the Edge Cloud Zone is successful
    DateTime:
      type: string
      format: date-time
      description: |
        Timestamp of when the occurrence happened. Must adhere to RFC 3339.
        WARN: This optional field in CloudEvents specification is required in
        CAMARA APIs implementation.
      example: '2018-04-05T17:31:00Z'
    Source:
      type: string
      format: uri-reference
      minLength: 1
      description: |
        Identifies the context in which an event happened - be a non-empty
        `URI-reference` like:
        - URI with a DNS authority:
          * https://github.com/cloudevents
          * mailto:cncf-wg-serverless@lists.cncf.io
        - Universally-unique URN with a UUID:
          * urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66
        - Application-specific identifier:
          * /cloudevents/spec/pull/123
          * 1-555-123-4567
      example: "https://notificationSendServer12.example.com"
    TimePeriod:
      properties:
        startDate:
          type: string
          format: date-time
          description: An instant of time, starting of the TimePeriod. It must follow [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) and must have time zone.
        endDate:
          type: string
          format: date-time
          description: An instant of time, ending of the TimePeriod. If not included, then the period has no ending date. It must follow [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) and must have time zone.
      required:
        - startDate
    CloudEvent:
      description: The notification callback
      required:
        - id
        - source
        - specversion
        - type
        - time
      properties:
        id:
          type: string
          description: identifier of this event, that must be unique in the
            source context.
          minLength: 1
        source:
          $ref: '#/components/schemas/Source'
        type:
          $ref: "#/components/schemas/EventTypeNotification"
        specversion:
          type: string
          description: Version of the specification to which this event conforms
            (must be 1.0 if it conforms to cloudevents 1.0.2 version)
          enum:
            - "1.0"
        datacontenttype:
          type: string
          description: 'media-type that describes the event payload encoding,
            must be "application/json" for CAMARA APIs'
          enum:
            - application/json
        data:
          type: object
          description: Event details payload described in each CAMARA API and
            referenced by its type
        time:
          $ref: "#/components/schemas/DateTime"
      discriminator:
        propertyName: "type"
        mapping:
          org.camaraproject.energy-footprint-notification.v1.energy: "#/components/schemas/CloudEventEnergy"
          org.camaraproject.energy-footprint-notification.v1.energy.error: "#/components/schemas/CloudEventError"
          org.camaraproject.energy-footprint-notification.v1.carbon-footprint: "#/components/schemas/CloudEventCarbonFootprint"
          org.camaraproject.energy-footprint-notification.v1.carbon-footprint.error: "#/components/schemas/CloudEventError"
    CloudEventEnergy:
      description: provides back the energy consumption for the service. The
        result of the analysis is a floating point number. The unit of measure
        is Kw/h.
      allOf:
        - $ref: "#/components/schemas/CloudEvent"
      properties:
        data:
          type: object
          description: Event details payload
          properties:
            requestId:
              type: string
              description: Identifier for the request. This
               parameter correlates this response with the request.
              readOnly: false
            energyConsumption:
              type: number
              format: float
              example: 12.345
              description: the  energy consumption for all the instances of the
                service. The API is asynchronous, for this reason the value will be
                returned back via a callback
    CloudEventCarbonFootprint:
      description: provides back the carbon footprint of the service. The result
       of the analysis is a floating point number. The unit of measure is
       tonnes.
      allOf:
        - $ref: "#/components/schemas/CloudEvent"
      properties:
        data:
          type: object
          description: Event details payload
          properties:
            requestId:
              type: string
              description: Identifier for the request. This
               parameter correlates this response with the request.
              readOnly: false
            carbonFootprint:
              type: number
              format: float
              example: 45.568
              description: the  carbon footprint for all the instances of the
                service. The API is asynchronous, for this reason the value will be
                returned back via a callback
    XCorrelator:
      type: string
      pattern: ^[a-zA-Z0-9-_:;.\/<>{}]{0,256}$
      example: "b4333c46-49c0-4f62-80d7-f0ef930f1c46"
    ############################################################################
    #                                 Responses                                #
    ############################################################################
    ErrorInfo:
      type: object
      required:
        - status
        - code
        - message
      properties:
        status:
          type: integer
          description: HTTP response status code
        code:
          type: string
          description: A human-readable code to describe the error
        message:
          type: string
          description: A human-readable description of what the event represents
  responses:
    Generic400:
      description: Bad Request
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 400
                  code:
                    enum:
                      - INVALID_ARGUMENT
                      - OUT_OF_RANGE
          examples:
            GENERIC_400_INVALID_ARGUMENT:
              description: Invalid Argument. Generic Syntax Exception
              value:
                status: 400
                code: INVALID_ARGUMENT
                message: Client specified an invalid argument, request body or
                  query param.
            GENERIC_400_OUT_OF_RANGE:
              description: Out of Range. Specific Syntax Exception used when a
                given field has has an unsupported value.
              value:
                status: 400
                code: OUT_OF_RANGE
                message: Client specified an invalid range.
    Generic401:
      description: Unauthorized
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 401
                  code:
                    enum:
                      - UNAUTHENTICATED
          examples:
            GENERIC_401_UNAUTHENTICATED:
              description: Request cannot be authenticated and a new authentication
                is required
              value:
                status: 401
                code: UNAUTHENTICATED
                message: Request not authenticated due to missing, invalid, or expired
                  credentials. A new authentication is required.
    Generic403:
      description: Forbidden
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 403
                  code:
                    enum:
                      - PERMISSION_DENIED
          examples:
            GENERIC_403_PERMISSION_DENIED:
              description: Permission denied. Access token does not have
                the required scope or when the user fails operational security
              value:
                status: 403
                code: PERMISSION_DENIED
                message: Client does not have sufficient permissions to perform
                  this action.
    Generic404:
      description: Not found
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 404
                  code:
                    enum:
                      - NOT_FOUND
                      - ENERGY_FOOTPRINT_NOTIFICATION.UNKNOWN_APPLICATION_IDENTIFIER
          examples:
            GENERIC_404_NOT_FOUND:
              description: Resource is not found
              value:
                status: 404
                code: NOT_FOUND
                message: The specified resource is not found.
            GENERIC_404_IDENTIFIER_NOT_FOUND:
              description: Application Identifier unknown
              value:
                status: 404
                code: ENERGY_FOOTPRINT_NOTIFICATION.UNKNOWN_APPLICATION_IDENTIFIER
                message: The target application is unknown.
    Generic409:
      description: Conflict
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 409
                  code:
                    enum:
                      - ABORTED
                      - ALREADY_EXISTS
          examples:
            GENERIC_409_ABORTED:
              description: Concurreny of processes of the same nature/scope
              value:
                status: 409
                code: ABORTED
                message: Concurrency conflict.
            GENERIC_409_ALREADY_EXISTS:
              description: Trying to create an existing resource
              value:
                status: 409
                code: ALREADY_EXISTS
                message: The resource that a client tried to create already exists.
    Generic410:
      description: Gone
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 410
                  code:
                    enum:
                      - GONE
          examples:
            GENERIC_410_GONE:
              description: Use in notifications flow to allow API Consumer to indicate that its callback is no longer available
              value:
                status: 410
                code: GONE
                message: Access to the target resource is no longer available.
    Generic422:
      description: Unprocessable Content
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 422
                  code:
                    enum:
                      - SERVICE_NOT_APPLICABLE
                      - ENERGY_FOOTPRINT_NOTIFICATION.TIME_PERIOD_OUT_OF_RANGE
          examples:
            GENERIC_422_SERVICE_NOT_APPLICABLE:
              description: Service not applicable for the provided
                identifier
              value:
                status: 422
                code: SERVICE_NOT_APPLICABLE
                message: The service is not available for the
                  provided identifier.
            GENERIC_422_TIME_PERIOD_OUT_OF_RANGE:
              description: The parameter "timePeriod" in the request doesn't provide a correct range. The range can be too long with respect to the maximum possibile duration supported by the platform. Or startDate/endDate are not choerent with the API subscription.
              value:
                status: 422
                code: ENERGY_FOOTPRINT_NOTIFICATION.TIME_PERIOD_OUT_OF_RANGE
                message: The requested time period for the evaluation is not a valid range.
    Generic429:
      description: Too Many Requests
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 429
                  code:
                    enum:
                      - QUOTA_EXCEEDED
                      - TOO_MANY_REQUESTS
          examples:
            GENERIC_429_QUOTA_EXCEEDED:
              description: Request is rejected due to exceeding a
                business quota limit
              value:
                status: 429
                code: QUOTA_EXCEEDED
                message: Out of resource quota.
            GENERIC_429_TOO_MANY_REQUESTS:
              description: Access to the API has been temporarily
                blocked due to rate or spike arrest limits being reached
              value:
                status: 429
                code: TOO_MANY_REQUESTS
                message: Rate limit reached.