| | 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; |
| | 13 | | using Azure.Core.Pipeline; |
| | 14 | | using Azure.ResourceManager.AppConfiguration.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.AppConfiguration |
| | 17 | | { |
| | 18 | | /// <summary> The PrivateLinkResources service client. </summary> |
| | 19 | | public partial class PrivateLinkResourcesOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 20 | 23 | | internal PrivateLinkResourcesRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of PrivateLinkResourcesOperations for mocking. </summary> |
| 8 | 25 | | protected PrivateLinkResourcesOperations() |
| | 26 | | { |
| 8 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of PrivateLinkResourcesOperations. </summary> |
| | 29 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 30 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 31 | | /// <param name="subscriptionId"> The Microsoft Azure subscription ID. </param> |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| | 33 | | /// <param name="apiVersion"> Api Version. </param> |
| 8 | 34 | | internal PrivateLinkResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subsc |
| | 35 | | { |
| 8 | 36 | | RestClient = new PrivateLinkResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, a |
| 8 | 37 | | _clientDiagnostics = clientDiagnostics; |
| 8 | 38 | | _pipeline = pipeline; |
| 8 | 39 | | } |
| | 40 | |
|
| | 41 | | /// <summary> Gets a private link resource that need to be created for a configuration store. </summary> |
| | 42 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 43 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 44 | | /// <param name="groupName"> The name of the private link resource group. </param> |
| | 45 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 46 | | public virtual async Task<Response<PrivateLinkResource>> GetAsync(string resourceGroupName, string configStoreNa |
| | 47 | | { |
| 4 | 48 | | using var scope = _clientDiagnostics.CreateScope("PrivateLinkResourcesOperations.Get"); |
| 4 | 49 | | scope.Start(); |
| | 50 | | try |
| | 51 | | { |
| 4 | 52 | | return await RestClient.GetAsync(resourceGroupName, configStoreName, groupName, cancellationToken).Confi |
| | 53 | | } |
| 0 | 54 | | catch (Exception e) |
| | 55 | | { |
| 0 | 56 | | scope.Failed(e); |
| 0 | 57 | | throw; |
| | 58 | | } |
| 4 | 59 | | } |
| | 60 | |
|
| | 61 | | /// <summary> Gets a private link resource that need to be created for a configuration store. </summary> |
| | 62 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 63 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 64 | | /// <param name="groupName"> The name of the private link resource group. </param> |
| | 65 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 66 | | public virtual Response<PrivateLinkResource> Get(string resourceGroupName, string configStoreName, string groupN |
| | 67 | | { |
| 4 | 68 | | using var scope = _clientDiagnostics.CreateScope("PrivateLinkResourcesOperations.Get"); |
| 4 | 69 | | scope.Start(); |
| | 70 | | try |
| | 71 | | { |
| 4 | 72 | | return RestClient.Get(resourceGroupName, configStoreName, groupName, cancellationToken); |
| | 73 | | } |
| 0 | 74 | | catch (Exception e) |
| | 75 | | { |
| 0 | 76 | | scope.Failed(e); |
| 0 | 77 | | throw; |
| | 78 | | } |
| 4 | 79 | | } |
| | 80 | |
|
| | 81 | | /// <summary> Gets the private link resources that need to be created for a configuration store. </summary> |
| | 82 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 83 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 84 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 85 | | public virtual AsyncPageable<PrivateLinkResource> ListByConfigurationStoreAsync(string resourceGroupName, string |
| | 86 | | { |
| 6 | 87 | | if (resourceGroupName == null) |
| | 88 | | { |
| 0 | 89 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 90 | | } |
| 6 | 91 | | if (configStoreName == null) |
| | 92 | | { |
| 0 | 93 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 94 | | } |
| | 95 | |
|
| | 96 | | async Task<Page<PrivateLinkResource>> FirstPageFunc(int? pageSizeHint) |
| | 97 | | { |
| 6 | 98 | | using var scope = _clientDiagnostics.CreateScope("PrivateLinkResourcesOperations.ListByConfigurationStor |
| 6 | 99 | | scope.Start(); |
| | 100 | | try |
| | 101 | | { |
| 6 | 102 | | var response = await RestClient.ListByConfigurationStoreAsync(resourceGroupName, configStoreName, ca |
| 6 | 103 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 104 | | } |
| 0 | 105 | | catch (Exception e) |
| | 106 | | { |
| 0 | 107 | | scope.Failed(e); |
| 0 | 108 | | throw; |
| | 109 | | } |
| 6 | 110 | | } |
| | 111 | | async Task<Page<PrivateLinkResource>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 112 | | { |
| 0 | 113 | | using var scope = _clientDiagnostics.CreateScope("PrivateLinkResourcesOperations.ListByConfigurationStor |
| 0 | 114 | | scope.Start(); |
| | 115 | | try |
| | 116 | | { |
| 0 | 117 | | var response = await RestClient.ListByConfigurationStoreNextPageAsync(nextLink, resourceGroupName, c |
| 0 | 118 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 119 | | } |
| 0 | 120 | | catch (Exception e) |
| | 121 | | { |
| 0 | 122 | | scope.Failed(e); |
| 0 | 123 | | throw; |
| | 124 | | } |
| 0 | 125 | | } |
| 6 | 126 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 127 | | } |
| | 128 | |
|
| | 129 | | /// <summary> Gets the private link resources that need to be created for a configuration store. </summary> |
| | 130 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 131 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 132 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 133 | | public virtual Pageable<PrivateLinkResource> ListByConfigurationStore(string resourceGroupName, string configSto |
| | 134 | | { |
| 6 | 135 | | if (resourceGroupName == null) |
| | 136 | | { |
| 0 | 137 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 138 | | } |
| 6 | 139 | | if (configStoreName == null) |
| | 140 | | { |
| 0 | 141 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 142 | | } |
| | 143 | |
|
| | 144 | | Page<PrivateLinkResource> FirstPageFunc(int? pageSizeHint) |
| | 145 | | { |
| 6 | 146 | | using var scope = _clientDiagnostics.CreateScope("PrivateLinkResourcesOperations.ListByConfigurationStor |
| 6 | 147 | | scope.Start(); |
| | 148 | | try |
| | 149 | | { |
| 6 | 150 | | var response = RestClient.ListByConfigurationStore(resourceGroupName, configStoreName, cancellationT |
| 6 | 151 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 152 | | } |
| 0 | 153 | | catch (Exception e) |
| | 154 | | { |
| 0 | 155 | | scope.Failed(e); |
| 0 | 156 | | throw; |
| | 157 | | } |
| 6 | 158 | | } |
| | 159 | | Page<PrivateLinkResource> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 160 | | { |
| 0 | 161 | | using var scope = _clientDiagnostics.CreateScope("PrivateLinkResourcesOperations.ListByConfigurationStor |
| 0 | 162 | | scope.Start(); |
| | 163 | | try |
| | 164 | | { |
| 0 | 165 | | var response = RestClient.ListByConfigurationStoreNextPage(nextLink, resourceGroupName, configStoreN |
| 0 | 166 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 167 | | } |
| 0 | 168 | | catch (Exception e) |
| | 169 | | { |
| 0 | 170 | | scope.Failed(e); |
| 0 | 171 | | throw; |
| | 172 | | } |
| 0 | 173 | | } |
| 6 | 174 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 175 | | } |
| | 176 | | } |
| | 177 | | } |