swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  title: AutomationManagement
  version: 2017-05-15-preview
  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/preview/2017-05-15-preview/sourceControl.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: automation-sourceControl
  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
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls":
    get:
      description: Retrieve a list of source controls.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/sourcecontroloperations
      operationId: SourceControl_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/SourceControlListResult"
        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:
        - SourceControl
      x-ms-examples:
        List sourceControls:
          parameters:
            api-version: 2017-05-15-preview
            automationAccountName: sampleAccount9
            resourceGroupName: rg
            subscriptionId: subid
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/sampleAccount9/sourcecontrols/sampleSourceControl1
                    name: sampleSourceControl1
                    properties:
                      autoSync: true
                      branch: master
                      creationTime: 2017-03-28T22:59:00.937+00:00
                      description: my description
                      folderPath: /sampleFolder/sampleFolder2
                      lastModifiedTime: 2017-03-28T22:59:00.937+00:00
                      publishRunbook: true
                      repoUrl: https://github.com/SampleUserRepro/PowerShell-1
                      sourceType: GitHub
                  - id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/sampleAccount9/sourcecontrols/sampleSourceControl2
                    name: sampleSourceControl2
                    properties:
                      autoSync: true
                      branch: master
                      creationTime: 2017-03-28T22:59:00.937+00:00
                      description: my description
                      folderPath: /sampleFolder/sampleFolder2
                      lastModifiedTime: 2017-03-28T22:59:00.937+00:00
                      publishRunbook: true
                      repoUrl: https://github.com/SampleUserRepro/PowerShell-2
                      sourceType: GitHub
                  - id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/sampleAccount9/sourcecontrols/sampleSourceControl3
                    name: sampleSourceControl3
                    properties:
                      autoSync: true
                      branch: master
                      creationTime: 2017-03-28T22:59:00.937+00:00
                      description: my description
                      folderPath: /sampleFolder/sampleFolder2
                      lastModifiedTime: 2017-03-28T22:59:00.937+00:00
                      publishRunbook: true
                      repoUrl: https://github.com/SampleUserRepro/PowerShell-3
                      sourceType: GitHub
                  - id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/sampleAccount9/sourcecontrols/sampleSourceControl4
                    name: sampleSourceControl4
                    properties:
                      autoSync: true
                      branch: master
                      creationTime: 2017-03-28T22:59:00.937+00:00
                      description: my description
                      folderPath: /sampleFolder/sampleFolder2
                      lastModifiedTime: 2017-03-28T22:59:00.937+00:00
                      publishRunbook: true
                      repoUrl: https://github.com/SampleUserRepro/PowerShell-4
                      sourceType: GitHub
                  - id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/sampleAccount9/sourcecontrols/sampleSourceControl5
                    name: sampleSourceControl5
                    properties:
                      autoSync: true
                      branch: master
                      creationTime: 2017-03-28T22:59:00.937+00:00
                      description: my description
                      folderPath: /sampleFolder/sampleFolder2
                      lastModifiedTime: 2017-03-28T22:59:00.937+00:00
                      publishRunbook: true
                      repoUrl: https://github.com/SampleUserRepro/PowerShell-5
                      sourceType: GitHub
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}":
    delete:
      description: Delete the source control.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/sourcecontroloperations
      operationId: SourceControl_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 name of source control.
          in: path
          name: sourceControlName
          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:
        - SourceControl
      x-ms-examples:
        Delete a source control:
          parameters:
            api-version: 2017-05-15-preview
            automationAccountName: sampleAccount9
            resourceGroupName: rg
            sourceControlName: sampleSourceControl
            subscriptionId: subid
          responses:
            "200": {}
    get:
      description: Retrieve the source control identified by source control name.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/sourcecontroloperations
      operationId: SourceControl_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 name of source control.
          in: path
          name: sourceControlName
          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/SourceControl"
        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:
        - SourceControl
      x-ms-examples:
        Get a source control:
          parameters:
            api-version: 2017-05-15-preview
            automationAccountName: sampleAccount9
            resourceGroupName: rg
            sourceControlName: sampleSourceControl
            subscriptionId: subid
          responses:
            "200":
              body:
                id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/sampleAccount9/sourcecontrols/sampleSourceControl
                name: sampleSourceControl
                properties:
                  autoSync: true
                  branch: master
                  creationTime: 2017-03-28T22:59:00.937+00:00
                  description: my description
                  folderPath: /folderOne/folderTwo
                  lastModifiedTime: 2017-03-28T22:59:00.937+00:00
                  publishRunbook: true
                  repoUrl: https://github.com/SampleUserRepro/PowerShell
                  sourceType: GitHub
    patch:
      description: Update a source control.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/sourcecontroloperations
      operationId: SourceControl_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 source control name.
          in: path
          name: sourceControlName
          required: true
          type: string
        - description: The parameters supplied to the update source control operation.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/SourceControlUpdateParameters"
        - 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/SourceControl"
        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:
        - SourceControl
      x-ms-examples:
        Update a source control:
          parameters:
            api-version: 2017-05-15-preview
            automationAccountName: sampleAccount9
            parameters:
              properties:
                autoSync: true
                branch: master
                description: my description
                folderPath: /folderOne/folderTwo
                publishRunbook: true
                securityToken:
                  accessToken: 3a326f7a0dcd343ea58fee21f2fd5fb4c1234567
                  tokenType: PersonalAccessToken
            resourceGroupName: rg
            sourceControlName: sampleSourceControl
            subscriptionId: subid
          responses:
            "200":
              body:
                id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/sampleAccount9/sourcecontrols/sampleSourceControl
                name: sampleSourceControl
                properties:
                  autoSync: true
                  branch: master
                  creationTime: 2017-03-28T22:59:00.937+00:00
                  description: my description
                  folderPath: /folderOne/folderTwo
                  lastModifiedTime: 2017-03-28T22:59:00.937+00:00
                  publishRunbook: true
                  repoUrl: https://sampleUser.visualstudio.com/myProject/_git/myRepository
                  sourceType: VsoGit
              headers: {}
    put:
      description: Create a source control.
      externalDocs:
        url: http://aka.ms/azureautomationsdk/sourcecontroloperations
      operationId: SourceControl_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 source control name.
          in: path
          name: sourceControlName
          required: true
          type: string
        - description: The parameters supplied to the create or update source control operation.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/SourceControlCreateOrUpdateParameters"
        - 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/SourceControl"
        "201":
          description: Created
          schema:
            $ref: "#/definitions/SourceControl"
        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:
        - SourceControl
      x-ms-examples:
        Create or update a source control:
          parameters:
            api-version: 2017-05-15-preview
            automationAccountName: sampleAccount9
            parameters:
              properties:
                autoSync: true
                branch: master
                description: my description
                folderPath: /folderOne/folderTwo
                publishRunbook: true
                repoUrl: https://sampleUser.visualstudio.com/myProject/_git/myRepository
                securityToken:
                  accessToken: 3a326f7a0dcd343ea58fee21f2fd5fb4c1234567
                  tokenType: PersonalAccessToken
                sourceType: VsoGit
            resourceGroupName: rg
            sourceControlName: sampleSourceControl
            subscriptionId: subid
          responses:
            "200":
              body:
                id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/sampleAccount9/sourcecontrols/sampleSourceControl
                name: sampleSourceControl
                properties:
                  autoSync: true
                  branch: master
                  creationTime: 2017-03-28T22:59:00.937+00:00
                  description: my description
                  folderPath: /folderOne/folderTwo
                  lastModifiedTime: 2017-03-28T22:59:00.937+00:00
                  publishRunbook: true
                  repoUrl: https://sampleUser.visualstudio.com/myProject/_git/myRepository
                  sourceType: VsoGit
              headers: {}
            "201":
              body:
                id: /subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/sampleAccount9/sourcecontrols/sampleSourceControl
                name: sampleSourceControl
                properties:
                  autoSync: true
                  branch: master
                  creationTime: 2017-03-28T22:59:00.937+00:00
                  description: my description
                  folderPath: /folderOne/folderTwo
                  lastModifiedTime: 2017-03-28T22:59:00.937+00:00
                  publishRunbook: true
                  repoUrl: https://sampleUser.visualstudio.com/myProject/_git/myRepository
                  sourceType: VsoGit
              headers: {}
