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

com.azure.resourcemanager.securityinsights.implementation.SentinelOnboardingStatesImpl Maven / Gradle / Ivy

Go to download

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

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.securityinsights.implementation;

import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.securityinsights.fluent.SentinelOnboardingStatesClient;
import com.azure.resourcemanager.securityinsights.fluent.models.SentinelOnboardingStateInner;
import com.azure.resourcemanager.securityinsights.fluent.models.SentinelOnboardingStatesListInner;
import com.azure.resourcemanager.securityinsights.models.SentinelOnboardingState;
import com.azure.resourcemanager.securityinsights.models.SentinelOnboardingStates;
import com.azure.resourcemanager.securityinsights.models.SentinelOnboardingStatesList;

public final class SentinelOnboardingStatesImpl implements SentinelOnboardingStates {
    private static final ClientLogger LOGGER = new ClientLogger(SentinelOnboardingStatesImpl.class);

    private final SentinelOnboardingStatesClient innerClient;

    private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager;

    public SentinelOnboardingStatesImpl(SentinelOnboardingStatesClient innerClient,
        com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public Response getWithResponse(String resourceGroupName, String workspaceName,
        String sentinelOnboardingStateName, Context context) {
        Response inner = this.serviceClient()
            .getWithResponse(resourceGroupName, workspaceName, sentinelOnboardingStateName, context);
        if (inner != null) {
            return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
                new SentinelOnboardingStateImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public SentinelOnboardingState get(String resourceGroupName, String workspaceName,
        String sentinelOnboardingStateName) {
        SentinelOnboardingStateInner inner
            = this.serviceClient().get(resourceGroupName, workspaceName, sentinelOnboardingStateName);
        if (inner != null) {
            return new SentinelOnboardingStateImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public Response deleteWithResponse(String resourceGroupName, String workspaceName,
        String sentinelOnboardingStateName, Context context) {
        return this.serviceClient()
            .deleteWithResponse(resourceGroupName, workspaceName, sentinelOnboardingStateName, context);
    }

    public void delete(String resourceGroupName, String workspaceName, String sentinelOnboardingStateName) {
        this.serviceClient().delete(resourceGroupName, workspaceName, sentinelOnboardingStateName);
    }

    public Response listWithResponse(String resourceGroupName, String workspaceName,
        Context context) {
        Response inner
            = this.serviceClient().listWithResponse(resourceGroupName, workspaceName, context);
        if (inner != null) {
            return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
                new SentinelOnboardingStatesListImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public SentinelOnboardingStatesList list(String resourceGroupName, String workspaceName) {
        SentinelOnboardingStatesListInner inner = this.serviceClient().list(resourceGroupName, workspaceName);
        if (inner != null) {
            return new SentinelOnboardingStatesListImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public SentinelOnboardingState getById(String id) {
        String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
        if (resourceGroupName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
        }
        String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces");
        if (workspaceName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id)));
        }
        String sentinelOnboardingStateName = ResourceManagerUtils.getValueFromIdByName(id, "onboardingStates");
        if (sentinelOnboardingStateName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'onboardingStates'.", id)));
        }
        return this.getWithResponse(resourceGroupName, workspaceName, sentinelOnboardingStateName, Context.NONE)
            .getValue();
    }

    public Response getByIdWithResponse(String id, Context context) {
        String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
        if (resourceGroupName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
        }
        String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces");
        if (workspaceName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id)));
        }
        String sentinelOnboardingStateName = ResourceManagerUtils.getValueFromIdByName(id, "onboardingStates");
        if (sentinelOnboardingStateName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'onboardingStates'.", id)));
        }
        return this.getWithResponse(resourceGroupName, workspaceName, sentinelOnboardingStateName, context);
    }

    public void deleteById(String id) {
        String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
        if (resourceGroupName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
        }
        String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces");
        if (workspaceName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id)));
        }
        String sentinelOnboardingStateName = ResourceManagerUtils.getValueFromIdByName(id, "onboardingStates");
        if (sentinelOnboardingStateName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'onboardingStates'.", id)));
        }
        this.deleteWithResponse(resourceGroupName, workspaceName, sentinelOnboardingStateName, Context.NONE);
    }

    public Response deleteByIdWithResponse(String id, Context context) {
        String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
        if (resourceGroupName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
        }
        String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces");
        if (workspaceName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id)));
        }
        String sentinelOnboardingStateName = ResourceManagerUtils.getValueFromIdByName(id, "onboardingStates");
        if (sentinelOnboardingStateName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'onboardingStates'.", id)));
        }
        return this.deleteWithResponse(resourceGroupName, workspaceName, sentinelOnboardingStateName, context);
    }

    private SentinelOnboardingStatesClient serviceClient() {
        return this.innerClient;
    }

    private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() {
        return this.serviceManager;
    }

    public SentinelOnboardingStateImpl define(String name) {
        return new SentinelOnboardingStateImpl(name, this.manager());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy