// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.analytics.purview.scanning;

import com.azure.analytics.purview.scanning.implementation.DataSourcesImpl;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.exception.ClientAuthenticationException;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.exception.ResourceModifiedException;
import com.azure.core.exception.ResourceNotFoundException;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.http.rest.Response;
import com.azure.core.util.BinaryData;

/** Initializes a new instance of the synchronous PurviewScanningClient type. */
@ServiceClient(builder = PurviewScanningClientBuilder.class)
public final class DataSourcesClient {
    @Generated private final DataSourcesImpl serviceClient;

    /**
     * Initializes an instance of DataSourcesClient class.
     *
     * @param serviceClient the service client implementation.
     */
    @Generated
    DataSourcesClient(DataSourcesImpl serviceClient) {
        this.serviceClient = serviceClient;
    }

    /**
     * Creates or Updates a data source.
     *
     * <p><strong>Header Parameters</strong>
     *
     * <table border="1">
     *     <caption>Header Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>Content-Type</td><td>String</td><td>No</td><td>The content type. Allowed values: "application/json".</td></tr>
     * </table>
     *
     * You can add these to a request with {@link RequestOptions#addHeader}
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     id: String (Optional)
     *     name: String (Optional)
     *     scans (Optional): [
     *          (Optional){
     *             id: String (Optional)
     *             name: String (Optional)
     *             scanResults (Optional): [
     *                  (Optional){
     *                     parentId: String (Optional)
     *                     id: String (Optional)
     *                     resourceId: String (Optional)
     *                     status: String (Optional)
     *                     assetsDiscovered: Long (Optional)
     *                     assetsClassified: Long (Optional)
     *                     diagnostics (Optional): {
     *                         notifications (Optional): [
     *                              (Optional){
     *                                 message: String (Optional)
     *                                 code: Integer (Optional)
     *                             }
     *                         ]
     *                         exceptionCountMap (Optional): {
     *                             String: int (Optional)
     *                         }
     *                     }
     *                     startTime: OffsetDateTime (Optional)
     *                     queuedTime: OffsetDateTime (Optional)
     *                     pipelineStartTime: OffsetDateTime (Optional)
     *                     endTime: OffsetDateTime (Optional)
     *                     scanRulesetVersion: Integer (Optional)
     *                     scanRulesetType: String(Custom/System) (Optional)
     *                     scanLevelType: String(Full/Incremental) (Optional)
     *                     errorMessage: String (Optional)
     *                     error (Optional): {
     *                         code: String (Optional)
     *                         message: String (Optional)
     *                         target: String (Optional)
     *                         details (Optional): [
     *                              (Optional){
     *                                 code: String (Optional)
     *                                 message: String (Optional)
     *                                 target: String (Optional)
     *                                 details (Optional): [
     *                                     (recursive schema, see above)
     *                                 ]
     *                             }
     *                         ]
     *                     }
     *                     runType: String (Optional)
     *                     dataSourceType: String(None/AzureSubscription/AzureResourceGroup/AzureSynapseWorkspace/AzureSynapse/AdlsGen1/AdlsGen2/AmazonAccount/AmazonS3/AmazonSql/AzureCosmosDb/AzureDataExplorer/AzureFileService/AzureSqlDatabase/AmazonPostgreSql/AzurePostgreSql/SqlServerDatabase/AzureSqlDatabaseManagedInstance/AzureSqlDataWarehouse/AzureMySql/AzureStorage/Teradata/Oracle/SapS4Hana/SapEcc/PowerBI) (Optional)
     *                 }
     *             ]
     *         }
     *     ]
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     id: String (Optional)
     *     name: String (Optional)
     *     scans (Optional): [
     *          (Optional){
     *             id: String (Optional)
     *             name: String (Optional)
     *             scanResults (Optional): [
     *                  (Optional){
     *                     parentId: String (Optional)
     *                     id: String (Optional)
     *                     resourceId: String (Optional)
     *                     status: String (Optional)
     *                     assetsDiscovered: Long (Optional)
     *                     assetsClassified: Long (Optional)
     *                     diagnostics (Optional): {
     *                         notifications (Optional): [
     *                              (Optional){
     *                                 message: String (Optional)
     *                                 code: Integer (Optional)
     *                             }
     *                         ]
     *                         exceptionCountMap (Optional): {
     *                             String: int (Optional)
     *                         }
     *                     }
     *                     startTime: OffsetDateTime (Optional)
     *                     queuedTime: OffsetDateTime (Optional)
     *                     pipelineStartTime: OffsetDateTime (Optional)
     *                     endTime: OffsetDateTime (Optional)
     *                     scanRulesetVersion: Integer (Optional)
     *                     scanRulesetType: String(Custom/System) (Optional)
     *                     scanLevelType: String(Full/Incremental) (Optional)
     *                     errorMessage: String (Optional)
     *                     error (Optional): {
     *                         code: String (Optional)
     *                         message: String (Optional)
     *                         target: String (Optional)
     *                         details (Optional): [
     *                              (Optional){
     *                                 code: String (Optional)
     *                                 message: String (Optional)
     *                                 target: String (Optional)
     *                                 details (Optional): [
     *                                     (recursive schema, see above)
     *                                 ]
     *                             }
     *                         ]
     *                     }
     *                     runType: String (Optional)
     *                     dataSourceType: String(None/AzureSubscription/AzureResourceGroup/AzureSynapseWorkspace/AzureSynapse/AdlsGen1/AdlsGen2/AmazonAccount/AmazonS3/AmazonSql/AzureCosmosDb/AzureDataExplorer/AzureFileService/AzureSqlDatabase/AmazonPostgreSql/AzurePostgreSql/SqlServerDatabase/AzureSqlDatabaseManagedInstance/AzureSqlDataWarehouse/AzureMySql/AzureStorage/Teradata/Oracle/SapS4Hana/SapEcc/PowerBI) (Optional)
     *                 }
     *             ]
     *         }
     *     ]
     * }
     * }</pre>
     *
     * @param dataSourceName The dataSourceName parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @return the response body along with {@link Response}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> createOrUpdateWithResponse(String dataSourceName, RequestOptions requestOptions) {
        return this.serviceClient.createOrUpdateWithResponse(dataSourceName, requestOptions);
    }

    /**
     * Get a data source.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     id: String (Optional)
     *     name: String (Optional)
     *     scans (Optional): [
     *          (Optional){
     *             id: String (Optional)
     *             name: String (Optional)
     *             scanResults (Optional): [
     *                  (Optional){
     *                     parentId: String (Optional)
     *                     id: String (Optional)
     *                     resourceId: String (Optional)
     *                     status: String (Optional)
     *                     assetsDiscovered: Long (Optional)
     *                     assetsClassified: Long (Optional)
     *                     diagnostics (Optional): {
     *                         notifications (Optional): [
     *                              (Optional){
     *                                 message: String (Optional)
     *                                 code: Integer (Optional)
     *                             }
     *                         ]
     *                         exceptionCountMap (Optional): {
     *                             String: int (Optional)
     *                         }
     *                     }
     *                     startTime: OffsetDateTime (Optional)
     *                     queuedTime: OffsetDateTime (Optional)
     *                     pipelineStartTime: OffsetDateTime (Optional)
     *                     endTime: OffsetDateTime (Optional)
     *                     scanRulesetVersion: Integer (Optional)
     *                     scanRulesetType: String(Custom/System) (Optional)
     *                     scanLevelType: String(Full/Incremental) (Optional)
     *                     errorMessage: String (Optional)
     *                     error (Optional): {
     *                         code: String (Optional)
     *                         message: String (Optional)
     *                         target: String (Optional)
     *                         details (Optional): [
     *                              (Optional){
     *                                 code: String (Optional)
     *                                 message: String (Optional)
     *                                 target: String (Optional)
     *                                 details (Optional): [
     *                                     (recursive schema, see above)
     *                                 ]
     *                             }
     *                         ]
     *                     }
     *                     runType: String (Optional)
     *                     dataSourceType: String(None/AzureSubscription/AzureResourceGroup/AzureSynapseWorkspace/AzureSynapse/AdlsGen1/AdlsGen2/AmazonAccount/AmazonS3/AmazonSql/AzureCosmosDb/AzureDataExplorer/AzureFileService/AzureSqlDatabase/AmazonPostgreSql/AzurePostgreSql/SqlServerDatabase/AzureSqlDatabaseManagedInstance/AzureSqlDataWarehouse/AzureMySql/AzureStorage/Teradata/Oracle/SapS4Hana/SapEcc/PowerBI) (Optional)
     *                 }
     *             ]
     *         }
     *     ]
     * }
     * }</pre>
     *
     * @param dataSourceName The dataSourceName parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @return a data source along with {@link Response}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getWithResponse(String dataSourceName, RequestOptions requestOptions) {
        return this.serviceClient.getWithResponse(dataSourceName, requestOptions);
    }

    /**
     * Deletes a data source.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     id: String (Optional)
     *     name: String (Optional)
     *     scans (Optional): [
     *          (Optional){
     *             id: String (Optional)
     *             name: String (Optional)
     *             scanResults (Optional): [
     *                  (Optional){
     *                     parentId: String (Optional)
     *                     id: String (Optional)
     *                     resourceId: String (Optional)
     *                     status: String (Optional)
     *                     assetsDiscovered: Long (Optional)
     *                     assetsClassified: Long (Optional)
     *                     diagnostics (Optional): {
     *                         notifications (Optional): [
     *                              (Optional){
     *                                 message: String (Optional)
     *                                 code: Integer (Optional)
     *                             }
     *                         ]
     *                         exceptionCountMap (Optional): {
     *                             String: int (Optional)
     *                         }
     *                     }
     *                     startTime: OffsetDateTime (Optional)
     *                     queuedTime: OffsetDateTime (Optional)
     *                     pipelineStartTime: OffsetDateTime (Optional)
     *                     endTime: OffsetDateTime (Optional)
     *                     scanRulesetVersion: Integer (Optional)
     *                     scanRulesetType: String(Custom/System) (Optional)
     *                     scanLevelType: String(Full/Incremental) (Optional)
     *                     errorMessage: String (Optional)
     *                     error (Optional): {
     *                         code: String (Optional)
     *                         message: String (Optional)
     *                         target: String (Optional)
     *                         details (Optional): [
     *                              (Optional){
     *                                 code: String (Optional)
     *                                 message: String (Optional)
     *                                 target: String (Optional)
     *                                 details (Optional): [
     *                                     (recursive schema, see above)
     *                                 ]
     *                             }
     *                         ]
     *                     }
     *                     runType: String (Optional)
     *                     dataSourceType: String(None/AzureSubscription/AzureResourceGroup/AzureSynapseWorkspace/AzureSynapse/AdlsGen1/AdlsGen2/AmazonAccount/AmazonS3/AmazonSql/AzureCosmosDb/AzureDataExplorer/AzureFileService/AzureSqlDatabase/AmazonPostgreSql/AzurePostgreSql/SqlServerDatabase/AzureSqlDatabaseManagedInstance/AzureSqlDataWarehouse/AzureMySql/AzureStorage/Teradata/Oracle/SapS4Hana/SapEcc/PowerBI) (Optional)
     *                 }
     *             ]
     *         }
     *     ]
     * }
     * }</pre>
     *
     * @param dataSourceName The dataSourceName parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @return the response body along with {@link Response}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> deleteWithResponse(String dataSourceName, RequestOptions requestOptions) {
        return this.serviceClient.deleteWithResponse(dataSourceName, requestOptions);
    }

    /**
     * List data sources in Data catalog.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     id: String (Optional)
     *     name: String (Optional)
     *     scans (Optional): [
     *          (Optional){
     *             id: String (Optional)
     *             name: String (Optional)
     *             scanResults (Optional): [
     *                  (Optional){
     *                     parentId: String (Optional)
     *                     id: String (Optional)
     *                     resourceId: String (Optional)
     *                     status: String (Optional)
     *                     assetsDiscovered: Long (Optional)
     *                     assetsClassified: Long (Optional)
     *                     diagnostics (Optional): {
     *                         notifications (Optional): [
     *                              (Optional){
     *                                 message: String (Optional)
     *                                 code: Integer (Optional)
     *                             }
     *                         ]
     *                         exceptionCountMap (Optional): {
     *                             String: int (Optional)
     *                         }
     *                     }
     *                     startTime: OffsetDateTime (Optional)
     *                     queuedTime: OffsetDateTime (Optional)
     *                     pipelineStartTime: OffsetDateTime (Optional)
     *                     endTime: OffsetDateTime (Optional)
     *                     scanRulesetVersion: Integer (Optional)
     *                     scanRulesetType: String(Custom/System) (Optional)
     *                     scanLevelType: String(Full/Incremental) (Optional)
     *                     errorMessage: String (Optional)
     *                     error (Optional): {
     *                         code: String (Optional)
     *                         message: String (Optional)
     *                         target: String (Optional)
     *                         details (Optional): [
     *                              (Optional){
     *                                 code: String (Optional)
     *                                 message: String (Optional)
     *                                 target: String (Optional)
     *                                 details (Optional): [
     *                                     (recursive schema, see above)
     *                                 ]
     *                             }
     *                         ]
     *                     }
     *                     runType: String (Optional)
     *                     dataSourceType: String(None/AzureSubscription/AzureResourceGroup/AzureSynapseWorkspace/AzureSynapse/AdlsGen1/AdlsGen2/AmazonAccount/AmazonS3/AmazonSql/AzureCosmosDb/AzureDataExplorer/AzureFileService/AzureSqlDatabase/AmazonPostgreSql/AzurePostgreSql/SqlServerDatabase/AzureSqlDatabaseManagedInstance/AzureSqlDataWarehouse/AzureMySql/AzureStorage/Teradata/Oracle/SapS4Hana/SapEcc/PowerBI) (Optional)
     *                 }
     *             ]
     *         }
     *     ]
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @return the paginated response with {@link PagedIterable}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listAll(RequestOptions requestOptions) {
        return this.serviceClient.listAll(requestOptions);
    }
}
