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

com.azure.resourcemanager.security.implementation.CustomRecommendationImpl 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.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.security.fluent.models.CustomRecommendationInner;
import com.azure.resourcemanager.security.models.CustomRecommendation;
import com.azure.resourcemanager.security.models.RecommendationSupportedClouds;
import com.azure.resourcemanager.security.models.SecurityIssue;
import com.azure.resourcemanager.security.models.SeverityEnum;
import java.util.Collections;
import java.util.List;

public final class CustomRecommendationImpl
    implements CustomRecommendation, CustomRecommendation.Definition, CustomRecommendation.Update {
    private CustomRecommendationInner innerObject;

    private final com.azure.resourcemanager.security.SecurityManager serviceManager;

    public String id() {
        return this.innerModel().id();
    }

    public String name() {
        return this.innerModel().name();
    }

    public String type() {
        return this.innerModel().type();
    }

    public SystemData systemData() {
        return this.innerModel().systemData();
    }

    public String query() {
        return this.innerModel().query();
    }

    public List cloudProviders() {
        List inner = this.innerModel().cloudProviders();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public SeverityEnum severity() {
        return this.innerModel().severity();
    }

    public SecurityIssue securityIssue() {
        return this.innerModel().securityIssue();
    }

    public String displayName() {
        return this.innerModel().displayName();
    }

    public String description() {
        return this.innerModel().description();
    }

    public String remediationDescription() {
        return this.innerModel().remediationDescription();
    }

    public String assessmentKey() {
        return this.innerModel().assessmentKey();
    }

    public CustomRecommendationInner innerModel() {
        return this.innerObject;
    }

    private com.azure.resourcemanager.security.SecurityManager manager() {
        return this.serviceManager;
    }

    private String scope;

    private String customRecommendationName;

    public CustomRecommendationImpl withExistingScope(String scope) {
        this.scope = scope;
        return this;
    }

    public CustomRecommendation create() {
        this.innerObject = serviceManager.serviceClient()
            .getCustomRecommendations()
            .createOrUpdateWithResponse(scope, customRecommendationName, this.innerModel(), Context.NONE)
            .getValue();
        return this;
    }

    public CustomRecommendation create(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getCustomRecommendations()
            .createOrUpdateWithResponse(scope, customRecommendationName, this.innerModel(), context)
            .getValue();
        return this;
    }

    CustomRecommendationImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) {
        this.innerObject = new CustomRecommendationInner();
        this.serviceManager = serviceManager;
        this.customRecommendationName = name;
    }

    public CustomRecommendationImpl update() {
        return this;
    }

    public CustomRecommendation apply() {
        this.innerObject = serviceManager.serviceClient()
            .getCustomRecommendations()
            .createOrUpdateWithResponse(scope, customRecommendationName, this.innerModel(), Context.NONE)
            .getValue();
        return this;
    }

    public CustomRecommendation apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getCustomRecommendations()
            .createOrUpdateWithResponse(scope, customRecommendationName, this.innerModel(), context)
            .getValue();
        return this;
    }

    CustomRecommendationImpl(CustomRecommendationInner innerObject,
        com.azure.resourcemanager.security.SecurityManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.scope = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(),
            "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}", "scope");
        this.customRecommendationName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(),
            "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}",
            "customRecommendationName");
    }

    public CustomRecommendation refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getCustomRecommendations()
            .getWithResponse(scope, customRecommendationName, Context.NONE)
            .getValue();
        return this;
    }

    public CustomRecommendation refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getCustomRecommendations()
            .getWithResponse(scope, customRecommendationName, context)
            .getValue();
        return this;
    }

    public CustomRecommendationImpl withQuery(String query) {
        this.innerModel().withQuery(query);
        return this;
    }

    public CustomRecommendationImpl withCloudProviders(List cloudProviders) {
        this.innerModel().withCloudProviders(cloudProviders);
        return this;
    }

    public CustomRecommendationImpl withSeverity(SeverityEnum severity) {
        this.innerModel().withSeverity(severity);
        return this;
    }

    public CustomRecommendationImpl withSecurityIssue(SecurityIssue securityIssue) {
        this.innerModel().withSecurityIssue(securityIssue);
        return this;
    }

    public CustomRecommendationImpl withDisplayName(String displayName) {
        this.innerModel().withDisplayName(displayName);
        return this;
    }

    public CustomRecommendationImpl withDescription(String description) {
        this.innerModel().withDescription(description);
        return this;
    }

    public CustomRecommendationImpl withRemediationDescription(String remediationDescription) {
        this.innerModel().withRemediationDescription(remediationDescription);
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy