| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Threading; |
| | 10 | | using System.Threading.Tasks; |
| | 11 | | using Azure; |
| | 12 | | using Azure.Core.Pipeline; |
| | 13 | | using Azure.ResourceManager.Network.Models; |
| | 14 | |
|
| | 15 | | namespace Azure.ResourceManager.Network |
| | 16 | | { |
| | 17 | | /// <summary> The DdosCustomPolicies service client. </summary> |
| | 18 | | public partial class DdosCustomPoliciesOperations |
| | 19 | | { |
| | 20 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 21 | | private readonly HttpPipeline _pipeline; |
| 0 | 22 | | internal DdosCustomPoliciesRestOperations RestClient { get; } |
| | 23 | | /// <summary> Initializes a new instance of DdosCustomPoliciesOperations for mocking. </summary> |
| 0 | 24 | | protected DdosCustomPoliciesOperations() |
| | 25 | | { |
| 0 | 26 | | } |
| | 27 | | /// <summary> Initializes a new instance of DdosCustomPoliciesOperations. </summary> |
| | 28 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 29 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 30 | | /// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subsc |
| | 31 | | /// <param name="endpoint"> server parameter. </param> |
| 0 | 32 | | internal DdosCustomPoliciesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscri |
| | 33 | | { |
| 0 | 34 | | RestClient = new DdosCustomPoliciesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 0 | 35 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 36 | | _pipeline = pipeline; |
| 0 | 37 | | } |
| | 38 | |
|
| | 39 | | /// <summary> Gets information about the specified DDoS custom policy. </summary> |
| | 40 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 41 | | /// <param name="ddosCustomPolicyName"> The name of the DDoS custom policy. </param> |
| | 42 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 43 | | public virtual async Task<Response<DdosCustomPolicy>> GetAsync(string resourceGroupName, string ddosCustomPolicy |
| | 44 | | { |
| 0 | 45 | | using var scope = _clientDiagnostics.CreateScope("DdosCustomPoliciesOperations.Get"); |
| 0 | 46 | | scope.Start(); |
| | 47 | | try |
| | 48 | | { |
| 0 | 49 | | return await RestClient.GetAsync(resourceGroupName, ddosCustomPolicyName, cancellationToken).ConfigureAw |
| | 50 | | } |
| 0 | 51 | | catch (Exception e) |
| | 52 | | { |
| 0 | 53 | | scope.Failed(e); |
| 0 | 54 | | throw; |
| | 55 | | } |
| 0 | 56 | | } |
| | 57 | |
|
| | 58 | | /// <summary> Gets information about the specified DDoS custom policy. </summary> |
| | 59 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 60 | | /// <param name="ddosCustomPolicyName"> The name of the DDoS custom policy. </param> |
| | 61 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 62 | | public virtual Response<DdosCustomPolicy> Get(string resourceGroupName, string ddosCustomPolicyName, Cancellatio |
| | 63 | | { |
| 0 | 64 | | using var scope = _clientDiagnostics.CreateScope("DdosCustomPoliciesOperations.Get"); |
| 0 | 65 | | scope.Start(); |
| | 66 | | try |
| | 67 | | { |
| 0 | 68 | | return RestClient.Get(resourceGroupName, ddosCustomPolicyName, cancellationToken); |
| | 69 | | } |
| 0 | 70 | | catch (Exception e) |
| | 71 | | { |
| 0 | 72 | | scope.Failed(e); |
| 0 | 73 | | throw; |
| | 74 | | } |
| 0 | 75 | | } |
| | 76 | |
|
| | 77 | | /// <summary> Update a DDoS custom policy tags. </summary> |
| | 78 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 79 | | /// <param name="ddosCustomPolicyName"> The name of the DDoS custom policy. </param> |
| | 80 | | /// <param name="parameters"> Parameters supplied to update DDoS custom policy resource tags. </param> |
| | 81 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 82 | | public virtual async Task<Response<DdosCustomPolicy>> UpdateTagsAsync(string resourceGroupName, string ddosCusto |
| | 83 | | { |
| 0 | 84 | | using var scope = _clientDiagnostics.CreateScope("DdosCustomPoliciesOperations.UpdateTags"); |
| 0 | 85 | | scope.Start(); |
| | 86 | | try |
| | 87 | | { |
| 0 | 88 | | return await RestClient.UpdateTagsAsync(resourceGroupName, ddosCustomPolicyName, parameters, cancellatio |
| | 89 | | } |
| 0 | 90 | | catch (Exception e) |
| | 91 | | { |
| 0 | 92 | | scope.Failed(e); |
| 0 | 93 | | throw; |
| | 94 | | } |
| 0 | 95 | | } |
| | 96 | |
|
| | 97 | | /// <summary> Update a DDoS custom policy tags. </summary> |
| | 98 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 99 | | /// <param name="ddosCustomPolicyName"> The name of the DDoS custom policy. </param> |
| | 100 | | /// <param name="parameters"> Parameters supplied to update DDoS custom policy resource tags. </param> |
| | 101 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 102 | | public virtual Response<DdosCustomPolicy> UpdateTags(string resourceGroupName, string ddosCustomPolicyName, Tags |
| | 103 | | { |
| 0 | 104 | | using var scope = _clientDiagnostics.CreateScope("DdosCustomPoliciesOperations.UpdateTags"); |
| 0 | 105 | | scope.Start(); |
| | 106 | | try |
| | 107 | | { |
| 0 | 108 | | return RestClient.UpdateTags(resourceGroupName, ddosCustomPolicyName, parameters, cancellationToken); |
| | 109 | | } |
| 0 | 110 | | catch (Exception e) |
| | 111 | | { |
| 0 | 112 | | scope.Failed(e); |
| 0 | 113 | | throw; |
| | 114 | | } |
| 0 | 115 | | } |
| | 116 | |
|
| | 117 | | /// <summary> Deletes the specified DDoS custom policy. </summary> |
| | 118 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 119 | | /// <param name="ddosCustomPolicyName"> The name of the DDoS custom policy. </param> |
| | 120 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 121 | | public virtual async Task<DdosCustomPoliciesDeleteOperation> StartDeleteAsync(string resourceGroupName, string d |
| | 122 | | { |
| 0 | 123 | | if (resourceGroupName == null) |
| | 124 | | { |
| 0 | 125 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 126 | | } |
| 0 | 127 | | if (ddosCustomPolicyName == null) |
| | 128 | | { |
| 0 | 129 | | throw new ArgumentNullException(nameof(ddosCustomPolicyName)); |
| | 130 | | } |
| | 131 | |
|
| 0 | 132 | | using var scope = _clientDiagnostics.CreateScope("DdosCustomPoliciesOperations.StartDelete"); |
| 0 | 133 | | scope.Start(); |
| | 134 | | try |
| | 135 | | { |
| 0 | 136 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, ddosCustomPolicyName, cancellatio |
| 0 | 137 | | return new DdosCustomPoliciesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReque |
| | 138 | | } |
| 0 | 139 | | catch (Exception e) |
| | 140 | | { |
| 0 | 141 | | scope.Failed(e); |
| 0 | 142 | | throw; |
| | 143 | | } |
| 0 | 144 | | } |
| | 145 | |
|
| | 146 | | /// <summary> Deletes the specified DDoS custom policy. </summary> |
| | 147 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 148 | | /// <param name="ddosCustomPolicyName"> The name of the DDoS custom policy. </param> |
| | 149 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 150 | | public virtual DdosCustomPoliciesDeleteOperation StartDelete(string resourceGroupName, string ddosCustomPolicyNa |
| | 151 | | { |
| 0 | 152 | | if (resourceGroupName == null) |
| | 153 | | { |
| 0 | 154 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 155 | | } |
| 0 | 156 | | if (ddosCustomPolicyName == null) |
| | 157 | | { |
| 0 | 158 | | throw new ArgumentNullException(nameof(ddosCustomPolicyName)); |
| | 159 | | } |
| | 160 | |
|
| 0 | 161 | | using var scope = _clientDiagnostics.CreateScope("DdosCustomPoliciesOperations.StartDelete"); |
| 0 | 162 | | scope.Start(); |
| | 163 | | try |
| | 164 | | { |
| 0 | 165 | | var originalResponse = RestClient.Delete(resourceGroupName, ddosCustomPolicyName, cancellationToken); |
| 0 | 166 | | return new DdosCustomPoliciesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReque |
| | 167 | | } |
| 0 | 168 | | catch (Exception e) |
| | 169 | | { |
| 0 | 170 | | scope.Failed(e); |
| 0 | 171 | | throw; |
| | 172 | | } |
| 0 | 173 | | } |
| | 174 | |
|
| | 175 | | /// <summary> Creates or updates a DDoS custom policy. </summary> |
| | 176 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 177 | | /// <param name="ddosCustomPolicyName"> The name of the DDoS custom policy. </param> |
| | 178 | | /// <param name="parameters"> Parameters supplied to the create or update operation. </param> |
| | 179 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 180 | | public virtual async Task<DdosCustomPoliciesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGro |
| | 181 | | { |
| 0 | 182 | | if (resourceGroupName == null) |
| | 183 | | { |
| 0 | 184 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 185 | | } |
| 0 | 186 | | if (ddosCustomPolicyName == null) |
| | 187 | | { |
| 0 | 188 | | throw new ArgumentNullException(nameof(ddosCustomPolicyName)); |
| | 189 | | } |
| 0 | 190 | | if (parameters == null) |
| | 191 | | { |
| 0 | 192 | | throw new ArgumentNullException(nameof(parameters)); |
| | 193 | | } |
| | 194 | |
|
| 0 | 195 | | using var scope = _clientDiagnostics.CreateScope("DdosCustomPoliciesOperations.StartCreateOrUpdate"); |
| 0 | 196 | | scope.Start(); |
| | 197 | | try |
| | 198 | | { |
| 0 | 199 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, ddosCustomPolicyName, par |
| 0 | 200 | | return new DdosCustomPoliciesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCre |
| | 201 | | } |
| 0 | 202 | | catch (Exception e) |
| | 203 | | { |
| 0 | 204 | | scope.Failed(e); |
| 0 | 205 | | throw; |
| | 206 | | } |
| 0 | 207 | | } |
| | 208 | |
|
| | 209 | | /// <summary> Creates or updates a DDoS custom policy. </summary> |
| | 210 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 211 | | /// <param name="ddosCustomPolicyName"> The name of the DDoS custom policy. </param> |
| | 212 | | /// <param name="parameters"> Parameters supplied to the create or update operation. </param> |
| | 213 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 214 | | public virtual DdosCustomPoliciesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string dd |
| | 215 | | { |
| 0 | 216 | | if (resourceGroupName == null) |
| | 217 | | { |
| 0 | 218 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 219 | | } |
| 0 | 220 | | if (ddosCustomPolicyName == null) |
| | 221 | | { |
| 0 | 222 | | throw new ArgumentNullException(nameof(ddosCustomPolicyName)); |
| | 223 | | } |
| 0 | 224 | | if (parameters == null) |
| | 225 | | { |
| 0 | 226 | | throw new ArgumentNullException(nameof(parameters)); |
| | 227 | | } |
| | 228 | |
|
| 0 | 229 | | using var scope = _clientDiagnostics.CreateScope("DdosCustomPoliciesOperations.StartCreateOrUpdate"); |
| 0 | 230 | | scope.Start(); |
| | 231 | | try |
| | 232 | | { |
| 0 | 233 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, ddosCustomPolicyName, parameters, ca |
| 0 | 234 | | return new DdosCustomPoliciesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCre |
| | 235 | | } |
| 0 | 236 | | catch (Exception e) |
| | 237 | | { |
| 0 | 238 | | scope.Failed(e); |
| 0 | 239 | | throw; |
| | 240 | | } |
| 0 | 241 | | } |
| | 242 | | } |
| | 243 | | } |