Clear EdgeCast CDN Cache

Octopus.Script exported 2015-02-20 by yooakim belongs to ‘EdgeCast’ category.

This step will clear (purge) the EdgeCast CDN Cache

Parameters

When steps based on the template are included in a project’s deployment process, the parameters below can be set.

null

AccountNumber

CDN Account number, can be found in MCC

null

ApiToken

API token for accessing the EdgeCast API for the account

null

MediaPath

A string that indicates the CDN or edge CNAME URL for the asset or the location that will be purged from our edge servers. Make sure to include the proper protocol (i.e., http:// or rtmp://).

MediaType

MediaType = 3

An integer that indicates the service for which an asset will be purged. It should be replaced with the ID associated with the desired service., default is 3. HTTP Large

Script body

Steps based on this template will execute the following PowerShell script.

function Clear-EdgeCastCache
{
    [CmdletBinding()]
    Param
    (
        # CDN Account number, can be found in MCC
        [Parameter(Mandatory=$true)]
        $AccountNumber,

        # API Token
        [Parameter(Mandatory=$true)]
        [string]$ApiToken,

         # A string that indicates the CDN or edge CNAME URL for the asset or the location that will be purged from our edge servers. Make sure to include the proper protocol (i.e., http:// or rtmp://).
        [Parameter(Mandatory=$true)]
        [string]
        $MediaPath,

        #An integer that indicates the service for which an asset will be purged. It should be replaced with the ID associated with the desired service., default is 3. HTTP Large
        [ValidateSet(2,3,8,14)]
        [int]
        $MediaType=3
    )

    Begin
    {
        $uri = "https://api.edgecast.com/v2/mcc/customers/$AccountNumber/edge/purge"

        $headers = @{
            'Authorization' = "tok:" + $ApiToken
            'Accept' = 'Application/JSON'
            'Content-Type' = 'Application/JSON'
            }
        $RequestParameters = @{
            'MediaPath'=$MediaPath
            'MediaType'=$MediaType
        }

        $body = ConvertTo-Json $RequestParameters

    }
    Process
    {
        Write-Verbose "Request body $body"
    	$request = Invoke-RestMethod -Method PUT -Uri $uri -Headers $headers -Body $body -DisableKeepAlive
        $request

    }
    End
    {
    }
}

Clear-EdgeCastCache -AccountNumber $AccountNumber -ApiToken $ApiToken -MediaPath $MediaPath -MediaType $MediaType -Verbose

Provided under the Apache License version 2.0.

Report an issue

To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.

{
  "Id": "d97ff2d4-250a-4a1a-bd5e-36644893888c",
  "Name": "Clear EdgeCast CDN Cache",
  "Description": "This step will clear (purge) the EdgeCast CDN Cache",
  "Version": 1,
  "ExportedAt": "2015-02-20T16:10:46.008+00:00",
  "ActionType": "Octopus.Script",
  "Author": "yooakim",
  "Parameters": [
    {
      "Name": "AccountNumber",
      "Label": null,
      "HelpText": "CDN Account number, can be found in MCC",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    },
    {
      "Name": "ApiToken",
      "Label": null,
      "HelpText": "API token for accessing the EdgeCast API for the account",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "Sensitive"
      }
    },
    {
      "Name": "MediaPath",
      "Label": null,
      "HelpText": "A string that indicates the CDN or edge CNAME URL for the asset or the location that will be purged from our edge servers. Make sure to include the proper protocol (i.e., http:// or rtmp://).",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    },
    {
      "Name": "MediaType",
      "Label": "MediaType",
      "HelpText": "An integer that indicates the service for which an asset will be purged. It should be replaced with the ID associated with the desired service., default is 3. HTTP Large",
      "DefaultValue": "3",
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    }
  ],
  "Properties": {
    "Octopus.Action.Script.ScriptBody": "function Clear-EdgeCastCache\n{\n    [CmdletBinding()]\n    Param\n    (\n        # CDN Account number, can be found in MCC\n        [Parameter(Mandatory=$true)]\n        $AccountNumber,\n\n        # API Token\n        [Parameter(Mandatory=$true)]\n        [string]$ApiToken,\n\n         # A string that indicates the CDN or edge CNAME URL for the asset or the location that will be purged from our edge servers. Make sure to include the proper protocol (i.e., http:// or rtmp://).\n        [Parameter(Mandatory=$true)]\n        [string]\n        $MediaPath,\n\n        #An integer that indicates the service for which an asset will be purged. It should be replaced with the ID associated with the desired service., default is 3. HTTP Large\n        [ValidateSet(2,3,8,14)]\n        [int]\n        $MediaType=3\n    )\n\n    Begin\n    {\n        $uri = \"https://api.edgecast.com/v2/mcc/customers/$AccountNumber/edge/purge\"\n\n        $headers = @{\n            'Authorization' = \"tok:\" + $ApiToken\n            'Accept' = 'Application/JSON'\n            'Content-Type' = 'Application/JSON'\n            }\n        $RequestParameters = @{\n            'MediaPath'=$MediaPath\n            'MediaType'=$MediaType\n        }\n\n        $body = ConvertTo-Json $RequestParameters\n\n    }\n    Process\n    {\n        Write-Verbose \"Request body $body\"\n    \t$request = Invoke-RestMethod -Method PUT -Uri $uri -Headers $headers -Body $body -DisableKeepAlive\n        $request\n\n    }\n    End\n    {\n    }\n}\n\nClear-EdgeCastCache -AccountNumber $AccountNumber -ApiToken $ApiToken -MediaPath $MediaPath -MediaType $MediaType -Verbose\n",
    "Octopus.Action.Script.Syntax": "PowerShell"
  },
  "Category": "EdgeCast",
  "HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/edgecast-cdn-purge.json",
  "Website": "/step-templates/d97ff2d4-250a-4a1a-bd5e-36644893888c",
  "Logo": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMBQTFRF////rrCzTLtCxcfJ1tfYsLK1z+zNj9SJdMtss7W4U8VIr7G08/T06+vs4uPkuLq96fboTbxDtuKy+fr5Tr1E8/ryvL3BUL9Gqd2l/Pz8/v7+tbe6W8NST8JETbtDZ8Zegc96crht+f35y8zPwMLE/v/+/P788PDx0NLT29zdr7Gz7e7undmX5ebnwue/9/j4S7tB3+DhrrGz9vb2+/z7/f797/juTbtC6Onp///+sri23fLb+/v7/f39ra+y9/z3BkUJcQAAEXlJREFUeNrsXQ1bqszT12DVFXF9QVAWtScwIN+Oxyx7lLvv/63+OwtWxlqCYJ3rYrqvu66TAcPszPzmZWdLpYIKKqigggoqqKCCCiqooIIKKqigggoq6BMF+7U73W5Vd90dT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1FrW4dAzRLHjqYnXxX4qO3wTJmej9KNkrsPd7myBUSfZPGAmT4pwWBXyfpiN0B974RlOiGAi+Y2zzGfQ8CWKwumbiHqNX3K6WJetEH7YHgwz1W1/+9WY2cle9eEksuhkMeT4y9IvoqakwxGBMG2IKlh3vKbb6AZHL9oMug137jk6EwU/xoZ9nkir33YE337qSVDXR9GYWUTgDEebzwL24eQ9z7ZhehX7FQ4PeUNEsrf70i+kgetLDuzWCJc+5lveUVgJYj/CLnH0EP4GYV3y1W7p19LG9T2dn09zoIf3H6O+LjgukenRbz9tE3RflXktCxwMDneVhWdsIl7WktV96V+iwXoeagdTD4+fVemr60HpH6Vg312uGS27+2BSKqigggoqqKCCCiqooIIKKqigggoqqKCM6H8CDACqMNnmHuC6DQAAAABJRU5ErkJggg==",
  "$Meta": {
    "Type": "ActionTemplate"
  }
}

History

Page updated on Friday, February 20, 2015