definitions:
  SourceControl:
    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: ARM proxy resource.
        properties: {}
        type: object
    description: Definition of the source control.
    properties:
      properties:
        $ref: "#/definitions/SourceControlProperties"
        description: The properties of the source control.
        x-ms-client-flatten: true
  SourceControlCreateOrUpdateParameters:
    description: The parameters supplied to the create or update source control operation.
    properties:
      properties:
        $ref: "#/definitions/SourceControlCreateOrUpdateProperties"
        description: The properties of the source control.
        x-ms-client-flatten: true
    required:
      - properties
  SourceControlCreateOrUpdateProperties:
    description: The properties of the create source control operation.
    properties:
      autoSync:
        description: The auto async of the source control. Default is false.
        type: boolean
      branch:
        description: The repo branch of the source control. Include branch as empty string for VsoTfvc.
        maxLength: 255
        type: string
      description:
        description: The user description of the source control.
        maxLength: 512
        type: string
      folderPath:
        description: The folder path of the source control. Path must be relative.
        maxLength: 255
        type: string
      publishRunbook:
        description: The auto publish of the source control. Default is true.
        type: boolean
      repoUrl:
        description: The repo url of the source control.
        maxLength: 2000
        type: string
      securityToken:
        $ref: "#/definitions/SourceControlSecurityTokenProperties"
        description: The authorization token for the repo of the source control.
      sourceType:
        description: The source type. Must be one of VsoGit, VsoTfvc, GitHub, case sensitive.
        enum:
          - VsoGit
          - VsoTfvc
          - GitHub
        type: string
        x-ms-enum:
          modelAsString: true
          name: sourceType
  SourceControlListResult:
    description: The response model for the list source controls operation.
    properties:
      nextLink:
        description: The next link.
        type: string
      value:
        description: The list of source controls.
        items:
          $ref: "#/definitions/SourceControl"
        type: array
  SourceControlProperties:
    description: Definition of the source control properties
    properties:
      autoSync:
        description: The auto sync of the source control. Default is false.
        type: boolean
      branch:
        description: The repo branch of the source control. Include branch as empty string for VsoTfvc.
        type: string
      creationTime:
        description: The creation time.
        format: date-time
        type: string
        x-nullable: false
      description:
        description: The description.
        type: string
      folderPath:
        description: The folder path of the source control.
        type: string
      lastModifiedTime:
        description: The last modified time.
        format: date-time
        type: string
        x-nullable: false
      publishRunbook:
        description: The auto publish of the source control. Default is true.
        type: boolean
      repoUrl:
        description: The repo url of the source control.
        type: string
      sourceType:
        description: The source type. Must be one of VsoGit, VsoTfvc, GitHub.
        enum:
          - VsoGit
          - VsoTfvc
          - GitHub
        type: string
        x-ms-enum:
          modelAsString: true
          name: sourceType
  SourceControlSecurityTokenProperties:
    properties:
      accessToken:
        description: The access token.
        maxLength: 1024
        type: string
      refreshToken:
        description: The refresh token.
        maxLength: 1024
        type: string
      tokenType:
        description: The token type. Must be either PersonalAccessToken or Oauth.
        enum:
          - PersonalAccessToken
          - Oauth
        type: string
        x-ms-enum:
          modelAsString: true
          name: tokenType
  SourceControlUpdateParameters:
    description: The parameters supplied to the update source control operation.
    properties:
      properties:
        $ref: "#/definitions/SourceControlUpdateProperties"
        description: The value of the source control.
        x-ms-client-flatten: true
  SourceControlUpdateProperties:
    description: The properties of the update source control
    properties:
      autoSync:
        description: The auto sync of the source control. Default is false.
        type: boolean
      branch:
        description: The repo branch of the source control.
        type: string
      description:
        description: The user description of the source control.
        type: string
      folderPath:
        description: The folder path of the source control. Path must be relative.
        type: string
      publishRunbook:
        description: The auto publish of the source control. Default is true.
        type: boolean
      securityToken:
        $ref: "#/definitions/SourceControlSecurityTokenProperties"
        description: The authorization token for the repo of the source control.
