openapi: 3.0.3
info:
  title: Service Policies API
  description: >
    Service Policies API is used for viewing and managing service policies.


    GET endpoints in this API are designed with a high degree of flexibility. This section will explain how to make use of this.


    A GET request returns information associated with the requested resource. This information is found in the `attributes` property in the response body. All properties marked as required will be returned.

    Certain GET endpoints includes a property named `relationships` in the response body. The `relationships` property contains URL paths to all related resources. These paths can be used to perform HTTP GET requests in order to fetch the data belonging to the related resource. 

    Some GET endpoints that includes the property named `relationships` supports the query parameter `include` with different values being allowed on different endpoints. Setting the `include` query parameter will result in the `attributes` property being added to the corresponding relationship. This is great if you know that you need information which is spread out across many different resources. Instead of making multiple API requests you can use the `include` query parameter to get a lot of data at once in the `relationships` property. Note that using this query parameter may lead to longer response times so only include what you actually need.

  license:
    name: Telenor Connexion Public License - v 1.0
    url: https://www.telenorconnexion.com
  termsOfService: https://www.telenorconnexion.com/terms-of-service
  contact:
    name: Telenor Connexion Support
    email: it-operations@telenorconnexion.com
    url: https://www.telenorconnexion.com
  version: 1.3.0
servers:
  - url: https://api.iot.telenor.com
tags:
  - name: IoT Platform service policies
    description: Service policies associated with IoT Platform.
  - name: CMP specific service policies
    description: Service policies associated with specific connectivity management platforms (CMPs).
