openapi: 3.0.0
info:
  title: M1_ServerCertificatesProvisioning
  version: 2.1.1
  description: |
    5GMS AF M1 Server Certificates Provisioning API
    © 2023, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC).
    All rights reserved.
tags:
  - name: M1_ServerCertificatesProvisioning
    description: '5G Media Streaming: Provisioning (M1) APIs: Server Certificates Provisioning'
externalDocs:
  description: 'TS 26.512 V17.5.0; 5G Media Streaming (5GMS); Protocols'
  url: 'https://www.3gpp.org/ftp/Specs/archive/26_series/26.512/'
servers:
  - url: '{apiRoot}/3gpp-m1/v2'
    variables:
      apiRoot:
        default: https://example.com
        description: See 3GPP TS 29.512 clause 6.1.
paths:
  /provisioning-sessions/{provisioningSessionId}/certificates:
    parameters:
      - name: provisioningSessionId
        in: path
        required: true
        schema:
          $ref: 'TS26512_CommonData.yaml#/components/schemas/ResourceId'
        description: The resource identifier of an existing Provisioning Session.'
    post:
      operationId: createOrReserveServerCertificate
      summary: 'Create or reserve a Service Certificate resource'
      description: 'Without the optional csr query parameter, an X.509 certificate is generated and this is returned. If the csr query parameter is present, a Certificate Signing Request is instead generated and returned, allowing the X.509 certificate to be generated by the invoker and later uploaded.'
      parameters:
        - in: query
          name: csr
          schema: 
            type: string
          description: 'When present, return a Certificate Signing Request instead of generating an X.509 certificate'
      requestBody:
        description: 'An optional list of domain name aliases to be included in the returned Certificate Signing Request'
        content:
          'application/json':
            schema:
              type: array
              items:
                type: string
      responses:
        '200':
          description: 'Server Certificate Created'
          headers:
            Location: 
              description: 'URL of the newly created Server Certificate resource'
              required: true
              schema:
                $ref: 'TS26512_CommonData.yaml#/components/schemas/AbsoluteUrl'
          content:
            'application/x-pem-file':
              schema:
                type: string
  
  /provisioning-sessions/{provisioningSessionId}/certificates/{certificateId}:
    parameters:
      - name: provisioningSessionId
        in: path
        required: true
        schema:
          $ref: 'TS26512_CommonData.yaml#/components/schemas/ResourceId'
        description: The resource identifier of an existing Provisioning Session.'
      - name: certificateId
        in: path
        required: true
        schema:
          $ref: 'TS26512_CommonData.yaml#/components/schemas/ResourceId'
        description: 'The resource identifier of an existing Server Certificate'
    put:
      operationId: uploadServerCertificate
      summary: "Upload the X.509 certificate for a previously reserved Server Certificate resource"
      requestBody:
        required: true
        content:
          application/x-pem-file:
            schema:
              type: string
      responses:
        '204':
          description: 'Server Certificate Updated'
    get:
      operationId: retrieveServerCertificate
      summary: 'Retrieve the X.509 certificate representation of the specified Server Certificate resource'
      responses:
        '200':
          description: 'Success'
          content:
            'application/x-pem-file':
              schema:
                type: string
        '204':
          description: 'Awaiting Upload'
        '404':
          description: 'Not Found'
    delete:
      operationId: destroyServerCertificate
      summary: 'Destroy an existing Server Certificate resource'
      responses:
        '200':
          # OK
          description: 'Server Certificate Destroyed'
          content:
            'application/x-pem-file':
              schema:
                type: string
        '204':
          # No Content
          description: 'Server Certificate Destroyed'
        '404':
          # Not Found
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'
        '409':
          # Conflict
          $ref: 'TS29571_CommonData.yaml#/components/responses/409'
        '410':
          # Gone
          $ref: 'TS29571_CommonData.yaml#/components/responses/410'
