編集

Python 用 Azure CDN ライブラリAzure CDN libraries for python

概要Overview

Azure Content Delivery Network (CDN) を使用すると、世界中で高帯域幅の可用性を実現するための Web コンテンツ キャッシュを提供することができます。Azure Content Delivery Network (CDN) allows you to provide web content caches to ensure high-bandwidth availability across the globe.

Azure CDN を導入するには、「Azure CDN の概要」を参照してください。To get started with Azure CDN, see Getting started with Azure CDN.

管理 APIManagement APIs

Management API で Azure CDN を作成、照会、管理します。Create, query, and manage Azure CDNs with the management API.

pip で管理パッケージをインストールします。Install the management package via pip.

pip install azure-mgmt-cdn

Example

単一の定義済みエンドポイントを備えた CDN プロファイルを作成しています。Creating a CDN profile with a single defined endpoint:

from azure.mgmt.cdn import CdnManagementClient

cdn_client = CdnManagementClient(credentials, 'your-subscription-id')
profile_poller = cdn_client.profiles.create('my-resource-group',
                                            'cdn-name',
                                            {
                                                "location": "some_region", 
                                                "sku": {
                                                    "name": "sku_tier"
                                                } 
                                            })
profile = profile_poller.result()

endpoint_poller = cdn_client.endpoints.create('my-resource-group',
                                          'cdn-name',
                                          'unique-endpoint-name', 
                                          { 
                                              "location": "any_region", 
                                              "origins": [
                                                  {
                                                      "name": "origin_name", 
                                                      "host_name": "url"
                                                  }]
                                          })
endpoint = endpoint_poller.result()