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

com.azure.resourcemanager.securityinsights.implementation.IncidentImpl 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.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.securityinsights.fluent.models.IncidentInner;
import com.azure.resourcemanager.securityinsights.fluent.models.TeamInformationInner;
import com.azure.resourcemanager.securityinsights.models.Incident;
import com.azure.resourcemanager.securityinsights.models.IncidentAdditionalData;
import com.azure.resourcemanager.securityinsights.models.IncidentAlertList;
import com.azure.resourcemanager.securityinsights.models.IncidentBookmarkList;
import com.azure.resourcemanager.securityinsights.models.IncidentClassification;
import com.azure.resourcemanager.securityinsights.models.IncidentClassificationReason;
import com.azure.resourcemanager.securityinsights.models.IncidentEntitiesResponse;
import com.azure.resourcemanager.securityinsights.models.IncidentLabel;
import com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo;
import com.azure.resourcemanager.securityinsights.models.IncidentSeverity;
import com.azure.resourcemanager.securityinsights.models.IncidentStatus;
import com.azure.resourcemanager.securityinsights.models.TeamInformation;
import com.azure.resourcemanager.securityinsights.models.TeamProperties;
import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.List;

public final class IncidentImpl implements Incident, Incident.Definition, Incident.Update {
    private IncidentInner innerObject;

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

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

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

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

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

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

    public IncidentAdditionalData additionalData() {
        return this.innerModel().additionalData();
    }

    public IncidentClassification classification() {
        return this.innerModel().classification();
    }

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

    public IncidentClassificationReason classificationReason() {
        return this.innerModel().classificationReason();
    }

    public OffsetDateTime createdTimeUtc() {
        return this.innerModel().createdTimeUtc();
    }

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

    public OffsetDateTime firstActivityTimeUtc() {
        return this.innerModel().firstActivityTimeUtc();
    }

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

    public Integer incidentNumber() {
        return this.innerModel().incidentNumber();
    }

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

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

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

    public OffsetDateTime lastActivityTimeUtc() {
        return this.innerModel().lastActivityTimeUtc();
    }

    public OffsetDateTime lastModifiedTimeUtc() {
        return this.innerModel().lastModifiedTimeUtc();
    }

    public IncidentOwnerInfo owner() {
        return this.innerModel().owner();
    }

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

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

    public IncidentStatus status() {
        return this.innerModel().status();
    }

    public TeamInformation teamInformation() {
        TeamInformationInner inner = this.innerModel().teamInformation();
        if (inner != null) {
            return new TeamInformationImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    public String resourceGroupName() {
        return resourceGroupName;
    }

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

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

    private String resourceGroupName;

    private String workspaceName;

    private String incidentId;

    public IncidentImpl withExistingWorkspace(String resourceGroupName, String workspaceName) {
        this.resourceGroupName = resourceGroupName;
        this.workspaceName = workspaceName;
        return this;
    }

    public Incident create() {
        this.innerObject = serviceManager.serviceClient()
            .getIncidents()
            .createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, this.innerModel(), Context.NONE)
            .getValue();
        return this;
    }

    public Incident create(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getIncidents()
            .createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, this.innerModel(), context)
            .getValue();
        return this;
    }

    IncidentImpl(String name, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) {
        this.innerObject = new IncidentInner();
        this.serviceManager = serviceManager;
        this.incidentId = name;
    }

    public IncidentImpl update() {
        return this;
    }

    public Incident apply() {
        this.innerObject = serviceManager.serviceClient()
            .getIncidents()
            .createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, this.innerModel(), Context.NONE)
            .getValue();
        return this;
    }

    public Incident apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getIncidents()
            .createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, this.innerModel(), context)
            .getValue();
        return this;
    }

    IncidentImpl(IncidentInner innerObject,
        com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces");
        this.incidentId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "incidents");
    }

    public Incident refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getIncidents()
            .getWithResponse(resourceGroupName, workspaceName, incidentId, Context.NONE)
            .getValue();
        return this;
    }

    public Incident refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getIncidents()
            .getWithResponse(resourceGroupName, workspaceName, incidentId, context)
            .getValue();
        return this;
    }

    public Response createTeamWithResponse(TeamProperties teamProperties, Context context) {
        return serviceManager.incidents()
            .createTeamWithResponse(resourceGroupName, workspaceName, incidentId, teamProperties, context);
    }

    public TeamInformation createTeam(TeamProperties teamProperties) {
        return serviceManager.incidents().createTeam(resourceGroupName, workspaceName, incidentId, teamProperties);
    }

    public Response listAlertsWithResponse(Context context) {
        return serviceManager.incidents().listAlertsWithResponse(resourceGroupName, workspaceName, incidentId, context);
    }

    public IncidentAlertList listAlerts() {
        return serviceManager.incidents().listAlerts(resourceGroupName, workspaceName, incidentId);
    }

    public Response listBookmarksWithResponse(Context context) {
        return serviceManager.incidents()
            .listBookmarksWithResponse(resourceGroupName, workspaceName, incidentId, context);
    }

    public IncidentBookmarkList listBookmarks() {
        return serviceManager.incidents().listBookmarks(resourceGroupName, workspaceName, incidentId);
    }

    public Response listEntitiesWithResponse(Context context) {
        return serviceManager.incidents()
            .listEntitiesWithResponse(resourceGroupName, workspaceName, incidentId, context);
    }

    public IncidentEntitiesResponse listEntities() {
        return serviceManager.incidents().listEntities(resourceGroupName, workspaceName, incidentId);
    }

    public IncidentImpl withEtag(String etag) {
        this.innerModel().withEtag(etag);
        return this;
    }

    public IncidentImpl withClassification(IncidentClassification classification) {
        this.innerModel().withClassification(classification);
        return this;
    }

    public IncidentImpl withClassificationComment(String classificationComment) {
        this.innerModel().withClassificationComment(classificationComment);
        return this;
    }

    public IncidentImpl withClassificationReason(IncidentClassificationReason classificationReason) {
        this.innerModel().withClassificationReason(classificationReason);
        return this;
    }

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

    public IncidentImpl withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc) {
        this.innerModel().withFirstActivityTimeUtc(firstActivityTimeUtc);
        return this;
    }

    public IncidentImpl withLabels(List labels) {
        this.innerModel().withLabels(labels);
        return this;
    }

    public IncidentImpl withProviderName(String providerName) {
        this.innerModel().withProviderName(providerName);
        return this;
    }

    public IncidentImpl withProviderIncidentId(String providerIncidentId) {
        this.innerModel().withProviderIncidentId(providerIncidentId);
        return this;
    }

    public IncidentImpl withLastActivityTimeUtc(OffsetDateTime lastActivityTimeUtc) {
        this.innerModel().withLastActivityTimeUtc(lastActivityTimeUtc);
        return this;
    }

    public IncidentImpl withOwner(IncidentOwnerInfo owner) {
        this.innerModel().withOwner(owner);
        return this;
    }

    public IncidentImpl withSeverity(IncidentSeverity severity) {
        this.innerModel().withSeverity(severity);
        return this;
    }

    public IncidentImpl withStatus(IncidentStatus status) {
        this.innerModel().withStatus(status);
        return this;
    }

    public IncidentImpl withTeamInformation(TeamInformationInner teamInformation) {
        this.innerModel().withTeamInformation(teamInformation);
        return this;
    }

    public IncidentImpl withTitle(String title) {
        this.innerModel().withTitle(title);
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy