openapi: 3.0.1
info:
  title: Scheduling Service
  description: The Schedule Service Allows scheduling batch jobs.
  version: '2.0'
tags:
  - name: SchedulingService
security:
  - Authorization: []
paths:
  /schedule:
    get:
      summary: Lists all jobs under a specific tenant.
      operationId: SchedulingService_ListSchedules
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/schedulingListScheduleResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: tenantId
          description: 'Will use the tenantUtil to pull in from bearer token if not provided. Required: false'
          in: query
          required: false
          schema:
            type: string
        - name: sortField
          description: 'ENUM defined in proto CREATION_TIME/JOB_NAME/IMPORT_TYPE/UPDATED_ON. Required:  true - Indexed/Sortable'
          in: query
          required: false
          schema:
            type: string
            enum:
              - CREATED_ON
              - UPDATED_ON
              - IMPORT_TYPE
              - JOB_NAME
            default: CREATED_ON
        - name: sortType
          description: 'ENUM defined in proto none defaults to descending order NONE/ASC/DEC Required:  true - Indexed/Sortable'
          in: query
          required: false
          schema:
            type: string
            enum:
              - NONE
              - ASC
              - DESC
            default: NONE
        - name: pageSize
          description: 'Page size of list items returned. Default: 10. Required: false'
          in: query
          required: false
          schema:
            type: integer
            format: int32
        - name: pageToken
          description: 'Auto generated page token to view results in order beyond page size. Required: false'
          in: query
          required: false
          schema:
            type: string
        - name: partialTextSearch
          description: 'Boolean value to search on jobName field by partial search. Required: false'
          in: query
          required: false
          schema:
            type: boolean
        - name: jobName
          description: 'Job Name field used only for partial search. Required: true (when partial search set to true)'
          in: query
          required: false
          schema:
            type: string
      tags:
        - SchedulingService
    delete:
      summary: Deletes the schedule - also should remove the job scheduler from the backend.
      operationId: SchedulingService_DeleteSchedule
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/schedulingDeleteScheduleResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/schedulingDeleteScheduleRequest'
        required: true
      tags:
        - SchedulingService
    post:
      summary: Create the schedule request for job. Allowed upload types for FSS uploads are CSV, XLS, and XLSX.
      operationId: SchedulingService_CreateSchedule
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/schedulingScheduleResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/schedulingCreateScheduleRequest'
        required: true
      tags:
        - SchedulingService
  /schedule/{jobName}:
    get:
      summary: Gets an individual schedule
      operationId: SchedulingService_GetSchedule
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/schedulingScheduleResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: jobName
          in: path
          required: true
          schema:
            type: string
        - name: tenantId
          in: query
          required: false
          schema:
            type: string
      tags:
        - SchedulingService
    put:
      summary: |-
        Can update everything except jobName and importType.
        If the schedule changes then the job scheduler in the backend needs to be updated as well
        to remove the old one and create a new one.
        Allowed upload types for FSS uploads are CSV, XLS, and XLSX.
      operationId: SchedulingService_UpdateSchedule
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/schedulingScheduleResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: jobName
          description: Can not be updated. Used for searching purposes only. Required true.
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SchedulingServiceUpdateScheduleBody'
        required: true
      tags:
        - SchedulingService
servers:
  - url: https://prod-ui-zwseuprod01p.pp.zebra.com/api
    description: EU Server
  - url: https://prod-ui-zwsusprod01p.pp.zebra.com/api
    description: NA Server
