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

com.azure.resourcemanager.dynatrace.implementation.SingleSignOnsImpl Maven / Gradle / Ivy

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

package com.azure.resourcemanager.dynatrace.implementation;

import com.azure.core.http.rest.PagedIterable;
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.dynatrace.fluent.SingleSignOnsClient;
import com.azure.resourcemanager.dynatrace.fluent.models.DynatraceSingleSignOnResourceInner;
import com.azure.resourcemanager.dynatrace.models.DynatraceSingleSignOnResource;
import com.azure.resourcemanager.dynatrace.models.SingleSignOns;

public final class SingleSignOnsImpl implements SingleSignOns {
    private static final ClientLogger LOGGER = new ClientLogger(SingleSignOnsImpl.class);

    private final SingleSignOnsClient innerClient;

    private final com.azure.resourcemanager.dynatrace.DynatraceManager serviceManager;

    public SingleSignOnsImpl(SingleSignOnsClient innerClient,
        com.azure.resourcemanager.dynatrace.DynatraceManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

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

    public DynatraceSingleSignOnResource get(String resourceGroupName, String monitorName, String configurationName) {
        DynatraceSingleSignOnResourceInner inner
            = this.serviceClient().get(resourceGroupName, monitorName, configurationName);
        if (inner != null) {
            return new DynatraceSingleSignOnResourceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public PagedIterable list(String resourceGroupName, String monitorName) {
        PagedIterable inner
            = this.serviceClient().list(resourceGroupName, monitorName);
        return ResourceManagerUtils.mapPage(inner,
            inner1 -> new DynatraceSingleSignOnResourceImpl(inner1, this.manager()));
    }

    public PagedIterable list(String resourceGroupName, String monitorName,
        Context context) {
        PagedIterable inner
            = this.serviceClient().list(resourceGroupName, monitorName, context);
        return ResourceManagerUtils.mapPage(inner,
            inner1 -> new DynatraceSingleSignOnResourceImpl(inner1, this.manager()));
    }

    public DynatraceSingleSignOnResource 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 monitorName = ResourceManagerUtils.getValueFromIdByName(id, "monitors");
        if (monitorName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id)));
        }
        String configurationName = ResourceManagerUtils.getValueFromIdByName(id, "singleSignOnConfigurations");
        if (configurationName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(String
                .format("The resource ID '%s' is not valid. Missing path segment 'singleSignOnConfigurations'.", id)));
        }
        return this.getWithResponse(resourceGroupName, monitorName, configurationName, 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 monitorName = ResourceManagerUtils.getValueFromIdByName(id, "monitors");
        if (monitorName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id)));
        }
        String configurationName = ResourceManagerUtils.getValueFromIdByName(id, "singleSignOnConfigurations");
        if (configurationName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(String
                .format("The resource ID '%s' is not valid. Missing path segment 'singleSignOnConfigurations'.", id)));
        }
        return this.getWithResponse(resourceGroupName, monitorName, configurationName, context);
    }

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

    private com.azure.resourcemanager.dynatrace.DynatraceManager manager() {
        return this.serviceManager;
    }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy