| | 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.Text.Json; |
| | 10 | | using System.Threading; |
| | 11 | | using System.Threading.Tasks; |
| | 12 | | using Azure; |
| | 13 | | using Azure.Core; |
| | 14 | | using Azure.Core.Pipeline; |
| | 15 | | using Azure.ResourceManager.AppConfiguration.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.AppConfiguration |
| | 18 | | { |
| | 19 | | internal partial class PrivateLinkResourcesRestOperations |
| | 20 | | { |
| | 21 | | private string subscriptionId; |
| | 22 | | private Uri endpoint; |
| | 23 | | private string apiVersion; |
| | 24 | | private ClientDiagnostics _clientDiagnostics; |
| | 25 | | private HttpPipeline _pipeline; |
| | 26 | |
|
| | 27 | | /// <summary> Initializes a new instance of PrivateLinkResourcesRestOperations. </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 Microsoft Azure subscription ID. </param> |
| | 31 | | /// <param name="endpoint"> server parameter. </param> |
| | 32 | | /// <param name="apiVersion"> Api Version. </param> |
| | 33 | | /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception |
| 8 | 34 | | public PrivateLinkResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string sub |
| | 35 | | { |
| 8 | 36 | | if (subscriptionId == null) |
| | 37 | | { |
| 0 | 38 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 39 | | } |
| 8 | 40 | | endpoint ??= new Uri("https://management.azure.com"); |
| 8 | 41 | | if (apiVersion == null) |
| | 42 | | { |
| 0 | 43 | | throw new ArgumentNullException(nameof(apiVersion)); |
| | 44 | | } |
| | 45 | |
|
| 8 | 46 | | this.subscriptionId = subscriptionId; |
| 8 | 47 | | this.endpoint = endpoint; |
| 8 | 48 | | this.apiVersion = apiVersion; |
| 8 | 49 | | _clientDiagnostics = clientDiagnostics; |
| 8 | 50 | | _pipeline = pipeline; |
| 8 | 51 | | } |
| | 52 | |
|
| | 53 | | internal HttpMessage CreateListByConfigurationStoreRequest(string resourceGroupName, string configStoreName) |
| | 54 | | { |
| 12 | 55 | | var message = _pipeline.CreateMessage(); |
| 12 | 56 | | var request = message.Request; |
| 12 | 57 | | request.Method = RequestMethod.Get; |
| 12 | 58 | | var uri = new RawRequestUriBuilder(); |
| 12 | 59 | | uri.Reset(endpoint); |
| 12 | 60 | | uri.AppendPath("/subscriptions/", false); |
| 12 | 61 | | uri.AppendPath(subscriptionId, true); |
| 12 | 62 | | uri.AppendPath("/resourceGroups/", false); |
| 12 | 63 | | uri.AppendPath(resourceGroupName, true); |
| 12 | 64 | | uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores/", false); |
| 12 | 65 | | uri.AppendPath(configStoreName, true); |
| 12 | 66 | | uri.AppendPath("/privateLinkResources", false); |
| 12 | 67 | | uri.AppendQuery("api-version", apiVersion, true); |
| 12 | 68 | | request.Uri = uri; |
| 12 | 69 | | return message; |
| | 70 | | } |
| | 71 | |
|
| | 72 | | /// <summary> Gets the private link resources that need to be created for a configuration store. </summary> |
| | 73 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 74 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 75 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 76 | | public async Task<Response<PrivateLinkResourceListResult>> ListByConfigurationStoreAsync(string resourceGroupNam |
| | 77 | | { |
| 6 | 78 | | if (resourceGroupName == null) |
| | 79 | | { |
| 0 | 80 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 81 | | } |
| 6 | 82 | | if (configStoreName == null) |
| | 83 | | { |
| 0 | 84 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 85 | | } |
| | 86 | |
|
| 6 | 87 | | using var message = CreateListByConfigurationStoreRequest(resourceGroupName, configStoreName); |
| 6 | 88 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 6 | 89 | | switch (message.Response.Status) |
| | 90 | | { |
| | 91 | | case 200: |
| | 92 | | { |
| 6 | 93 | | PrivateLinkResourceListResult value = default; |
| 6 | 94 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 6 | 95 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 96 | | { |
| 0 | 97 | | value = null; |
| | 98 | | } |
| | 99 | | else |
| | 100 | | { |
| 6 | 101 | | value = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(document.Root |
| | 102 | | } |
| 6 | 103 | | return Response.FromValue(value, message.Response); |
| | 104 | | } |
| | 105 | | default: |
| 0 | 106 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 107 | | } |
| 6 | 108 | | } |
| | 109 | |
|
| | 110 | | /// <summary> Gets the private link resources that need to be created for a configuration store. </summary> |
| | 111 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 112 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 113 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 114 | | public Response<PrivateLinkResourceListResult> ListByConfigurationStore(string resourceGroupName, string configS |
| | 115 | | { |
| 6 | 116 | | if (resourceGroupName == null) |
| | 117 | | { |
| 0 | 118 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 119 | | } |
| 6 | 120 | | if (configStoreName == null) |
| | 121 | | { |
| 0 | 122 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 123 | | } |
| | 124 | |
|
| 6 | 125 | | using var message = CreateListByConfigurationStoreRequest(resourceGroupName, configStoreName); |
| 6 | 126 | | _pipeline.Send(message, cancellationToken); |
| 6 | 127 | | switch (message.Response.Status) |
| | 128 | | { |
| | 129 | | case 200: |
| | 130 | | { |
| 6 | 131 | | PrivateLinkResourceListResult value = default; |
| 6 | 132 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 6 | 133 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 134 | | { |
| 0 | 135 | | value = null; |
| | 136 | | } |
| | 137 | | else |
| | 138 | | { |
| 6 | 139 | | value = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(document.Root |
| | 140 | | } |
| 6 | 141 | | return Response.FromValue(value, message.Response); |
| | 142 | | } |
| | 143 | | default: |
| 0 | 144 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 145 | | } |
| 6 | 146 | | } |
| | 147 | |
|
| | 148 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string configStoreName, string groupName) |
| | 149 | | { |
| 8 | 150 | | var message = _pipeline.CreateMessage(); |
| 8 | 151 | | var request = message.Request; |
| 8 | 152 | | request.Method = RequestMethod.Get; |
| 8 | 153 | | var uri = new RawRequestUriBuilder(); |
| 8 | 154 | | uri.Reset(endpoint); |
| 8 | 155 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 156 | | uri.AppendPath(subscriptionId, true); |
| 8 | 157 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 158 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 159 | | uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores/", false); |
| 8 | 160 | | uri.AppendPath(configStoreName, true); |
| 8 | 161 | | uri.AppendPath("/privateLinkResources/", false); |
| 8 | 162 | | uri.AppendPath(groupName, true); |
| 8 | 163 | | uri.AppendQuery("api-version", apiVersion, true); |
| 8 | 164 | | request.Uri = uri; |
| 8 | 165 | | return message; |
| | 166 | | } |
| | 167 | |
|
| | 168 | | /// <summary> Gets a private link resource that need to be created for a configuration store. </summary> |
| | 169 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 170 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 171 | | /// <param name="groupName"> The name of the private link resource group. </param> |
| | 172 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 173 | | public async Task<Response<PrivateLinkResource>> GetAsync(string resourceGroupName, string configStoreName, stri |
| | 174 | | { |
| 4 | 175 | | if (resourceGroupName == null) |
| | 176 | | { |
| 0 | 177 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 178 | | } |
| 4 | 179 | | if (configStoreName == null) |
| | 180 | | { |
| 0 | 181 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 182 | | } |
| 4 | 183 | | if (groupName == null) |
| | 184 | | { |
| 0 | 185 | | throw new ArgumentNullException(nameof(groupName)); |
| | 186 | | } |
| | 187 | |
|
| 4 | 188 | | using var message = CreateGetRequest(resourceGroupName, configStoreName, groupName); |
| 4 | 189 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 190 | | switch (message.Response.Status) |
| | 191 | | { |
| | 192 | | case 200: |
| | 193 | | { |
| 4 | 194 | | PrivateLinkResource value = default; |
| 4 | 195 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 4 | 196 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 197 | | { |
| 0 | 198 | | value = null; |
| | 199 | | } |
| | 200 | | else |
| | 201 | | { |
| 4 | 202 | | value = PrivateLinkResource.DeserializePrivateLinkResource(document.RootElement); |
| | 203 | | } |
| 4 | 204 | | return Response.FromValue(value, message.Response); |
| | 205 | | } |
| | 206 | | default: |
| 0 | 207 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 208 | | } |
| 4 | 209 | | } |
| | 210 | |
|
| | 211 | | /// <summary> Gets a private link resource that need to be created for a configuration store. </summary> |
| | 212 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 213 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 214 | | /// <param name="groupName"> The name of the private link resource group. </param> |
| | 215 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 216 | | public Response<PrivateLinkResource> Get(string resourceGroupName, string configStoreName, string groupName, Can |
| | 217 | | { |
| 4 | 218 | | if (resourceGroupName == null) |
| | 219 | | { |
| 0 | 220 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 221 | | } |
| 4 | 222 | | if (configStoreName == null) |
| | 223 | | { |
| 0 | 224 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 225 | | } |
| 4 | 226 | | if (groupName == null) |
| | 227 | | { |
| 0 | 228 | | throw new ArgumentNullException(nameof(groupName)); |
| | 229 | | } |
| | 230 | |
|
| 4 | 231 | | using var message = CreateGetRequest(resourceGroupName, configStoreName, groupName); |
| 4 | 232 | | _pipeline.Send(message, cancellationToken); |
| 4 | 233 | | switch (message.Response.Status) |
| | 234 | | { |
| | 235 | | case 200: |
| | 236 | | { |
| 4 | 237 | | PrivateLinkResource value = default; |
| 4 | 238 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 4 | 239 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 240 | | { |
| 0 | 241 | | value = null; |
| | 242 | | } |
| | 243 | | else |
| | 244 | | { |
| 4 | 245 | | value = PrivateLinkResource.DeserializePrivateLinkResource(document.RootElement); |
| | 246 | | } |
| 4 | 247 | | return Response.FromValue(value, message.Response); |
| | 248 | | } |
| | 249 | | default: |
| 0 | 250 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 251 | | } |
| 4 | 252 | | } |
| | 253 | |
|
| | 254 | | internal HttpMessage CreateListByConfigurationStoreNextPageRequest(string nextLink, string resourceGroupName, st |
| | 255 | | { |
| 0 | 256 | | var message = _pipeline.CreateMessage(); |
| 0 | 257 | | var request = message.Request; |
| 0 | 258 | | request.Method = RequestMethod.Get; |
| 0 | 259 | | var uri = new RawRequestUriBuilder(); |
| 0 | 260 | | uri.Reset(endpoint); |
| 0 | 261 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 262 | | request.Uri = uri; |
| 0 | 263 | | return message; |
| | 264 | | } |
| | 265 | |
|
| | 266 | | /// <summary> Gets the private link resources that need to be created for a configuration store. </summary> |
| | 267 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 268 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 269 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 270 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 271 | | public async Task<Response<PrivateLinkResourceListResult>> ListByConfigurationStoreNextPageAsync(string nextLink |
| | 272 | | { |
| 0 | 273 | | if (nextLink == null) |
| | 274 | | { |
| 0 | 275 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 276 | | } |
| 0 | 277 | | if (resourceGroupName == null) |
| | 278 | | { |
| 0 | 279 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 280 | | } |
| 0 | 281 | | if (configStoreName == null) |
| | 282 | | { |
| 0 | 283 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 284 | | } |
| | 285 | |
|
| 0 | 286 | | using var message = CreateListByConfigurationStoreNextPageRequest(nextLink, resourceGroupName, configStoreNa |
| 0 | 287 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 288 | | switch (message.Response.Status) |
| | 289 | | { |
| | 290 | | case 200: |
| | 291 | | { |
| 0 | 292 | | PrivateLinkResourceListResult value = default; |
| 0 | 293 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 294 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 295 | | { |
| 0 | 296 | | value = null; |
| | 297 | | } |
| | 298 | | else |
| | 299 | | { |
| 0 | 300 | | value = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(document.Root |
| | 301 | | } |
| 0 | 302 | | return Response.FromValue(value, message.Response); |
| | 303 | | } |
| | 304 | | default: |
| 0 | 305 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 306 | | } |
| 0 | 307 | | } |
| | 308 | |
|
| | 309 | | /// <summary> Gets the private link resources that need to be created for a configuration store. </summary> |
| | 310 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 311 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 312 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 313 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 314 | | public Response<PrivateLinkResourceListResult> ListByConfigurationStoreNextPage(string nextLink, string resource |
| | 315 | | { |
| 0 | 316 | | if (nextLink == null) |
| | 317 | | { |
| 0 | 318 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 319 | | } |
| 0 | 320 | | if (resourceGroupName == null) |
| | 321 | | { |
| 0 | 322 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 323 | | } |
| 0 | 324 | | if (configStoreName == null) |
| | 325 | | { |
| 0 | 326 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 327 | | } |
| | 328 | |
|
| 0 | 329 | | using var message = CreateListByConfigurationStoreNextPageRequest(nextLink, resourceGroupName, configStoreNa |
| 0 | 330 | | _pipeline.Send(message, cancellationToken); |
| 0 | 331 | | switch (message.Response.Status) |
| | 332 | | { |
| | 333 | | case 200: |
| | 334 | | { |
| 0 | 335 | | PrivateLinkResourceListResult value = default; |
| 0 | 336 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 337 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 338 | | { |
| 0 | 339 | | value = null; |
| | 340 | | } |
| | 341 | | else |
| | 342 | | { |
| 0 | 343 | | value = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(document.Root |
| | 344 | | } |
| 0 | 345 | | return Response.FromValue(value, message.Response); |
| | 346 | | } |
| | 347 | | default: |
| 0 | 348 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 349 | | } |
| 0 | 350 | | } |
| | 351 | | } |
| | 352 | | } |