// 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.ScansImpl;
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 ScansClient {
    @Generated private final ScansImpl serviceClient;

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

    /**
     * Creates an instance of a scan.
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     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)
     *     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 scanName The scanName parameter.
     * @param body The body 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, String scanName, BinaryData body, RequestOptions requestOptions) {
        return this.serviceClient.createOrUpdateWithResponse(dataSourceName, scanName, body, requestOptions);
    }

    /**
     * Gets a scan information.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     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 scanName The scanName 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 scan information along with {@link Response}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getWithResponse(String dataSourceName, String scanName, RequestOptions requestOptions) {
        return this.serviceClient.getWithResponse(dataSourceName, scanName, requestOptions);
    }

    /**
     * Deletes the scan associated with the data source.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     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 scanName The scanName 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, String scanName, RequestOptions requestOptions) {
        return this.serviceClient.deleteWithResponse(dataSourceName, scanName, requestOptions);
    }

    /**
     * List scans in data source.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     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 paginated response with {@link PagedIterable}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listByDataSource(String dataSourceName, RequestOptions requestOptions) {
        return this.serviceClient.listByDataSource(dataSourceName, requestOptions);
    }
}