paths:
  /iot-connect/service-policies/v1/iot-platform:
    get:
      x-amazon-apigateway-integration: &aws-gateway
        uri:
          Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${PubServicePoliciesFunction.Arn}/invocations
        passthroughBehavior: when_no_match
        httpMethod: POST
        type: aws_proxy
      tags:
        - IoT Platform service policies
      summary: Get all service policies
      description: Returns a list of all service policies available to the enterprise.
      parameters:
        - $ref: '#/components/parameters/domainId'
        - $ref: '#/components/parameters/includeSubdomains'
        - $ref: '#/components/parameters/key'
        - $ref: '#/components/parameters/value'
      responses:
        200:
          description: List of service policies.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/servicePolicyResponse'
        400: &error
          $ref: '#/components/responses/problemResponse'
        401: *error
        403: *error
        500: *error

  /iot-connect/service-policies/v1/iot-platform/{servicePolicyId}:
    get:
      x-amazon-apigateway-integration: *aws-gateway
      tags:
        - IoT Platform service policies
      summary: Get a service policy.
      description: Fetches a service policy. Connectivity subscriptions can be associated with service policies (separate endpoint). The service policy has configuration and information which applies to all associated subscriptions.
      parameters:
        - $ref: '#/components/parameters/servicePolicyIdInPath'
        - $ref: '#/components/parameters/includeQueryForServicePolicy'
      responses:
        200:
          description: Contains the requested service policy.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/singleServicePolicyResponse'
        400: *error
        401: *error
        403: *error
        404: *error
        500: *error

  /iot-connect/service-policies/v1/iot-platform/{servicePolicyId}/metadata:
    post:
      x-amazon-apigateway-integration: *aws-gateway
      tags:
        - IoT Platform service policy metadata
      summary: Create a new metadata entry.
      description: Creates a metadata key-value pair on a service policy. Will fail if the key already exists (409).
      parameters:
        - $ref: '#/components/parameters/servicePolicyIdInPath'
      requestBody:
        description: Specifies the new metadata key and value pair.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/metadataEntry'
      responses:
        204:
          description: Metadata created successfully.
          headers:
            Content-Location:
              $ref: '#/components/headers/content-Location'
        400: *error
        401: *error
        403: *error
        404: *error
        409: *error
        500: *error

    delete:
      x-amazon-apigateway-integration: *aws-gateway
      tags:
        - IoT Platform service policy metadata
      summary: Delete all metadata.
      description: Deletes all metadata key-value pairs on a service policy.
      parameters:
        - $ref: '#/components/parameters/servicePolicyIdInPath'
      responses:
        204:
          description: Metadata deleted successfully.
        400: *error
        401: *error
        403: *error
        404: *error
        500: *error

  /iot-connect/service-policies/v1/iot-platform/{servicePolicyId}/metadata/{key}:
    put:
      x-amazon-apigateway-integration: *aws-gateway
      tags:
        - IoT Platform service policy metadata
      summary: Update a metadata value.
      description: Updates the value for the specified metadata key.
      requestBody:
        description: Specifies the new metadata value to update to.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/metadataUpdateValue'
      parameters:
        - $ref: '#/components/parameters/servicePolicyIdInPath'
        - name: key
          in: path
          description: The metadata key to update.
          required: true
          schema:
            type: string
            maxLength: 100
      responses:
        204:
          description: Metadata updated successfully.
          headers:
            Content-Location:
              $ref: '#/components/headers/content-Location'
        400: *error
        401: *error
        403: *error
        404: *error
        500: *error

    delete:
      x-amazon-apigateway-integration: *aws-gateway
      tags:
        - IoT Platform service policy metadata
      summary: Delete a metadata entry.
      description: Deletes the service policy metadata key and its corresponding value.
      parameters:
        - $ref: '#/components/parameters/servicePolicyIdInPath'
        - name: key
          in: path
          description: The metadata key to delete.
          required: true
          schema:
            type: string
            maxLength: 100
      responses:
        204:
          description: Metadata deleted successfully.
        400: *error
        401: *error
        403: *error
        404: *error
        500: *error

  /iot-connect/service-policies/v1/iota/{iotaInstance}/{id}:
    get:
      x-amazon-apigateway-integration: *aws-gateway
      tags:
        - CMP specific service policies
      summary: Get an IoTA service policy.
      description: Fetches an IoTA subscription package. The subscription package is represented through a service policy (separate endpoint).
      parameters:
        - $ref: '#/components/parameters/iotaInstanceInPath'
        - $ref: '#/components/parameters/iotaServicePolicyIdInPath'
      responses:
        200:
          description: Contains the requested service policy (IoTA subscription package).
          content:
            application/json:
              schema:
                type: object
                required:
                  - attributes
                properties:
                  attributes:
                    $ref: '#/components/schemas/iotaServicePolicyAttributes'
        400: *error
        401: *error
        403: *error
        404: *error
        429: *error
        500: *error

  /iot-connect/service-policies/v1/arqia/{arqiaInstance}/{id}:
    get:
      x-amazon-apigateway-integration: *aws-gateway
      tags:
        - CMP specific service policies
      summary: Get an Arqia service policy.
      description: Fetches an Arqia plano. The plano is represented through a service policy (separate endpoint).
      parameters:
        - $ref: '#/components/parameters/arqiaInstanceInPath'
        - $ref: '#/components/parameters/arqiaServicePolicyIdInPath'
      responses:
        200:
          description: Contains the requested service policy (Arqia plano).
          content:
            application/json:
              schema:
                type: object
                required:
                  - attributes
                properties:
                  attributes:
                    $ref: '#/components/schemas/arqiaServicePolicyAttributes'
        400: *error
        401: *error
        403: *error
        404: *error
        500: *error

  /iot-connect/service-policies/v1/thingspace/{thingspaceInstance}/{id}:
    get:
      x-amazon-apigateway-integration: *aws-gateway
      tags:
        - CMP specific service policies
      summary: Get a Thingspace service policy.
      description: Contains the requested service policy (Thingspace service plan).
      parameters:
        - $ref: '#/components/parameters/thingspaceInstanceInPath'
        - $ref: '#/components/parameters/thingspaceServicePolicyIdInPath'
      responses:
        200:
          description: Contains the requested service policy (Thingspace service plan).
          content:
            application/json:
              schema:
                type: object
                required:
                  - attributes
                properties:
                  attributes:
                    $ref: '#/components/schemas/thingspaceServicePolicyAttributes'
        400: *error
        404: *error
        500: *error

  /iot-connect/service-policies/v1/stc/{stcInstance}/{id}:
    get:
      x-amazon-apigateway-integration: *aws-gateway
      tags:
        - CMP specific service policies
      summary: Get an STC service profile.
      description: Contains the requested service policy (STC service profile).
      parameters:
        - $ref: '#/components/parameters/stcInstanceInPath'
        - $ref: '#/components/parameters/stcServicePolicyIdInPath'
      responses:
        200:
          description: Contains the requested service policy (STC service profile).
          content:
            application/json:
              schema:
                type: object
                required:
                  - attributes
                properties:
                  attributes:
                    $ref: '#/components/schemas/stcServicePolicyAttributes'
        400: *error
        404: *error
        500: *error

  '/{proxy+}':
    options:
      tags:
        - CORS
      summary: Handle CORS OPTIONS requests
      description: Used for returning CORS headers for OPTIONS requests.
      parameters:
        - $ref: '#/components/parameters/proxyInPath'
      responses:
        200:
          description: CORS response
      x-amazon-apigateway-integration: *aws-gateway
    get:
      tags:
        - CORS
      summary: Handle CORS OPTIONS requests
      description: Used for returning CORS headers for OPTIONS requests.
      parameters:
        - $ref: '#/components/parameters/proxyInPath'
      responses:
        200:
          description: CORS response
      x-amazon-apigateway-integration: *aws-gateway

