All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.security.implementation.SecurityConnectorApplicationOperationsClientImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3.

There is a newer version: 1.0.0
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.security.implementation;

import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.resourcemanager.security.fluent.SecurityConnectorApplicationOperationsClient;
import com.azure.resourcemanager.security.fluent.models.ApplicationInner;
import reactor.core.publisher.Mono;

/**
 * An instance of this class provides access to all the operations defined in
 * SecurityConnectorApplicationOperationsClient.
 */
public final class SecurityConnectorApplicationOperationsClientImpl
    implements SecurityConnectorApplicationOperationsClient {
    /**
     * The proxy service used to perform REST calls.
     */
    private final SecurityConnectorApplicationOperationsService service;

    /**
     * The service client containing this operation class.
     */
    private final SecurityCenterImpl client;

    /**
     * Initializes an instance of SecurityConnectorApplicationOperationsClientImpl.
     * 
     * @param client the instance of the service client containing this operation class.
     */
    SecurityConnectorApplicationOperationsClientImpl(SecurityCenterImpl client) {
        this.service = RestProxy.create(SecurityConnectorApplicationOperationsService.class, client.getHttpPipeline(),
            client.getSerializerAdapter());
        this.client = client;
    }

    /**
     * The interface defining all the services for SecurityCenterSecurityConnectorApplicationOperations to be used by
     * the proxy service to perform REST calls.
     */
    @Host("{$host}")
    @ServiceInterface(name = "SecurityCenterSecuri")
    public interface SecurityConnectorApplicationOperationsService {
        @Headers({ "Content-Type: application/json" })
        @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> get(@HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("securityConnectorName") String securityConnectorName,
            @PathParam("applicationId") String applicationId, @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}")
        @ExpectedResponses({ 200, 201 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> createOrUpdate(@HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("securityConnectorName") String securityConnectorName,
            @PathParam("applicationId") String applicationId,
            @BodyParam("application/json") ApplicationInner application, @HeaderParam("Accept") String accept,
            Context context);

        @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" })
        @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}")
        @ExpectedResponses({ 200, 204 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("securityConnectorName") String securityConnectorName,
            @PathParam("applicationId") String applicationId, Context context);
    }

    /**
     * Get a specific application for the requested scope by applicationId.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a specific application for the requested scope by applicationId along with {@link Response} on successful
     * completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> getWithResponseAsync(String resourceGroupName,
        String securityConnectorName, String applicationId) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (securityConnectorName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null."));
        }
        if (applicationId == null) {
            return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null."));
        }
        final String apiVersion = "2022-07-01-preview";
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(),
                resourceGroupName, securityConnectorName, applicationId, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a specific application for the requested scope by applicationId.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a specific application for the requested scope by applicationId along with {@link Response} on successful
     * completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> getWithResponseAsync(String resourceGroupName,
        String securityConnectorName, String applicationId, Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (securityConnectorName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null."));
        }
        if (applicationId == null) {
            return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null."));
        }
        final String apiVersion = "2022-07-01-preview";
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName,
            securityConnectorName, applicationId, accept, context);
    }

    /**
     * Get a specific application for the requested scope by applicationId.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a specific application for the requested scope by applicationId on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono getAsync(String resourceGroupName, String securityConnectorName,
        String applicationId) {
        return getWithResponseAsync(resourceGroupName, securityConnectorName, applicationId)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a specific application for the requested scope by applicationId.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a specific application for the requested scope by applicationId along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response getWithResponse(String resourceGroupName, String securityConnectorName,
        String applicationId, Context context) {
        return getWithResponseAsync(resourceGroupName, securityConnectorName, applicationId, context).block();
    }

    /**
     * Get a specific application for the requested scope by applicationId.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a specific application for the requested scope by applicationId.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ApplicationInner get(String resourceGroupName, String securityConnectorName, String applicationId) {
        return getWithResponse(resourceGroupName, securityConnectorName, applicationId, Context.NONE).getValue();
    }

    /**
     * Creates or update a security Application on the given security connector.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @param application Application over a subscription scope.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return security Application over a given scope along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> createOrUpdateWithResponseAsync(String resourceGroupName,
        String securityConnectorName, String applicationId, ApplicationInner application) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (securityConnectorName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null."));
        }
        if (applicationId == null) {
            return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null."));
        }
        if (application == null) {
            return Mono.error(new IllegalArgumentException("Parameter application is required and cannot be null."));
        } else {
            application.validate();
        }
        final String apiVersion = "2022-07-01-preview";
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion,
                this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, applicationId, application,
                accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Creates or update a security Application on the given security connector.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @param application Application over a subscription scope.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return security Application over a given scope along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> createOrUpdateWithResponseAsync(String resourceGroupName,
        String securityConnectorName, String applicationId, ApplicationInner application, Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (securityConnectorName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null."));
        }
        if (applicationId == null) {
            return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null."));
        }
        if (application == null) {
            return Mono.error(new IllegalArgumentException("Parameter application is required and cannot be null."));
        } else {
            application.validate();
        }
        final String apiVersion = "2022-07-01-preview";
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(),
            resourceGroupName, securityConnectorName, applicationId, application, accept, context);
    }

    /**
     * Creates or update a security Application on the given security connector.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @param application Application over a subscription scope.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return security Application over a given scope on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono createOrUpdateAsync(String resourceGroupName, String securityConnectorName,
        String applicationId, ApplicationInner application) {
        return createOrUpdateWithResponseAsync(resourceGroupName, securityConnectorName, applicationId, application)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Creates or update a security Application on the given security connector.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @param application Application over a subscription scope.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return security Application over a given scope along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response createOrUpdateWithResponse(String resourceGroupName, String securityConnectorName,
        String applicationId, ApplicationInner application, Context context) {
        return createOrUpdateWithResponseAsync(resourceGroupName, securityConnectorName, applicationId, application,
            context).block();
    }

    /**
     * Creates or update a security Application on the given security connector.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @param application Application over a subscription scope.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return security Application over a given scope.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ApplicationInner createOrUpdate(String resourceGroupName, String securityConnectorName, String applicationId,
        ApplicationInner application) {
        return createOrUpdateWithResponse(resourceGroupName, securityConnectorName, applicationId, application,
            Context.NONE).getValue();
    }

    /**
     * Delete an Application over a given scope.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> deleteWithResponseAsync(String resourceGroupName, String securityConnectorName,
        String applicationId) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (securityConnectorName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null."));
        }
        if (applicationId == null) {
            return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null."));
        }
        final String apiVersion = "2022-07-01-preview";
        return FluxUtil
            .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion,
                this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, applicationId, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Delete an Application over a given scope.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> deleteWithResponseAsync(String resourceGroupName, String securityConnectorName,
        String applicationId, Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (securityConnectorName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null."));
        }
        if (applicationId == null) {
            return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null."));
        }
        final String apiVersion = "2022-07-01-preview";
        context = this.client.mergeContext(context);
        return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName,
            securityConnectorName, applicationId, context);
    }

    /**
     * Delete an Application over a given scope.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return A {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono deleteAsync(String resourceGroupName, String securityConnectorName, String applicationId) {
        return deleteWithResponseAsync(resourceGroupName, securityConnectorName, applicationId)
            .flatMap(ignored -> Mono.empty());
    }

    /**
     * Delete an Application over a given scope.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response deleteWithResponse(String resourceGroupName, String securityConnectorName,
        String applicationId, Context context) {
        return deleteWithResponseAsync(resourceGroupName, securityConnectorName, applicationId, context).block();
    }

    /**
     * Delete an Application over a given scope.
     * 
     * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
     * insensitive.
     * @param securityConnectorName The security connector name.
     * @param applicationId The security Application key - unique key for the standard application.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void delete(String resourceGroupName, String securityConnectorName, String applicationId) {
        deleteWithResponse(resourceGroupName, securityConnectorName, applicationId, Context.NONE);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy