swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  title: AutomationManagement
  version: 2015-10-31
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/watcher.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: automation-watcher
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow
    flow: implicit
    scopes:
      user_impersonation: impersonate your user account
    type: oauth2
security:
  - azure_auth:
      - user_impersonation
parameters: {}
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers":
    get:
      description: Retrieve a list of watchers.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/watcheroperations
      operationId: Watcher_ListByAutomationAccount
      parameters:
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The filter to apply on the operation.
          in: query
          name: $filter
          required: false
          type: string
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/WatcherListResult"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Watcher
      x-ms-examples:
        List watchers by Automation Account:
          parameters:
            api-version: 2015-10-31
            automationAccountName: MyTestAutomationAccount
            resourceGroupName: rg
            subscriptionId: subid
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/MyTestAutomationAccount/watchers/MyTestWatcher
                    name: MyTestWatcher
                    properties:
                      creationTime: 2016-12-20T21:36:48.597+00:00
                      description: This is a test watcher.
                      executionFrequencyInSeconds: 60
                      lastModifiedBy: null
                      lastModifiedTime: 2016-12-20T21:36:48.597+00:00
                      scriptName: MyTestWatcher
                      scriptParameters: null
                      scriptRunOn: MyTestHybridWorkerGroup
                      status: null
                  - id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/MyTestAutomationAccount/watchers/MyTestWatcher01
                    name: MyTestWatcher01
                    properties:
                      creationTime: 2016-12-20T20:47:24.697+00:00
                      description: This is a test watcher.
                      executionFrequencyInSeconds: 60
                      lastModifiedBy: null
                      lastModifiedTime: 2016-12-20T20:47:24.697+00:00
                      scriptName: MyTestWatcher
                      scriptParameters: null
                      scriptRunOn: MyTestHybridWorkerGroup
                      status: null
                  - id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/MyTestAutomationAccount/watchers/MyTestWatcher02
                    name: MyTestWatcher02
                    properties:
                      creationTime: 2016-12-20T21:26:35.647+00:00
                      description: This is a test watcher.
                      executionFrequencyInSeconds: 60
                      lastModifiedBy: null
                      lastModifiedTime: 2016-12-20T21:26:35.647+00:00
                      scriptName: MyTestWatcher
                      scriptParameters: null
                      scriptRunOn: MyTestHybridWorkerGroup
                      status: null
              headers: {}
      x-ms-odata: "#/definitions/Watcher"
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}":
    delete:
      description: Delete the watcher by name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/watcheroperations
      operationId: Watcher_Delete
      parameters:
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The watcher name.
          in: path
          name: watcherName
          required: true
          type: string
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Watcher
      x-ms-examples:
        Delete watcher:
          parameters:
            api-version: 2015-10-31
            automationAccountName: MyTestAutomationAccount
            resourceGroupName: rg
            subscriptionId: subid
            watcherName: MyTestWatcher
          responses:
            "200": {}
    get:
      description: Retrieve the watcher identified by watcher name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/watcheroperations
      operationId: Watcher_Get
      parameters:
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The watcher name.
          in: path
          name: watcherName
          required: true
          type: string
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Watcher"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Watcher
      x-ms-examples:
        Get watcher:
          parameters:
            api-version: 2015-10-31
            automationAccountName: MyTestAutomationAccount
            resourceGroupName: rg
            subscriptionId: subid
            watcherName: MyTestWatcher
          responses:
            "200":
              body:
                etag: null
                id: /subscriptions/subId/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/MyTestAutomationAccount/watchers/MyTestWatcher
                location: null
                name: MyTestWatcher
                properties:
                  creationTime: 2017-11-30T18:50:17.163+00:00
                  description: ""
                  executionFrequencyInSeconds: 60
                  lastModifiedBy: null
                  lastModifiedTime: 2017-11-30T18:50:17.163+00:00
                  scriptName: MyTestWatcherRunbook
                  scriptParameters: {}
                  scriptRunOn: MyTestHybridWorkerGroup
                  status: Running
                tags: {}
                type: null
              headers: {}
    patch:
      description: Update the watcher identified by watcher name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/watcheroperations
      operationId: Watcher_Update
      parameters:
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The watcher name.
          in: path
          name: watcherName
          required: true
          type: string
        - description: The update parameters for watcher.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/WatcherUpdateParameters"
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Watcher"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Watcher
      x-ms-examples:
        Update watcher:
          parameters:
            api-version: 2015-10-31
            automationAccountName: MyTestAutomationAccount
            parameters:
              name: MyTestWatcher
              properties:
                executionFrequencyInSeconds: 600
            resourceGroupName: rg
            subscriptionId: subid
            watcherName: MyTestWatcher
          responses:
            "200":
              body:
                etag: null
                id: /subscriptions/subId/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/MyTestAutomationAccount/watchers/MyTestWatcher
                location: null
                name: MyTestWatcher
                properties:
                  creationTime: 2018-05-14T21:33:02.197+00:00
                  description: This is a test watcher.
                  executionFrequencyInSeconds: 600
                  lastModifiedBy: null
                  lastModifiedTime: 2018-05-14T22:29:57.65+00:00
                  scriptName: MyTestWatcherRunbook
                  scriptParameters: {}
                  scriptRunOn: MyTestHybridWorkerGroup
                  status: New
                tags: {}
                type: null
              headers: {}
    put:
      description: Create the watcher identified by watcher name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/watcheroperations
      operationId: Watcher_CreateOrUpdate
      parameters:
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The watcher name.
          in: path
          name: watcherName
          required: true
          type: string
        - description: The create or update parameters for watcher.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/Watcher"
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Watcher"
        "201":
          description: Created
          schema:
            $ref: "#/definitions/Watcher"
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Watcher
      x-ms-examples:
        Create or update watcher:
          parameters:
            api-version: 2015-10-31
            automationAccountName: MyTestAutomationAccount
            parameters:
              etag: null
              location: null
              name: MyTestWatcher
              properties:
                creationTime: 2016-11-01T04:22:47.7333333-07:00
                description: This is a test watcher.
                executionFrequencyInSeconds: 60
                lastModifiedBy: null
                lastModifiedTime: 2016-11-01T04:22:47.7333333-07:00
                scriptName: MyTestWatcherRunbook
                scriptParameters: null
                scriptRunOn: MyTestHybridWorkerGroup
              tags: {}
              type: null
            resourceGroupName: rg
            subscriptionId: subid
            watcherName: MyTestWatcher
          responses:
            "200":
              body:
                etag: null
                id: /subscriptions/subId/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/MyTestAutomationAccount/watchers/MyTestWatcher
                location: null
                name: MyTestWatcher
                properties:
                  creationTime: 2018-05-14T21:14:09.607+00:00
                  description: This is a test watcher.
                  executionFrequencyInSeconds: 60
                  lastModifiedBy: null
                  lastModifiedTime: 2018-05-14T21:14:09.607+00:00
                  scriptName: MyTestWatcherRunbook
                  scriptParameters: null
                  scriptRunOn: MyTestHybridWorkerGroup
                  status: New
                tags: {}
                type: null
              headers: {}
            "201":
              body:
                etag: null
                id: /subscriptions/subId/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/MyTestAutomationAccount/watchers/MyTestWatcher
                location: null
                name: MyTestWatcher
                properties:
                  creationTime: 2018-05-14T21:14:09.607+00:00
                  description: This is a test watcher.
                  executionFrequencyInSeconds: 60
                  lastModifiedBy: null
                  lastModifiedTime: 2018-05-14T21:14:09.607+00:00
                  scriptName: MyTestWatcherRunbook
                  scriptParameters: null
                  scriptRunOn: MyTestHybridWorkerGroup
                  status: New
                tags: {}
                type: null
              headers: {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/start":
    post:
      description: Resume the watcher identified by watcher name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/watcheroperations
      operationId: Watcher_Start
      parameters:
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The watcher name.
          in: path
          name: watcherName
          required: true
          type: string
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Watcher
      x-ms-examples:
        Start Watcher:
          parameters:
            api-version: 2015-10-31
            automationAccountName: MyTestAutomationAccount
            resourceGroupName: rg
            subscriptionId: subid
            watcherName: MyTestWatcher
          responses:
            "200": {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/stop":
    post:
      description: Resume the watcher identified by watcher name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/watcheroperations
      operationId: Watcher_Stop
      parameters:
        - description: Name of an Azure Resource group.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the automation account.
          in: path
          name: automationAccountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The watcher name.
          in: path
          name: watcherName
          required: true
          type: string
        - description: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
        - description: Client Api Version.
          in: query
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: OK
        default:
          description: Automation error response describing why the operation failed.
          schema:
            description: Error response of an operation failure
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - Watcher
      x-ms-examples:
        Start Watcher:
          parameters:
            api-version: 2018-01-15
            automationAccountName: MyTestAutomationAccount
            resourceGroupName: rg
            subscriptionId: subid
            watcherName: MyTestWatcher
          responses:
            "200": {}
definitions:
  Watcher:
    allOf:
      - allOf:
          - description: The core properties of ARM resources
            properties:
              id:
                description: Fully qualified resource Id for the resource
                readOnly: true
                type: string
              name:
                description: The name of the resource
                readOnly: true
                type: string
              type:
                description: The type of the resource.
                readOnly: true
                type: string
            type: object
            x-ms-azure-resource: true
        description: The resource model definition for a ARM tracked top level resource
        properties:
          location:
            description: The Azure Region where the resource lives
            type: string
            x-ms-mutability:
              - read
              - create
          tags:
            additionalProperties:
              type: string
            description: Resource tags.
            type: object
            x-ms-mutability:
              - read
              - create
              - update
        type: object
    description: Definition of the watcher type.
    properties:
      etag:
        description: Gets or sets the etag of the resource.
        type: string
      properties:
        $ref: "#/definitions/WatcherProperties"
        description: Gets or sets the watcher properties.
        x-ms-client-flatten: true
  WatcherListResult:
    description: The response model for the list watcher operation.
    properties:
      nextLink:
        description: Gets or sets the next link.
        type: string
      value:
        description: Gets or sets a list of watchers.
        items:
          $ref: "#/definitions/Watcher"
        type: array
  WatcherProperties:
    description: Definition of the watcher properties
    properties:
      creationTime:
        description: Gets or sets the creation time.
        format: date-time
        readOnly: true
        type: string
        x-nullable: false
      description:
        description: Gets or sets the description.
        type: string
      executionFrequencyInSeconds:
        description: Gets or sets the frequency at which the watcher is invoked.
        format: int64
        type: integer
      lastModifiedBy:
        description: Details of the user who last modified the watcher.
        readOnly: true
        type: string
      lastModifiedTime:
        description: Gets or sets the last modified time.
        format: date-time
        readOnly: true
        type: string
        x-nullable: false
      scriptName:
        description: Gets or sets the name of the script the watcher is attached to, i.e. the name of an existing runbook.
        type: string
      scriptParameters:
        additionalProperties:
          type: string
        description: Gets or sets the parameters of the script.
        type: object
      scriptRunOn:
        description: Gets or sets the name of the hybrid worker group the watcher will run on.
        type: string
      status:
        description: Gets the current status of the watcher.
        readOnly: true
        type: string
  WatcherUpdateParameters:
    properties:
      name:
        description: Gets or sets the name of the resource.
        type: string
      properties:
        $ref: "#/definitions/WatcherUpdateProperties"
        description: Gets or sets the watcher update properties.
        x-ms-client-flatten: true
  WatcherUpdateProperties:
    description: The properties of the update watcher operation.
    properties:
      executionFrequencyInSeconds:
        description: Gets or sets the frequency at which the watcher is invoked.
        format: int64
        type: integer