components:
  schemas:
    SchedulingServiceUpdateScheduleBody:
      type: object
      properties:
        tenantId:
          type: string
          title: |-
            Will use the tenantUtil to pull in from bearer token if not provided. Required: true
            Can not be updated. Used for searching purposes only
        description:
          type: string
          description: 'Description of schedule request. Required: false.'
        emails:
          type: array
          items:
            type: string
          description: 'Optional - List of users to email when job is done processing. Required: false.'
        schedule:
          $ref: '#/components/schemas/schedulingSchedule'
        deviation:
          type: integer
          format: int32
          title: 'The acceptable deviation percentage from 1-99 from previous file upload. Required:  false'
        templateName:
          type: string
          description: 'The template name if a templated upload. Required: false.'
        ignoreHeader:
          type: boolean
          title: 'If true ignores the first line of the file. Required: false'
        replaceExisting:
          type: boolean
          title: 'if true wipes out all existing data. Required: false'
        fssId:
          type: string
          title: 'Unique identifier of file from FSS (File Store Service).Allowed file types: CSV,XLS, and XLSX. Required: false'
        signedUrl:
          type: string
          description: 'A signed URL for a GCS bucket. Required: false.'
        sftpDetails:
          $ref: '#/components/schemas/commonsSFTPDetails'
        gcsDetails:
          $ref: '#/components/schemas/commonsGcsDetails'
        updateFieldMask:
          type: string
          description: |-
            Field Masks support. Required: false
            Allowed Paths = emails,deviation, template_name, description, ignore_header, replace_existing,schedule, and end_date.
            Paths deviation,schedule, and end_date can only be updated if included in the field mask path to avoid protos default reset.
            ignore_header and replace_existing can only reset from true to false if in field mask path to avoid default reset.
        endDate:
          type: string
          format: date-time
          description: |-
            The end date of the schedule.  Must be after the start date and no more than a year after the start date.
            Required: false.  Default Value: 1 year from start date.
    commonsGcsDetails:
      type: object
      properties:
        projectId:
          type: string
        bucketName:
          type: string
        keyFile:
          type: string
        fileName:
          type: string
      description: GCS Details are used for granting access to a GCS bucket for us to read the file from.
    commonsImportType:
      type: string
      enum:
        - USERS
        - ROLES
        - WORKSPACES
        - SITES
        - DEPARTMENTS
        - HIERARCHIES
        - SITE_TEMPLATES
        - PERMISSION_TEMPLATES
        - GROUPS
        - LOCATIONS
      default: USERS
      description: |-
        The type of data being imported.

         - LOCATIONS: The import file is forwarded directly to the zac-server locations API
        Constraints:
          - template_name, deviation, and dry_run are all ignored.
          - zac-server performs an upsert always, any errors in the file will fail the entire file
    commonsSFTPDetails:
      type: object
      properties:
        host:
          type: string
          title: 'SFTP Server host, Required: true'
        port:
          type: integer
          format: int32
          title: 'SFTP Server port, Default: 22, Required: false'
        directory:
          type: string
          title: 'Directory in SFTP Server of the file to fetch, Required: true'
        fileName:
          type: string
          title: 'Name of the file including file extension, Required: true (Example - userdata.csv)'
        username:
          type: string
          title: 'Username for SFTP authentication, Required: true'
        password:
          type: string
          title: 'Password for SFTP authentication, Required: true'
        sshKey:
          type: string
      title: Remote SFTP Server details to fetch file from
    commonsSortType:
      type: string
      enum:
        - NONE
        - ASC
        - DESC
      default: NONE
    googleRpcStatus:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/protobufAny'
    protobufAny:
      type: object
      properties:
        '@type':
          type: string
      additionalProperties: {}
    schedulingCreateScheduleRequest:
      type: object
      properties:
        tenantId:
          type: string
          title: 'Will use the tenantUtil to pull in from bearer token if not provided. Required: true'
        jobName:
          type: string
          title: Job name. Is auto generated with a UUID if empty
        importType:
          $ref: '#/components/schemas/commonsImportType'
        description:
          type: string
          description: 'Description of schedule request. Required: false.'
        emails:
          type: array
          items:
            type: string
          description: 'Optional - List of users to email when job is done processing. Required: false.'
        schedule:
          $ref: '#/components/schemas/schedulingSchedule'
        deviation:
          type: integer
          format: int32
          title: 'The acceptable deviation percentage from 1-99 from previous file upload. Required:  false'
        templateName:
          type: string
          description: 'The template name if a templated upload. Required: false.'
        ignoreHeader:
          type: boolean
          title: 'If true ignores the first line of the file. Required: false'
        replaceExisting:
          type: boolean
          title: 'if true wipes out all existing data. Required: false'
        fssId:
          type: string
          title: 'Unique identifier of file from FSS (File Store Service). Allowed file types: CSV,XLS, and XLSX. Required: false. Required: false'
        signedUrl:
          type: string
          description: 'A signed URL for a GCS bucket. Required: false.'
        sftpDetails:
          $ref: '#/components/schemas/commonsSFTPDetails'
        gcsDetails:
          $ref: '#/components/schemas/commonsGcsDetails'
        endDate:
          type: string
          format: date-time
          description: |-
            The end date of the schedule.  Must be after the start date and no more than a year after the start date.
            Required: false.  Default Value: 1 year from start date.
    schedulingDeleteScheduleRequest:
      type: object
      properties:
        tenantId:
          type: string
        jobName:
          type: array
          items:
            type: string
    schedulingDeleteScheduleResponse:
      type: object
      properties:
        response:
          type: string
    schedulingListScheduleResponse:
      type: object
      properties:
        scheduleProto:
          type: array
          items:
            $ref: '#/components/schemas/schedulingScheduleProto'
        nextPageToken:
          type: string
    schedulingSchedule:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/schedulingScheduleTypeEnum'
        date:
          type: string
          format: date-time
    schedulingScheduleProto:
      type: object
      properties:
        tenantId:
          type: string
        jobName:
          type: string
        importType:
          $ref: '#/components/schemas/commonsImportType'
        description:
          type: string
        emails:
          type: array
          items:
            type: string
        schedule:
          $ref: '#/components/schemas/schedulingSchedule'
        deviation:
          type: integer
          format: int32
        templateName:
          type: string
        ignoreHeader:
          type: boolean
        replaceExisting:
          type: boolean
        fssId:
          type: string
        signedUrl:
          type: string
        sftpDetails:
          $ref: '#/components/schemas/commonsSFTPDetails'
        gcsDetails:
          $ref: '#/components/schemas/commonsGcsDetails'
        creationTime:
          type: string
          format: date-time
        createdBy:
          type: string
        lastUpdatedTime:
          type: string
          format: date-time
        lastUpdatedBy:
          type: string
        endDate:
          type: string
          format: date-time
        status:
          $ref: '#/components/schemas/servicesSchedulingStatus'
        errorMessage:
          type: string
        instanceId:
          type: string
    schedulingScheduleResponse:
      type: object
      properties:
        scheduleProto:
          $ref: '#/components/schemas/schedulingScheduleProto'
    schedulingScheduleTypeEnum:
      type: string
      enum:
        - ONCE
        - HOURLY
        - DAILY
        - WEEKLY
        - MONTHLY
      default: ONCE
    schedulingSortSchedulesEnum:
      type: string
      enum:
        - CREATED_ON
        - UPDATED_ON
        - IMPORT_TYPE
        - JOB_NAME
      default: CREATED_ON
    servicesSchedulingStatus:
      type: string
      enum:
        - SUCCEEDED
        - FAILED
        - UNKNOWN
      default: SUCCEEDED
  securitySchemes:
    Authorization:
      type: apiKey
      description: Bearer token
      name: Authorization
      in: header
