swagger: '2.0'
info:
  description: Configuration for Af report for VPN Session resource.
  version: 'v2'
  title: vpn_active_sessions
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: vpn_active_sessions
    description: Af report for VPN Session
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  authParam:
      in: header
      name: Authorization
      type: string
      required: true
      description: Session Id for authentication.Should be mentioned in the format CwsAuth bearer=sessionIdValue
  cloudParam:
      in: header
      name: isCloud
      type: string
      required: true
      description: set the value to true in case of Cloud services, false for on-prem deployment
paths:
  /massvc/{customerid}/nitro/v2/config/vpn_active_sessions:
    get:
      tags:
        - vpn_active_sessions
      summary: GET all vpn_active_sessions
      operationId: getall_vpn_active_sessions
      description: Af Report for VPN Error Counts ...
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: path
          name: customerid
          type: string
          required: true
          description: Customer Id of the user
        - in: header
          name: Authorization
          type: string
          required: true
          description: Session Id for authentication.Should be mentioned in the format CwsAuth bearer=sessionIdValue
        - in: header
          name: isCloud
          type: string
          required: true
          description: set the value to true in case of Cloud services, false for on-prem deployment
        - in: query
          name: filter
          type: string
          required: false
          description: "Use this query-parameter to get the filtered set of vm_device resources configured on the system. You can set a filter on any property of the resource.Example:  property-name1:property-value1 "
        - in: query
          name: args
          type: string
          required: false
          description: "Use this query-parameter to specify arguments.Example:  property-name1:property-value1 "
        - in: query
          name: duration
          type: string
          required: true
          description: "Duration "
          enum:
            - last_1_hour
            - last_1_day
            - last_1_week
            - last_1_month
        - in: query
          name: report_start_time
          type: string
          required: false
          description: Use this query-parameter to specify the start time from which the summary for report is considered
        - in: query
          name: report_end_time
          type: string
          required: false
          description: Use this query-parameter to specify the end time until where summary for report is considered
        - in: query
          name: pagesize
          type: integer
          required: false
          description: Use this query-parameter to get the vpn_active_sessions resources in chunks.To be used along with pageno query parameter.
        - in: query
          name: pageno
          type: integer
          required: false
          description: Use this query-parameter to get the vpn_active_sessions resources in chunks.To be used along with pagesize query parameter.
        - in: query
          name: count
          type: string
          required: false
          description: Use this query-parameter to get the count of vpn_active_sessions resources.
          enum:
            - yes
      responses:
        200:
          description:  for vpn_active_sessions
          schema: 
              $ref: '#/definitions/getvpn_active_sessionssResponse'
        400:
          description: Bad input parameter
          schema: 
              $ref: '#/definitions/Error'
        401:
          description: Failed Authentication
          schema: 
              $ref: '#/definitions/Error'
        403:
          description: Unauthorized
          schema: 
              $ref: '#/definitions/Error'
        404:
          description: Item not found
          schema: 
              $ref: '#/definitions/Error'
        409:
          description: Resource Conflict
          schema: 
              $ref: '#/definitions/Error'
        500:
          description: Server Error
          schema: 
              $ref: '#/definitions/Error'
        504:
          description: Gateway Timeout
          schema: 
              $ref: '#/definitions/Error'

definitions:
  getvpn_active_sessionsResponse:
    type: object
    required:
      - vpn_active_sessions
    properties:
      vpn_active_sessions:
        $ref: '#/definitions/vpn_active_sessions'
    title: getvpn_active_sessionsResponse
    example:
      vpn_active_sessions:
        city_name: "Bengaluru"
        country_name: "India"
        gateway_fqdn: "vpn_service-gw.citrix.com"
        total_bytes: "0"
        total_bytes_sent: "0"
        total_bytes_received: "0"
        rpt_sample_time: "0"
        bandwidth: "0"
        session_setup_time: "0"
        __count: "0"
        state: "Active"
        id: "4c738995-a4f9-441d-a938-720391b1ed43"
        logout_mode: "Terminated by user."
        os_type: "MAC OS"
        session_type: "Full Tunnel"
        gateway_ipaddress: "1.1.1.1"
        vpn_user_name: "user123"
        region_name: "Karnataka"
        up_time: "0"
        device_ip_address: "1.1.1.1"
        client_ip: "1.1.1.1"
        session_end_time: "0"
        server_ip: "1.1.1.1"

  getvpn_active_sessionssResponse:
    type: object
    required:
      - vpn_active_sessions
    properties:
      vpn_active_sessions:
        type: array
        items:
          $ref: '#/definitions/vpn_active_sessions'
    title: getvpn_active_sessionssResponse
    example:
      vpn_active_sessions:
        city_name: "Bengaluru"
        country_name: "India"
        gateway_fqdn: "vpn_service-gw.citrix.com"
        total_bytes: "0"
        total_bytes_sent: "0"
        total_bytes_received: "0"
        rpt_sample_time: "0"
        bandwidth: "0"
        session_setup_time: "0"
        __count: "0"
        state: "Active"
        id: "4c738995-a4f9-441d-a938-720391b1ed43"
        logout_mode: "Terminated by user."
        os_type: "MAC OS"
        session_type: "Full Tunnel"
        gateway_ipaddress: "1.1.1.1"
        vpn_user_name: "user123"
        region_name: "Karnataka"
        up_time: "0"
        device_ip_address: "1.1.1.1"
        client_ip: "1.1.1.1"
        session_end_time: "0"
        server_ip: "1.1.1.1"

  vpn_active_sessions_readwrite:
    type: object
    properties:
      city_name:
        description: "City"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      country_name:
        description: "Country"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      gateway_fqdn:
        description: "FQDN of Gateway"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      total_bytes:
        description: "Total Bytes"
        type: number
        format: double
      total_bytes_sent:
        description: "Total Bytes Sent"
        type: number
        format: int64
      total_bytes_received:
        description: "Total Bytes Received"
        type: number
        format: int64
      rpt_sample_time:
        description: "Report Sample time."
        type: number
        format: double
      bandwidth:
        description: "Avg Bandwidth."
        type: number
        format: double
      session_setup_time:
        description: "vpn session start time"
        type: number
        format: double
      __count:
        description: "count."
        type: number
        format: double
      state:
        description: "State (Active/Idle/Terminated)"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      id:
        description: "Id is VPN Session ID"
        type: string
        format: uuid
        minLength: 1
        maxLength: 64
      logout_mode:
        description: "Logout Reason"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      os_type:
        description: "OS type"
        type: string
        format: string
        maxLength: 128
      session_type:
        description: "Session type"
        type: string
        format: string
        maxLength: 128
      gateway_ipaddress:
        description: "Gateway IPAddress"
        type: string
        format: ipaddress
        minLength: 1
        maxLength: 128
      vpn_user_name:
        description: "Name of VPN User"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      region_name:
        description: "Region"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      up_time:
        description: "Session Up Time"
        type: number
        format: double
      client_ip:
        description: "Client IP Address."
        type: string
        format: ipaddress
        maxLength: 64
      session_end_time:
        description: "vpn session end time"
        type: number
        format: double
      server_ip:
        description: "Server IP Address."
        type: string
        format: ipaddress
        maxLength: 64

  vpn_active_sessions:
    allOf:
      - $ref: '#/definitions/vpn_active_sessions_readwrite'

  Error:
    properties:
      errorcode:
        type: number
        format: int32
        example: 1001
      errormessage:
        type: string
        format: string
        example: "id cannot be found"
