@@ -46,6 +46,10 @@ class AzureCDN(CDN):
46
46
tenant-id: "secret5"
47
47
client-id: "secret6"
48
48
client-secret: "secret7"
49
+ domains:
50
+ - "<domain1>"
51
+ - "<domain2>"
52
+ ...
49
53
```
50
54
"""
51
55
@@ -58,6 +62,7 @@ def __init__(
58
62
tenant_id : str ,
59
63
client_id : str ,
60
64
client_secret : str ,
65
+ domains : list ,
61
66
):
62
67
credential = ClientSecretCredential (
63
68
tenant_id = tenant_id ,
@@ -72,6 +77,7 @@ def __init__(
72
77
self .__resource_group_name = resource_group_name
73
78
self .__profile_name = profile_name
74
79
self .__endpoint_name = endpoint_name
80
+ self .__domains = domains
75
81
76
82
super ().__init__ ()
77
83
@@ -89,23 +95,24 @@ def from_config(cfg: dict) -> CDN:
89
95
tenant_id = cfg ["tenant-id" ],
90
96
client_id = cfg ["client-id" ],
91
97
client_secret = cfg ["client-secret" ],
98
+ domains = cfg ["domains" ],
92
99
)
93
100
94
101
def refresh_cache (self , path : Path ) -> None :
95
102
path_str = str (Path ("/" , path ))
96
103
97
- self ._log_info ("Refreshing CDN cache." , path = path_str )
104
+ self ._log_info ("Refreshing CDN cache." , path = path_str , domains = str ( self . __domains ) )
98
105
99
- poller : LROPoller = self .__cdn .endpoints .begin_purge_content (
106
+ poller : LROPoller = self .__cdn .afd_endpoints .begin_purge_content (
100
107
resource_group_name = self .__resource_group_name ,
101
108
profile_name = self .__profile_name ,
102
109
endpoint_name = self .__endpoint_name ,
103
- content_file_paths = PurgeParameters ( content_paths = [path_str ]) ,
110
+ contents = { "contentPaths" : [path_str ], "domains" : self . __domains } ,
104
111
)
105
112
poller .wait ()
106
113
107
114
status = poller .status ()
108
115
if not status == "Succeeded" :
109
116
raise Exception ("Failed to refresh CDN cache. status: {}" .format (status ))
110
117
111
- self ._log_info ("Successfully refreshed CDN cache." , path = path_str )
118
+ self ._log_info ("Successfully refreshed CDN cache." , path = path_str , domains = str ( self . __domains ) )
0 commit comments