swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: The Azure Storage Management API.
  title: StorageManagementClient
  version: 2018-03-01-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/storage/resource-manager/Microsoft.Storage/preview/2018-03-01-preview/managementpolicy.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: storage-managementpolicy
  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:
  ManagementPolicyName:
    description: The name of the Storage Account Management Policy. It should always be 'default'
    enum:
      - default
    in: path
    name: managementPolicyName
    required: true
    type: string
    x-ms-enum:
      modelAsString: true
      name: ManagementPolicyName
    x-ms-parameter-location: method
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}":
    delete:
      description: Deletes the data policy rules associated with the specified storage account.
      operationId: ManagementPolicies_Delete
      parameters:
        - description: The name of the resource group within the user's subscription. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
          in: path
          maxLength: 24
          minLength: 3
          name: accountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - $ref: "#/parameters/ManagementPolicyName"
      responses:
        "200":
          description: OK -- Delete management policies successfully.
        "204":
          description: No Content -- The management policies does not exist.
      tags:
        - ManagementPolicies
      x-ms-examples:
        StorageAccountDeleteManagementPolicies:
          parameters:
            accountName: sto2527
            api-version: 2018-03-01-preview
            managementPolicyName: default
            monitor: "true"
            resourceGroupName: res6977
            subscriptionId: "{subscription-id}"
          responses:
            "200": {}
            "204": {}
    get:
      description: Gets the data policy rules associated with the specified storage account.
      operationId: ManagementPolicies_Get
      parameters:
        - description: The name of the resource group within the user's subscription. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
          in: path
          maxLength: 24
          minLength: 3
          name: accountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - $ref: "#/parameters/ManagementPolicyName"
      responses:
        "200":
          description: OK -- Get management policies successfully.
          schema:
            $ref: "#/definitions/StorageAccountManagementPolicies"
      tags:
        - ManagementPolicies
      x-ms-examples:
        StorageAccountGetManagementPolicies:
          parameters:
            accountName: sto2527
            api-version: 2018-03-01-preview
            managementPolicyName: default
            monitor: "true"
            resourceGroupName: res6977
            subscriptionId: "{subscription-id}"
          responses:
            "200":
              body:
                id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Storage/storageAccounts/sto288/managementPolicies/default
                name: DefaultManagementPolicy
                properties:
                  lastModifiedTime: 2018-06-08T03:01:55.7168089Z
                  policy:
                    rules:
                      - definition:
                          actions:
                            baseBlob:
                              delete:
                                daysAfterModificationGreaterThan: 1000
                              tierToArchive:
                                daysAfterModificationGreaterThan: 90
                              tierToCool:
                                daysAfterModificationGreaterThan: 30
                            snapshot:
                              delete:
                                daysAfterCreationGreaterThan: 30
                          filters:
                            blobTypes:
                              - blockBlob
                            prefixMatch:
                              - olcmtestcontainer
                        name: olcmtest
                        type: Lifecycle
                    version: "0.5"
                type: Microsoft.Storage/storageAccounts/managementPolicies
    put:
      description: Sets the data policy rules associated with the specified storage account.
      operationId: ManagementPolicies_CreateOrUpdate
      parameters:
        - description: The name of the resource group within the user's subscription. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
          in: path
          maxLength: 24
          minLength: 3
          name: accountName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - $ref: "#/parameters/ManagementPolicyName"
        - description: The data policy rules to set to a storage account.
          in: body
          name: properties
          required: true
          schema:
            $ref: "#/definitions/ManagementPoliciesRulesSetParameter"
      responses:
        "200":
          description: OK -- Get management policies successfully.
          schema:
            $ref: "#/definitions/StorageAccountManagementPolicies"
      tags:
        - ManagementPolicies
      x-ms-examples:
        StorageAccountSetManagementPolicies:
          parameters:
            accountName: sto9699
            api-version: 2018-03-01-preview
            managementPolicyName: default
            monitor: "true"
            properties:
              properties:
                policy:
                  rules:
                    - definition:
                        actions:
                          baseBlob:
                            delete:
                              daysAfterModificationGreaterThan: 1000
                            tierToArchive:
                              daysAfterModificationGreaterThan: 90
                            tierToCool:
                              daysAfterModificationGreaterThan: 30
                          snapshot:
                            delete:
                              daysAfterCreationGreaterThan: 30
                        filters:
                          blobTypes:
                            - blockBlob
                          prefixMatch:
                            - olcmtestcontainer
                      name: olcmtest
                      type: Lifecycle
                  version: "0.5"
            resourceGroupName: res7687
            subscriptionId: "{subscription-id}"
          responses:
            "200":
              body:
                id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Storage/storageAccounts/sto288/managementPolicies/default
                name: DefaultManagementPolicy
                properties:
                  lastModifiedTime: 2018-06-08T02:53:39.0932539Z
                  policy:
                    rules:
                      - definition:
                          actions:
                            baseBlob:
                              delete:
                                daysAfterModificationGreaterThan: 1000
                              tierToArchive:
                                daysAfterModificationGreaterThan: 90
                              tierToCool:
                                daysAfterModificationGreaterThan: 30
                            snapshot:
                              delete:
                                daysAfterCreationGreaterThan: 30
                          filters:
                            blobTypes:
                              - blockBlob
                            prefixMatch:
                              - olcmtestcontainer
                        name: olcmtest
                        type: Lifecycle
                    version: "0.5"
                type: Microsoft.Storage/storageAccounts/managementPolicies
definitions:
  ManagementPoliciesRules:
    description: "The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts."
    properties:
      policy:
        description: "The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts."
        type: object
  ManagementPoliciesRulesSetParameter:
    description: "The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts."
    properties:
      properties:
        $ref: "#/definitions/ManagementPoliciesRules"
        description: "The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts."
        x-ms-client-flatten: true
  StorageAccountManagementPolicies:
    allOf:
      - properties:
          id:
            description: Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
            readOnly: true
            type: string
          name:
            description: The name of the resource
            readOnly: true
            type: string
          type:
            description: The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
            readOnly: true
            type: string
        x-ms-azure-resource: true
    description: The Get Storage Account ManagementPolicies operation response.
    properties:
      properties:
        $ref: "#/definitions/StorageAccountManagementPoliciesRulesProperty"
        description: Returns the Storage Account Data Policies Rules.
        readOnly: true
        x-ms-client-flatten: true
  StorageAccountManagementPoliciesRulesProperty:
    allOf:
      - $ref: "#/definitions/ManagementPoliciesRules"
    description: The Storage Account Data Policies properties.
    properties:
      lastModifiedTime:
        description: Returns the date and time the ManagementPolicies was last modified.
        format: date-time
        readOnly: true
        type: string
