< Summary

Class:Microsoft.Azure.Search.DataSourcesOperationsExtensions
Assembly:Microsoft.Azure.Search.Service
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\DataSources\DataSourcesOperationsExtensions.Customization.cs
C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\DataSourcesOperationsExtensions.cs
Covered lines:24
Uncovered lines:4
Coverable lines:28
Total lines:369
Line coverage:85.7% (24 of 28)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
CreateOrUpdate(...)-100%100%
CreateOrUpdateAsync()-100%100%
Exists(...)-100%100%
ExistsAsync()-100%100%
CreateOrUpdate(...)-0%100%
CreateOrUpdateAsync()-0%100%
Delete(...)-100%100%
DeleteAsync()-100%100%
Get(...)-100%100%
GetAsync()-100%100%
List(...)-100%100%
ListAsync()-100%100%
Create(...)-100%100%
CreateAsync()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\DataSources\DataSourcesOperationsExtensions.Customization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5namespace Microsoft.Azure.Search
 6{
 7    using System.Threading;
 8    using System.Threading.Tasks;
 9    using Microsoft.Azure.Search.Models;
 10    using Microsoft.Rest.Azure;
 11
 12    /// <summary>
 13    /// Operations for managing datasources.
 14    /// <see href="https://docs.microsoft.com/rest/api/searchservice/Indexer-operations" />
 15    /// </summary>
 16    public static partial class DataSourcesOperationsExtensions
 17    {
 18        /// <summary>
 19        /// Creates a new datasource or updates a datasource if it already
 20        /// exists.
 21        /// <see href="https://docs.microsoft.com/rest/api/searchservice/Update-Data-Source" />
 22        /// </summary>
 23        /// <param name='operations'>
 24        /// The operations group for this extension method.
 25        /// </param>
 26        /// <param name='dataSource'>
 27        /// The definition of the datasource to create or update.
 28        /// </param>
 29        /// <param name='searchRequestOptions'>
 30        /// Additional parameters for the operation.
 31        /// </param>
 32        /// <param name='accessCondition'>
 33        /// Additional parameters for the operation.
 34        /// </param>
 35        /// <returns>
 36        /// The datasource that was created or updated.
 37        /// </returns>
 38        public static DataSource CreateOrUpdate(this IDataSourcesOperations operations, DataSource dataSource, SearchReq
 39        {
 3040            return operations.CreateOrUpdateAsync(dataSource, searchRequestOptions, accessCondition).GetAwaiter().GetRes
 41        }
 42
 43        /// <summary>
 44        /// Creates a new datasource or updates a datasource if it already
 45        /// exists.
 46        /// <see href="https://docs.microsoft.com/rest/api/searchservice/Update-Data-Source" />
 47        /// </summary>
 48        /// <param name='operations'>
 49        /// The operations group for this extension method.
 50        /// </param>
 51        /// <param name='dataSource'>
 52        /// The definition of the datasource to create or update.
 53        /// </param>
 54        /// <param name='searchRequestOptions'>
 55        /// Additional parameters for the operation
 56        /// </param>
 57        /// <param name='accessCondition'>
 58        /// Additional parameters for the operation
 59        /// </param>
 60        /// <param name='cancellationToken'>
 61        /// The cancellation token.
 62        /// </param>
 63        /// <returns>
 64        /// The datasource that was created or updated.
 65        /// </returns>
 66        public static async Task<DataSource> CreateOrUpdateAsync(this IDataSourcesOperations operations, DataSource data
 67        {
 3068            using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(dataSource, searchRequestOptions, 
 69            {
 2470                return _result.Body;
 71            }
 2472        }
 73
 74        /// <summary>
 75        /// Determines whether or not the given data source exists in the search service.
 76        /// </summary>
 77        /// <param name='operations'>
 78        /// The operations group for this extension method.
 79        /// </param>
 80        /// <param name="dataSourceName">
 81        /// The name of the data source.
 82        /// </param>
 83        /// <param name='searchRequestOptions'>
 84        /// Additional parameters for the operation.
 85        /// </param>
 86        /// <returns>
 87        /// <c>true</c> if the data source exists; <c>false</c> otherwise.
 88        /// </returns>
 89        public static bool Exists(
 90            this IDataSourcesOperations operations,
 91            string dataSourceName,
 92            SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
 93        {
 494            return operations.ExistsAsync(dataSourceName, searchRequestOptions).GetAwaiter().GetResult();
 95        }
 96
 97        /// <summary>
 98        /// Determines whether or not the given data source exists in the search service.
 99        /// </summary>
 100        /// <param name='operations'>
 101        /// The operations group for this extension method.
 102        /// </param>
 103        /// <param name="dataSourceName">
 104        /// The name of the data source.
 105        /// </param>
 106        /// <param name='searchRequestOptions'>
 107        /// Additional parameters for the operation.
 108        /// </param>
 109        /// <param name='cancellationToken'>
 110        /// The cancellation token.
 111        /// </param>
 112        /// <returns>
 113        /// <c>true</c> if the data source exists; <c>false</c> otherwise.
 114        /// </returns>
 115        public static async Task<bool> ExistsAsync(
 116            this IDataSourcesOperations operations,
 117            string dataSourceName,
 118            SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
 119            CancellationToken cancellationToken = default(CancellationToken))
 120        {
 4121            AzureOperationResponse<bool> result = await operations.ExistsWithHttpMessagesAsync(dataSourceName, searchReq
 4122            return result.Body;
 4123        }
 124    }
 125}

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\DataSourcesOperationsExtensions.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.Search
 12{
 13    using Microsoft.Rest;
 14    using Microsoft.Rest.Azure;
 15    using Models;
 16    using System.Threading;
 17    using System.Threading.Tasks;
 18
 19    /// <summary>
 20    /// Extension methods for DataSourcesOperations.
 21    /// </summary>
 22    public static partial class DataSourcesOperationsExtensions
 23    {
 24            /// <summary>
 25            /// Creates a new datasource or updates a datasource if it already exists.
 26            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Update-Data-Source" />
 27            /// </summary>
 28            /// <param name='operations'>
 29            /// The operations group for this extension method.
 30            /// </param>
 31            /// <param name='dataSourceName'>
 32            /// The name of the datasource to create or update.
 33            /// </param>
 34            /// <param name='dataSource'>
 35            /// The definition of the datasource to create or update.
 36            /// </param>
 37            /// <param name='searchRequestOptions'>
 38            /// Additional parameters for the operation
 39            /// </param>
 40            /// <param name='accessCondition'>
 41            /// Additional parameters for the operation
 42            /// </param>
 43            public static DataSource CreateOrUpdate(this IDataSourcesOperations operations, string dataSourceName, DataS
 44            {
 045                return operations.CreateOrUpdateAsync(dataSourceName, dataSource, searchRequestOptions, accessCondition)
 46            }
 47
 48            /// <summary>
 49            /// Creates a new datasource or updates a datasource if it already exists.
 50            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Update-Data-Source" />
 51            /// </summary>
 52            /// <param name='operations'>
 53            /// The operations group for this extension method.
 54            /// </param>
 55            /// <param name='dataSourceName'>
 56            /// The name of the datasource to create or update.
 57            /// </param>
 58            /// <param name='dataSource'>
 59            /// The definition of the datasource to create or update.
 60            /// </param>
 61            /// <param name='searchRequestOptions'>
 62            /// Additional parameters for the operation
 63            /// </param>
 64            /// <param name='accessCondition'>
 65            /// Additional parameters for the operation
 66            /// </param>
 67            /// <param name='cancellationToken'>
 68            /// The cancellation token.
 69            /// </param>
 70            public static async Task<DataSource> CreateOrUpdateAsync(this IDataSourcesOperations operations, string data
 71            {
 072                using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(dataSourceName, dataSource, se
 73                {
 074                    return _result.Body;
 75                }
 076            }
 77
 78            /// <summary>
 79            /// Deletes a datasource.
 80            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Delete-Data-Source" />
 81            /// </summary>
 82            /// <param name='operations'>
 83            /// The operations group for this extension method.
 84            /// </param>
 85            /// <param name='dataSourceName'>
 86            /// The name of the datasource to delete.
 87            /// </param>
 88            /// <param name='searchRequestOptions'>
 89            /// Additional parameters for the operation
 90            /// </param>
 91            /// <param name='accessCondition'>
 92            /// Additional parameters for the operation
 93            /// </param>
 94            public static void Delete(this IDataSourcesOperations operations, string dataSourceName, SearchRequestOption
 95            {
 7296                operations.DeleteAsync(dataSourceName, searchRequestOptions, accessCondition).GetAwaiter().GetResult();
 6897            }
 98
 99            /// <summary>
 100            /// Deletes a datasource.
 101            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Delete-Data-Source" />
 102            /// </summary>
 103            /// <param name='operations'>
 104            /// The operations group for this extension method.
 105            /// </param>
 106            /// <param name='dataSourceName'>
 107            /// The name of the datasource to delete.
 108            /// </param>
 109            /// <param name='searchRequestOptions'>
 110            /// Additional parameters for the operation
 111            /// </param>
 112            /// <param name='accessCondition'>
 113            /// Additional parameters for the operation
 114            /// </param>
 115            /// <param name='cancellationToken'>
 116            /// The cancellation token.
 117            /// </param>
 118            public static async Task DeleteAsync(this IDataSourcesOperations operations, string dataSourceName, SearchRe
 119            {
 72120                (await operations.DeleteWithHttpMessagesAsync(dataSourceName, searchRequestOptions, accessCondition, nul
 68121            }
 122
 123            /// <summary>
 124            /// Retrieves a datasource definition.
 125            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Get-Data-Source" />
 126            /// </summary>
 127            /// <param name='operations'>
 128            /// The operations group for this extension method.
 129            /// </param>
 130            /// <param name='dataSourceName'>
 131            /// The name of the datasource to retrieve.
 132            /// </param>
 133            /// <param name='searchRequestOptions'>
 134            /// Additional parameters for the operation
 135            /// </param>
 136            public static DataSource Get(this IDataSourcesOperations operations, string dataSourceName, SearchRequestOpt
 137            {
 34138                return operations.GetAsync(dataSourceName, searchRequestOptions).GetAwaiter().GetResult();
 139            }
 140
 141            /// <summary>
 142            /// Retrieves a datasource definition.
 143            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Get-Data-Source" />
 144            /// </summary>
 145            /// <param name='operations'>
 146            /// The operations group for this extension method.
 147            /// </param>
 148            /// <param name='dataSourceName'>
 149            /// The name of the datasource to retrieve.
 150            /// </param>
 151            /// <param name='searchRequestOptions'>
 152            /// Additional parameters for the operation
 153            /// </param>
 154            /// <param name='cancellationToken'>
 155            /// The cancellation token.
 156            /// </param>
 157            public static async Task<DataSource> GetAsync(this IDataSourcesOperations operations, string dataSourceName,
 158            {
 34159                using (var _result = await operations.GetWithHttpMessagesAsync(dataSourceName, searchRequestOptions, nul
 160                {
 32161                    return _result.Body;
 162                }
 32163            }
 164
 165            /// <summary>
 166            /// Lists all datasources available for a search service.
 167            /// <see href="https://docs.microsoft.com/rest/api/searchservice/List-Data-Sources" />
 168            /// </summary>
 169            /// <param name='operations'>
 170            /// The operations group for this extension method.
 171            /// </param>
 172            /// <param name='searchRequestOptions'>
 173            /// Additional parameters for the operation
 174            /// </param>
 175            public static DataSourceListResult List(this IDataSourcesOperations operations, SearchRequestOptions searchR
 176            {
 2177                return operations.ListAsync(searchRequestOptions).GetAwaiter().GetResult();
 178            }
 179
 180            /// <summary>
 181            /// Lists all datasources available for a search service.
 182            /// <see href="https://docs.microsoft.com/rest/api/searchservice/List-Data-Sources" />
 183            /// </summary>
 184            /// <param name='operations'>
 185            /// The operations group for this extension method.
 186            /// </param>
 187            /// <param name='searchRequestOptions'>
 188            /// Additional parameters for the operation
 189            /// </param>
 190            /// <param name='cancellationToken'>
 191            /// The cancellation token.
 192            /// </param>
 193            public static async Task<DataSourceListResult> ListAsync(this IDataSourcesOperations operations, SearchReque
 194            {
 2195                using (var _result = await operations.ListWithHttpMessagesAsync(searchRequestOptions, null, cancellation
 196                {
 2197                    return _result.Body;
 198                }
 2199            }
 200
 201            /// <summary>
 202            /// Creates a new datasource.
 203            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Create-Data-Source" />
 204            /// </summary>
 205            /// <param name='operations'>
 206            /// The operations group for this extension method.
 207            /// </param>
 208            /// <param name='dataSource'>
 209            /// The definition of the datasource to create.
 210            /// </param>
 211            /// <param name='searchRequestOptions'>
 212            /// Additional parameters for the operation
 213            /// </param>
 214            public static DataSource Create(this IDataSourcesOperations operations, DataSource dataSource, SearchRequest
 215            {
 120216                return operations.CreateAsync(dataSource, searchRequestOptions).GetAwaiter().GetResult();
 217            }
 218
 219            /// <summary>
 220            /// Creates a new datasource.
 221            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Create-Data-Source" />
 222            /// </summary>
 223            /// <param name='operations'>
 224            /// The operations group for this extension method.
 225            /// </param>
 226            /// <param name='dataSource'>
 227            /// The definition of the datasource to create.
 228            /// </param>
 229            /// <param name='searchRequestOptions'>
 230            /// Additional parameters for the operation
 231            /// </param>
 232            /// <param name='cancellationToken'>
 233            /// The cancellation token.
 234            /// </param>
 235            public static async Task<DataSource> CreateAsync(this IDataSourcesOperations operations, DataSource dataSour
 236            {
 120237                using (var _result = await operations.CreateWithHttpMessagesAsync(dataSource, searchRequestOptions, null
 238                {
 118239                    return _result.Body;
 240                }
 118241            }
 242
 243    }
 244}