Interface IZoneLockdownApi
- Namespace
- Cloudflare.NET.Zones.Firewall
- Assembly
- Cloudflare.NET.dll
Defines the contract for managing Zone Lockdown rules.
Lockdown rules specify a list of IP addresses that are the only ones allowed to access a given URL or set of URLs.
public interface IZoneLockdownApi
Methods
CreateAsync(string, CreateLockdownRequest, CancellationToken)
Creates a new Lockdown rule for a zone.
Task<Lockdown> CreateAsync(string zoneId, CreateLockdownRequest request, CancellationToken cancellationToken = default)
Parameters
zoneIdstringThe ID of the zone.
requestCreateLockdownRequestThe request containing the details of the rule to create.
cancellationTokenCancellationTokenA cancellation token.
Returns
DeleteAsync(string, string, CancellationToken)
Deletes a Lockdown rule from a zone.
Task<string> DeleteAsync(string zoneId, string lockdownId, CancellationToken cancellationToken = default)
Parameters
zoneIdstringThe ID of the zone.
lockdownIdstringThe ID of the rule to delete.
cancellationTokenCancellationTokenA cancellation token.
Returns
GetAsync(string, string, CancellationToken)
Gets a single Lockdown rule by its ID.
Task<Lockdown> GetAsync(string zoneId, string lockdownId, CancellationToken cancellationToken = default)
Parameters
zoneIdstringThe ID of the zone.
lockdownIdstringThe ID of the Lockdown rule.
cancellationTokenCancellationTokenA cancellation token.
Returns
ListAllAsync(string, int?, CancellationToken)
Lists all Lockdown rules for a zone, automatically handling pagination.
IAsyncEnumerable<Lockdown> ListAllAsync(string zoneId, int? perPage = null, CancellationToken cancellationToken = default)
Parameters
zoneIdstringThe ID of the zone.
perPageint?The number of results to fetch per API page.
cancellationTokenCancellationTokenA cancellation token.
Returns
- IAsyncEnumerable<Lockdown>
An asynchronous stream of all Lockdown rules for the zone.
Remarks
This method simplifies fetching all rules by abstracting away the pagination logic.
ListAsync(string, ListLockdownFilters?, CancellationToken)
Lists all Lockdown rules for a zone, allowing for manual pagination.
Task<PagePaginatedResult<Lockdown>> ListAsync(string zoneId, ListLockdownFilters? filters = null, CancellationToken cancellationToken = default)
Parameters
zoneIdstringThe ID of the zone.
filtersListLockdownFiltersOptional pagination filters.
cancellationTokenCancellationTokenA cancellation token.
Returns
- Task<PagePaginatedResult<Lockdown>>
A single page of Lockdown rules along with pagination information.
Remarks
This method is intended for developers who need to control the pagination process manually. Use the properties of the returned PagePaginatedResult<T> to determine if there are more pages and to construct the filter for the next call.
UpdateAsync(string, string, UpdateLockdownRequest, CancellationToken)
Updates an existing Lockdown rule.
Task<Lockdown> UpdateAsync(string zoneId, string lockdownId, UpdateLockdownRequest request, CancellationToken cancellationToken = default)
Parameters
zoneIdstringThe ID of the zone.
lockdownIdstringThe ID of the rule to update.
requestUpdateLockdownRequestThe request containing the fields to update.
cancellationTokenCancellationTokenA cancellation token.