components:
  parameters:
    servicePolicyIdInPath:
      in: path
      name: servicePolicyId
      description: Service policy ID to perform request on.
      required: true
      schema:
        $ref: '#/components/schemas/iotPlatformServicePolicyId'
    iotaServicePolicyIdInPath:
      in: path
      name: id
      description: Service policy in IoTA (i.e. subscription package) to perform request on.
      required: true
      schema:
        type: string
    iotaInstanceInPath:
      in: path
      name: iotaInstance
      description: IoTA instance where the service policy is configured.
      required: true
      schema:
        type: string
        enum: [iota_eu]
    arqiaServicePolicyIdInPath:
      in: path
      name: id
      description: Service policy in Arqia (i.e. plano) to perform request on.
      required: true
      schema:
        type: string
    arqiaInstanceInPath:
      in: path
      name: arqiaInstance
      description: Arqia instance where the service policy is configured.
      required: true
      schema:
        type: string
        enum: [arqia_br]
    thingspaceServicePolicyIdInPath:
      in: path
      name: id
      description: Service policy in Thingspace (i.e. service plan) to perform request on.
      required: true
      schema:
        type: string
    thingspaceInstanceInPath:
      in: path
      name: thingspaceInstance
      description: Thingspace instance where the service policy is configured.
      required: true
      schema:
        type: string
        enum: [thingspace_us]
    stcServicePolicyIdInPath:
      in: path
      name: id
      description: Service policy in STC (i.e. service profile) to perform request on.
      required: true
      schema:
        type: string
    stcInstanceInPath:
      in: path
      name: stcInstance
      description: STC instance where the service policy is configured.
      required: true
      schema:
        type: string
        enum: [stc_sa]
    includeQueryForServicePolicy:
      in: query
      name: include
      description: Related resources to include in response. Format as a comma separated list. Omitting this query parameter means that no related resources will be included in response. Note that including resources may result in longer response times so only include what you actually need.
      required: false
      explode: false
      schema:
        type: array
        items:
          type: string
          enum: [cmpServicePolicy]
    domainId:
      in: query
      name: domainId
      description: Domain id for a service policy to filter on. If omitted, the domain to which the user belongs is used as default.
      schema:
        $ref: '#/components/schemas/domainId'
    includeSubdomains:
      in: query
      name: includeSubdomains
      description: Determines if service policies for subdomains should be included when filtering on domain id.
      schema:
        type: boolean
    key:
      in: query
      name: key
      description: Name of `key` in a metadata key-value pair to filter on. Case insensitive exact match is used for the `key` query parameter meaning that only keys that are identical to the `key` query parameter are matched.
      schema:
        type: string
        example: model
    value:
      in: query
      name: value
      description: Name of the `value` in the metadata key-value pair to filter on. Case insensitive wildcard-based match is used for the `value` query parameter meaning that if the `value` query parameter is `query`, all results matching `*query*` will be returned. The `key` parameter is mandatory if the `value` parameter is included in the request.
      schema:
        type: string
        example: 1xx
    proxyInPath:
      in: path
      required: true
      name: proxy+
      description: >
        Matches all OPTIONS request for all endpoints and returns CORS headers to allow cross domain requests.
      schema:
        type: string
  securitySchemes:
    TokenAuthorizer:
      type: http
      scheme: bearer
      bearerFormat: JWT
  responses:
    problemResponse:
      description: RFC 9457 compliant problem details response.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/problemDetails'

  schemas:
    apnName:
      type: string
      pattern: ^[a-zA-Z0-9.]{3,256}$
      example: internet.lte.cxn
    servicePolicyBaseAttributes:
      type: object
      required:
        - id
        - cmpServicePolicyId
        - domainId
        - name
        - metadata
      properties:
        id:
          $ref: '#/components/schemas/iotPlatformServicePolicyId'
        cmpServicePolicyId:
          type: string
          description: Identifies the service policy in the Connectivity Management Platform (CMP).
          example: 'E1245_SP_02'
        domainId:
          $ref: '#/components/schemas/domainId'
        name:
          $ref: '#/components/schemas/servicePolicyName'
        metadata:
          $ref: '#/components/schemas/servicePolicyMetadata'
    servicePolicyAttributes:
      allOf:
        - $ref: '#/components/schemas/servicePolicyBaseAttributes'
        - type: object
          required:
            - type
          properties:
            type:
              type: string
              description: Specifies the underlying service policy type in the Connectivity Management Platform (CMP).
              enum: [IOTA_SERVICE_POLICY, THINGSPACE_SERVICE_POLICY, STC_SERVICE_POLICY]
    servicePolicyAttributesArqia:
      allOf:
        - $ref: '#/components/schemas/servicePolicyBaseAttributes'
        - type: object
          required:
            - type
            - commitmentTimeMonths
            - apns
          properties:
            type:
              type: string
              description: Specifies the underlying service policy type in the Connectivity Management Platform (CMP).
              enum: [ARQIA_SERVICE_POLICY]
            commitmentTimeMonths:
              type: number
              nullable: true
            apns:
              type: array
              description: List of underlying APNs in the Connectivity Management Platform (CMP).
              items:
                type: object
                required:
                  - apnId
                  - apnName
                properties:
                  apnId: 
                    type: number
                    description: Identifies the APN.
                    example: 1001
                  apnName:
                    type: string
                    description: The APN name.
                    example: internet.lte.cxn
            trmLimitDataKbs:
              type: number
              nullable: true
              description: How many kilobytes of data can be consumed before the subscription exits test ready mode (TRM).
            trmLimitMonths:
              type: number
              nullable: true
              description: Maximum amount of months the subscription is allowed to be in test ready mode (TRM).
    metadataEntry:
      description: Metadata allows a user to assign and manage their own
        self-defined key-value pairs to a service policy. Custom metadata enables
        user-defined terminology to be used when identifying the policy, for
        instance intended application and usage of the service policy.
      type: object
      required:
        - key
        - value
      properties:
        key:
          description: The metadata key
          type: string
          example: origin
          maxLength: 100
          minLength: 1
        value:
          description: The metadata value
          type: string
          example: China
          maxLength: 100
          minLength: 1
    iotaServicePolicyAttributes:
      type: object
      description: Attributes used to describe an IoTA subscription package.
      required:
        - id
        - description
        - services
        - apns
        - roamingProfiles
      properties:
        id:
          $ref: '#/components/schemas/cmpServicePolicyId'
        description:
          type: string
          description: The subscription package's description in IoTA.
          example: 5 MB Europe
        services:
          type: object
          required:
            - bearerServices
            - lteRadioAccessTechnologyRestrictions
            - supplementaryServices
          properties:
            bearerServices:
              type: object
              properties:
                2g3g:
                  type: boolean
                  description: 2G and 3G.
                lte:
                  type: boolean
                  description: Long Term Evolution.
                smsMo:
                  type: boolean
                  description: SMS Mobile Originated.
                smsMt:
                  type: boolean
                  description: SMS Mobile Terminated.
                voice:
                  type: boolean
            lteRadioAccessTechnologyRestrictions:
              type: object
              required:
                - 2g
                - 3g
                - lte
                - nbIot
                - 5g
              properties:
                2g:
                  type: boolean
                3g:
                  type: boolean
                lte:
                  type: boolean
                  description: Long Term Evolution.
                nbIot:
                  type: boolean
                  description: Narrowband Internet of Things.
                5g:
                  type: boolean
            supplementaryServices:
              type: object
              required:
                - baoc
                - baic
                - boic
                - ard
                - obopre
              properties:
                baoc:
                  type: boolean
                  description: Barring of all outgoing calls.
                baic:
                  type: boolean
                  description: Barring of all incoming calls.
                boic:
                  type: boolean
                  description: Barring of outgoing international calls.
                ard:
                  type: string
                  description: Access data restriction.
                  enum: [NO_RESTRICTIONS, 2G_BLOCKED, 3G_BLOCKED, 4G_BLOCKED]
                obopre:
                  type: boolean
                  description: Barring of outgoing premium rate calls (entertainment).
        apns:
          type: array
          items:
            type: object
            required:
              - apnName
            properties:
              apnName:
                $ref: '#/components/schemas/apnName'
        roamingProfiles:
          type: object
          required:
            - 2g3g
            - lte
          properties:
            2g3g:
              type: object
              required:
                - id
                - description
              properties:
                id:
                  type: string
                  minLength: 1
                  maxLength: 64
                  example: RP953
                description:
                  type: string
                  maxLength: 256
                  description: Connexion 953
            lte:
              type: object
              required:
                - id
                - description
                - version
              properties:
                id:
                  type: string
                  minLength: 1
                  maxLength: 64
                  example: RP954
                description:
                  type: string
                  maxLength: 256
                  description: Connexion 954 LTE
                version:
                  type: string
                  enum: [v1, v2]
    arqiaServicePolicyRelationship:
      type: object
      description: References an Arqia service policy (plano) that is related to this resource. The `url` property can be used to GET the resource. The `attributes` property will be omitted unless the query parameter specifies the inclusion of this resource. If present, the `attributes` property will only contain properties marked as required.
      required:
        - url
      properties:
        url:
          type: string
          minLength: 1
          maxLength: 256
          example: /iot-connect/service-policies/v1/arqia_br/9.25.2.986.1.5.2.6.1.1.1.30.100.100.20480.1.10.953
        attributes:
          $ref: '#/components/schemas/arqiaServicePolicyAttributes'
      example:
        url: /iot-connect/service-policies/v1/arqia/arqia_br/9.25.2.986.1.5.2.6.1.1.1.30.100.100.20480.1.10.953
    simpleArqiaServicePolicyRelationship:
      type: object
      description: References an Arqia service policy (plano) that is related to this resource. The `url` property can be used to GET the resource.
      required:
        - url
      properties:
        url:
          type: string
          minLength: 1
          maxLength: 256
          example: /iot-connect/service-policies/v1/arqia_br/9.25.2.986.1.5.2.6.1.1.1.30.100.100.20480.1.10.953
      example:
        url: /iot-connect/service-policies/v1/arqia/arqia_br/9.25.2.986.1.5.2.6.1.1.1.30.100.100.20480.1.10.953
    iotaServicePolicyRelationship:
      type: object
      description: References an IoTA service policy (subscription package) that is related to this resource. The `url` property can be used to GET the resource. The `attributes` property will be omitted unless the query parameter specifies the inclusion of this resource. If present, the `attributes` property will only contain properties marked as required.
      required:
        - url
      properties:
        url:
          type: string
          minLength: 1
          maxLength: 256
          example: /iot-connect/service-policies/v1/iota/iota_eu/E1245_SP_02
        attributes:
          $ref: '#/components/schemas/iotaServicePolicyAttributes'
      example:
        url: /iot-connect/service-policies/v1/iota/iota_eu/E1245_SP_02
    simpleIotaServicePolicyRelationship:
      type: object
      description: References an IoTA service policy (subscription package) that is related to this resource. The `url` property can be used to GET the resource.
      required:
        - url
      properties:
        url:
          type: string
          minLength: 1
          maxLength: 256
          example: /iot-connect/service-policies/v1/iota/iota_eu/E1245_SP_02
      example:
        url: /iot-connect/service-policies/v1/iota/iota_eu/E1245_SP_02
    arqiaServicePolicyAttributes:
      type: object
      description: Attributes used to describe an Arqia plano.
      required:
        - id
        - description
      properties:
        id:
          type: string
          description: Identifies the plano in Arqia.
          example: '9.25.2.986.1.5.2.6.1.1.1.30.100.100.20480.1.10.953'
        description:
          type: string
          description: The plano's description in Arqia.
          example: Telenor Connexion | CST | CTRL LIM | Movel | IND | ARQIA | 20480 Mbytes | 100 Msgs | 100 Minutos
    thingspaceServicePolicyAttributes:
      type: object
      description: Attributes used to describe a Thingspace service plan.
      required:
        - id
      properties:
        id:
          type: string
          description: Identifies the service plan in Thingspace.
          example: 'M2MPublicstatic'
    thingspaceServicePolicyRelationship:
      type: object
      description: References a Thingspace service policy that is related to this resource. The `url` property can be used to GET the resource. The `attributes` property will be omitted unless the query parameter specifies the inclusion of this resource. If present, the `attributes` property will only contain properties marked as required.
      required:
        - url
      properties:
        url:
          type: string
          minLength: 1
          maxLength: 256
          example: /iot-connect/service-policies/v1/thingspace_us/M2MPublicstatic
        attributes:
          $ref: '#/components/schemas/thingspaceServicePolicyAttributes'
      example:
        url: /iot-connect/service-policies/v1/thingspace/thingspace_us/M2MPublicstatic
    stcServicePolicyAttributes:
      type: object
      description: Attributes used to describe an STC service profile.
      required:
        - id
        - name
      properties:
        id:
          type: string
          description: Identifies the service profile in STC.
          example: '12345'
        name:
          type: string
          description: The service profile's name in STC.
          example: TESTPROFILE_1
    stcServicePolicyRelationship:
      type: object
      description: References an STC service policy that is related to this resource. The `url` property can be used to GET the resource. The `attributes` property will be omitted unless the query parameter specifies the inclusion of this resource. If present, the `attributes` property will only contain properties marked as required.
      required:
        - url
      properties:
        url:
          type: string
          minLength: 1
          maxLength: 256
          example: /iot-connect/service-policies/v1/stc_sa/12345
        attributes:
          $ref: '#/components/schemas/stcServicePolicyAttributes'
      example:
        url: /iot-connect/service-policies/v1/stc/stc_sa/12345

    simpleThingspaceServicePolicyRelationship:
      type: object
      description: References a Thingspace service policy that is related to this resource. The `url` property can be used to GET the resource.
      required:
        - url
      properties:
        url:
          type: string
          minLength: 1
          maxLength: 256
          example: /iot-connect/service-policies/v1/thingspace_us/M2MPublicstatic
      example:
        url: /iot-connect/service-policies/v1/thingspace/thingspace_us/M2MPublicstatic
    simpleStcServicePolicyRelationship:
      type: object
      description: References an STC service policy that is related to this resource. The `url` property can be used to GET the resource.
      required:
        - url
      properties:
        url:
          type: string
          minLength: 1
          maxLength: 256
          example: /iot-connect/service-policies/v1/stc_sa/12345
      example:
        url: /iot-connect/service-policies/v1/stc/stc_sa/12345
    singleServicePolicyResponse:
      type: object
      required:
        - attributes
      properties:
        attributes:
          description: Attributes present in the response depends on service policy type.
          oneOf:
            - $ref: '#/components/schemas/servicePolicyAttributes'
            - $ref: '#/components/schemas/servicePolicyAttributesArqia'
        relationships:
          type: object
          properties:
            cmpServicePolicy:
              anyOf:
                - $ref: '#/components/schemas/iotaServicePolicyRelationship'
                - $ref: '#/components/schemas/arqiaServicePolicyRelationship'
                - $ref: '#/components/schemas/thingspaceServicePolicyRelationship'
                - $ref: '#/components/schemas/stcServicePolicyRelationship'
    singleServicePolicyInListResponse:
      type: object
      required:
        - attributes
      properties:
        attributes:
          description: Attributes present in the response depends on service policy type.
          oneOf:
            - $ref: '#/components/schemas/servicePolicyAttributes'
            - $ref: '#/components/schemas/servicePolicyAttributesArqia'
        relationships:
          type: object
          properties:
            cmpServicePolicy:
              anyOf:
                - $ref: '#/components/schemas/simpleIotaServicePolicyRelationship'
                - $ref: '#/components/schemas/simpleArqiaServicePolicyRelationship'
                - $ref: '#/components/schemas/simpleThingspaceServicePolicyRelationship'
                - $ref: '#/components/schemas/simpleStcServicePolicyRelationship'
    metadataUpdateValue:
      description: Describes a new value to assign to a metadata key.
      type: object
      required:
        - value
      properties:
        value:
          description: The metadata value
          type: string
          example: China
          maxLength: 100
          minLength: 1
    servicePolicyResponse:
      type: object
      properties:
        items:
          type: array
          description: Array containing service policies
          items:
            $ref: '#/components/schemas/singleServicePolicyInListResponse'
    
    cmpServicePolicyId:
      type: string
      description: Id of the service policy on the CMP instance
      example: "9.25.2.986.1.5.2.6.1.1.1.30.100.100.20480.1.10.953"

    servicePolicyName:
      type: string
      description: Name of the service policy.
      minLength: 1
      maxLength: 256
      example: 5MB Europe

    servicePolicyType:
      type: string
      description: Specifies the underlying service policy type in the Connectivity Management Platform (CMP).
      enum: [IOTA_SERVICE_POLICY, ARQIA_SERVICE_POLICY, THINGSPACE_SERVICE_POLICY, STC_SERVICE_POLICY]

    servicePolicyMetadata:
      type: object
      description: All metadata key-value pairs associated with this service policy. This object contains dynamic properties since metadata has a customized definition process.
      additionalProperties: true
      example:
        Info: LTE allowed but no voice

    domainId:
      type: string
      description: Domain the resource belongs to. Used to determine which users have access to the resource.
      pattern: ^([A-Za-z0-9]{8}-){0,6}[A-Za-z0-9]{8}$
      example: a1ce25s2-c23edcs9

    iotPlatformServicePolicyId:
      type: string
      description: Identifies the service policy.
      pattern: '^22[A-HJ-NP-Z2-9]{6}$'
      example: 22A8BC76

    problemDetails:
      type: object
      description: RFC 9457 compliant problem details object for HTTP APIs.
      required:
        - type
        - title
        - status
        - detail
      properties:
        type:
          type: string
          format: uri
          description: A URI reference that identifies the problem type.
          enum:
            - urn:api.iot.telenor.com:problems:bad-request
            - urn:api.iot.telenor.com:problems:conflict
            - urn:api.iot.telenor.com:problems:unauthorized
            - urn:api.iot.telenor.com:problems:internal-server-error
            - urn:api.iot.telenor.com:problems:not-found
            - urn:api.iot.telenor.com:problems:too-many-requests
            # Domain-specific problem types
            - urn:api.iot.telenor.com:problems:bad-request:service-policies:metadata-key-missing
            - urn:api.iot.telenor.com:problems:bad-request:service-policies:too-many-requests-cmp-error
        title:
          type: string
          description: A short, human-readable summary of the problem.
        status:
          type: integer
          description: The HTTP status code for this occurrence of the problem.
        detail:
          type: string
          description: A human-readable explanation specific to this occurrence of the problem.
          example: The 'sortBy' and 'direction' query parameters must both be present.
        instance:
          type: string
          format: uri
          description: Optional URI reference that identifies the specific occurrence of the problem.
          example: /iot-connect/service-policies/v1/iot-platform
        errors:
          type: array
          description: Optional array of field-level errors.
          items:
            type: object
            properties:
              detail:
                type: string
                description: Description of the validation error.
                example: Field X must be a positive integer
              pointer:
                type: string
                description: JSON Pointer to the field that caused the error.
                example: '#/key'
      additionalProperties: true
      example:
        type: urn:api.iot.telenor.com:problems:bad-request
        title: Bad Request
        status: 400
        detail: The 'value' query parameters must not be empty.
        instance: /service-policies/v1/iot-platform?key=abc&value=
        errors:
          - detail: Field must not be empty
            pointer: '#/value'

    error:
      type: object
      properties:
        name:
          type: string
        message:
          type: string
        errors:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
              errorCode:
                type: string
              path:
                type: string
                description: Optional path, usually used to describe which incoming parameters are not valid.
            required:
              - message
              - errorCode
      required:
        - message

  headers:
    content-Location:
      description: URL to the resource that got impacted by the status change.
      schema:
        type: string
        format: url