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

com.azure.resourcemanager.security.implementation.DevOpsPolicyAssignmentImpl 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.DevOpsPolicyAssignmentInner;
import com.azure.resourcemanager.security.models.DevOpsPolicyAssignment;
import com.azure.resourcemanager.security.models.DevOpsPolicyAssignmentProperties;

public final class DevOpsPolicyAssignmentImpl
    implements DevOpsPolicyAssignment, DevOpsPolicyAssignment.Definition, DevOpsPolicyAssignment.Update {
    private DevOpsPolicyAssignmentInner 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 DevOpsPolicyAssignmentProperties properties() {
        return this.innerModel().properties();
    }

    public String resourceGroupName() {
        return resourceGroupName;
    }

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

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

    private String resourceGroupName;

    private String securityConnectorName;

    private String policyAssignmentId;

    public DevOpsPolicyAssignmentImpl withExistingSecurityConnector(String resourceGroupName,
        String securityConnectorName) {
        this.resourceGroupName = resourceGroupName;
        this.securityConnectorName = securityConnectorName;
        return this;
    }

    public DevOpsPolicyAssignment create() {
        this.innerObject = serviceManager.serviceClient()
            .getDevOpsPolicyAssignments()
            .createOrUpdate(resourceGroupName, securityConnectorName, policyAssignmentId, this.innerModel(),
                Context.NONE);
        return this;
    }

    public DevOpsPolicyAssignment create(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getDevOpsPolicyAssignments()
            .createOrUpdate(resourceGroupName, securityConnectorName, policyAssignmentId, this.innerModel(), context);
        return this;
    }

    DevOpsPolicyAssignmentImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) {
        this.innerObject = new DevOpsPolicyAssignmentInner();
        this.serviceManager = serviceManager;
        this.policyAssignmentId = name;
    }

    public DevOpsPolicyAssignmentImpl update() {
        return this;
    }

    public DevOpsPolicyAssignment apply() {
        this.innerObject = serviceManager.serviceClient()
            .getDevOpsPolicyAssignments()
            .update(resourceGroupName, securityConnectorName, policyAssignmentId, this.innerModel(), Context.NONE);
        return this;
    }

    public DevOpsPolicyAssignment apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getDevOpsPolicyAssignments()
            .update(resourceGroupName, securityConnectorName, policyAssignmentId, this.innerModel(), context);
        return this;
    }

    DevOpsPolicyAssignmentImpl(DevOpsPolicyAssignmentInner innerObject,
        com.azure.resourcemanager.security.SecurityManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.securityConnectorName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "securityConnectors");
        this.policyAssignmentId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "policyAssignments");
    }

    public DevOpsPolicyAssignment refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getDevOpsPolicyAssignments()
            .getWithResponse(resourceGroupName, securityConnectorName, policyAssignmentId, Context.NONE)
            .getValue();
        return this;
    }

    public DevOpsPolicyAssignment refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getDevOpsPolicyAssignments()
            .getWithResponse(resourceGroupName, securityConnectorName, policyAssignmentId, context)
            .getValue();
        return this;
    }

    public DevOpsPolicyAssignmentImpl withProperties(DevOpsPolicyAssignmentProperties properties) {
        this.innerModel().withProperties(properties);
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy