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

com.azure.resourcemanager.securityinsights.implementation.WatchlistItemImpl 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-2022-09.

The 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.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.securityinsights.fluent.models.WatchlistItemInner;
import com.azure.resourcemanager.securityinsights.models.UserInfo;
import com.azure.resourcemanager.securityinsights.models.WatchlistItem;
import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.Map;

public final class WatchlistItemImpl implements WatchlistItem, WatchlistItem.Definition, WatchlistItem.Update {
    private WatchlistItemInner 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 String watchlistItemType() {
        return this.innerModel().watchlistItemType();
    }

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

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

    public Boolean isDeleted() {
        return this.innerModel().isDeleted();
    }

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

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

    public UserInfo createdBy() {
        return this.innerModel().createdBy();
    }

    public UserInfo updatedBy() {
        return this.innerModel().updatedBy();
    }

    public Map itemsKeyValue() {
        Map inner = this.innerModel().itemsKeyValue();
        if (inner != null) {
            return Collections.unmodifiableMap(inner);
        } else {
            return Collections.emptyMap();
        }
    }

    public Map entityMapping() {
        Map inner = this.innerModel().entityMapping();
        if (inner != null) {
            return Collections.unmodifiableMap(inner);
        } else {
            return Collections.emptyMap();
        }
    }

    public String resourceGroupName() {
        return resourceGroupName;
    }

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

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

    private String resourceGroupName;

    private String workspaceName;

    private String watchlistAlias;

    private String watchlistItemId;

    public WatchlistItemImpl withExistingWatchlist(String resourceGroupName, String workspaceName,
        String watchlistAlias) {
        this.resourceGroupName = resourceGroupName;
        this.workspaceName = workspaceName;
        this.watchlistAlias = watchlistAlias;
        return this;
    }

    public WatchlistItem create() {
        this.innerObject = serviceManager.serviceClient()
            .getWatchlistItems()
            .createOrUpdateWithResponse(resourceGroupName, workspaceName, watchlistAlias, watchlistItemId,
                this.innerModel(), Context.NONE)
            .getValue();
        return this;
    }

    public WatchlistItem create(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getWatchlistItems()
            .createOrUpdateWithResponse(resourceGroupName, workspaceName, watchlistAlias, watchlistItemId,
                this.innerModel(), context)
            .getValue();
        return this;
    }

    WatchlistItemImpl(String name, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) {
        this.innerObject = new WatchlistItemInner();
        this.serviceManager = serviceManager;
        this.watchlistItemId = name;
    }

    public WatchlistItemImpl update() {
        return this;
    }

    public WatchlistItem apply() {
        this.innerObject = serviceManager.serviceClient()
            .getWatchlistItems()
            .createOrUpdateWithResponse(resourceGroupName, workspaceName, watchlistAlias, watchlistItemId,
                this.innerModel(), Context.NONE)
            .getValue();
        return this;
    }

    public WatchlistItem apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getWatchlistItems()
            .createOrUpdateWithResponse(resourceGroupName, workspaceName, watchlistAlias, watchlistItemId,
                this.innerModel(), context)
            .getValue();
        return this;
    }

    WatchlistItemImpl(WatchlistItemInner 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.watchlistAlias = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "watchlists");
        this.watchlistItemId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "watchlistItems");
    }

    public WatchlistItem refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getWatchlistItems()
            .getWithResponse(resourceGroupName, workspaceName, watchlistAlias, watchlistItemId, Context.NONE)
            .getValue();
        return this;
    }

    public WatchlistItem refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getWatchlistItems()
            .getWithResponse(resourceGroupName, workspaceName, watchlistAlias, watchlistItemId, context)
            .getValue();
        return this;
    }

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

    public WatchlistItemImpl withWatchlistItemType(String watchlistItemType) {
        this.innerModel().withWatchlistItemType(watchlistItemType);
        return this;
    }

    public WatchlistItemImpl withWatchlistItemId(String watchlistItemId) {
        this.innerModel().withWatchlistItemId(watchlistItemId);
        return this;
    }

    public WatchlistItemImpl withTenantId(String tenantId) {
        this.innerModel().withTenantId(tenantId);
        return this;
    }

    public WatchlistItemImpl withIsDeleted(Boolean isDeleted) {
        this.innerModel().withIsDeleted(isDeleted);
        return this;
    }

    public WatchlistItemImpl withCreated(OffsetDateTime created) {
        this.innerModel().withCreated(created);
        return this;
    }

    public WatchlistItemImpl withUpdated(OffsetDateTime updated) {
        this.innerModel().withUpdated(updated);
        return this;
    }

    public WatchlistItemImpl withCreatedBy(UserInfo createdBy) {
        this.innerModel().withCreatedBy(createdBy);
        return this;
    }

    public WatchlistItemImpl withUpdatedBy(UserInfo updatedBy) {
        this.innerModel().withUpdatedBy(updatedBy);
        return this;
    }

    public WatchlistItemImpl withItemsKeyValue(Map itemsKeyValue) {
        this.innerModel().withItemsKeyValue(itemsKeyValue);
        return this;
    }

    public WatchlistItemImpl withEntityMapping(Map entityMapping) {
        this.innerModel().withEntityMapping(entityMapping);
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy