com.azure.resourcemanager.monitor.fluent.models.LogProfileResourceInner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-monitor Show documentation
Show all versions of azure-resourcemanager-monitor Show documentation
This package contains Microsoft Azure Monitor SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.monitor.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.monitor.models.RetentionPolicy;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* The log profile resource.
*/
@Fluent
public final class LogProfileResourceInner extends Resource {
/*
* The log profile properties of the resource.
*/
private LogProfileProperties innerProperties = new LogProfileProperties();
/*
* Fully qualified resource Id for the resource.
*/
private String id;
/*
* The name of the resource.
*/
private String name;
/*
* The type of the resource.
*/
private String type;
/**
* Creates an instance of LogProfileResourceInner class.
*/
public LogProfileResourceInner() {
}
/**
* Get the innerProperties property: The log profile properties of the resource.
*
* @return the innerProperties value.
*/
private LogProfileProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the id property: Fully qualified resource Id for the resource.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}
/**
* Get the name property: The name of the resource.
*
* @return the name value.
*/
@Override
public String name() {
return this.name;
}
/**
* Get the type property: The type of the resource.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* {@inheritDoc}
*/
@Override
public LogProfileResourceInner withLocation(String location) {
super.withLocation(location);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public LogProfileResourceInner withTags(Map tags) {
super.withTags(tags);
return this;
}
/**
* Get the storageAccountId property: the resource id of the storage account to which you would like to send the
* Activity Log.
*
* @return the storageAccountId value.
*/
public String storageAccountId() {
return this.innerProperties() == null ? null : this.innerProperties().storageAccountId();
}
/**
* Set the storageAccountId property: the resource id of the storage account to which you would like to send the
* Activity Log.
*
* @param storageAccountId the storageAccountId value to set.
* @return the LogProfileResourceInner object itself.
*/
public LogProfileResourceInner withStorageAccountId(String storageAccountId) {
if (this.innerProperties() == null) {
this.innerProperties = new LogProfileProperties();
}
this.innerProperties().withStorageAccountId(storageAccountId);
return this;
}
/**
* Get the serviceBusRuleId property: The service bus rule ID of the service bus namespace in which you would like
* to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource
* ID}/authorizationrules/{key name}'.
*
* @return the serviceBusRuleId value.
*/
public String serviceBusRuleId() {
return this.innerProperties() == null ? null : this.innerProperties().serviceBusRuleId();
}
/**
* Set the serviceBusRuleId property: The service bus rule ID of the service bus namespace in which you would like
* to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource
* ID}/authorizationrules/{key name}'.
*
* @param serviceBusRuleId the serviceBusRuleId value to set.
* @return the LogProfileResourceInner object itself.
*/
public LogProfileResourceInner withServiceBusRuleId(String serviceBusRuleId) {
if (this.innerProperties() == null) {
this.innerProperties = new LogProfileProperties();
}
this.innerProperties().withServiceBusRuleId(serviceBusRuleId);
return this;
}
/**
* Get the locations property: List of regions for which Activity Log events should be stored or streamed. It is a
* comma separated list of valid ARM locations including the 'global' location.
*
* @return the locations value.
*/
public List locations() {
return this.innerProperties() == null ? null : this.innerProperties().locations();
}
/**
* Set the locations property: List of regions for which Activity Log events should be stored or streamed. It is a
* comma separated list of valid ARM locations including the 'global' location.
*
* @param locations the locations value to set.
* @return the LogProfileResourceInner object itself.
*/
public LogProfileResourceInner withLocations(List locations) {
if (this.innerProperties() == null) {
this.innerProperties = new LogProfileProperties();
}
this.innerProperties().withLocations(locations);
return this;
}
/**
* Get the categories property: the categories of the logs. These categories are created as is convenient to the
* user. Some values are: 'Write', 'Delete', and/or 'Action.'.
*
* @return the categories value.
*/
public List categories() {
return this.innerProperties() == null ? null : this.innerProperties().categories();
}
/**
* Set the categories property: the categories of the logs. These categories are created as is convenient to the
* user. Some values are: 'Write', 'Delete', and/or 'Action.'.
*
* @param categories the categories value to set.
* @return the LogProfileResourceInner object itself.
*/
public LogProfileResourceInner withCategories(List categories) {
if (this.innerProperties() == null) {
this.innerProperties = new LogProfileProperties();
}
this.innerProperties().withCategories(categories);
return this;
}
/**
* Get the retentionPolicy property: the retention policy for the events in the log.
*
* @return the retentionPolicy value.
*/
public RetentionPolicy retentionPolicy() {
return this.innerProperties() == null ? null : this.innerProperties().retentionPolicy();
}
/**
* Set the retentionPolicy property: the retention policy for the events in the log.
*
* @param retentionPolicy the retentionPolicy value to set.
* @return the LogProfileResourceInner object itself.
*/
public LogProfileResourceInner withRetentionPolicy(RetentionPolicy retentionPolicy) {
if (this.innerProperties() == null) {
this.innerProperties = new LogProfileProperties();
}
this.innerProperties().withRetentionPolicy(retentionPolicy);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (innerProperties() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property innerProperties in model LogProfileResourceInner"));
} else {
innerProperties().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(LogProfileResourceInner.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("location", location());
jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of LogProfileResourceInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of LogProfileResourceInner if the JsonReader was pointing to an instance of it, or null if it
* was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the LogProfileResourceInner.
*/
public static LogProfileResourceInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
LogProfileResourceInner deserializedLogProfileResourceInner = new LogProfileResourceInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedLogProfileResourceInner.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedLogProfileResourceInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedLogProfileResourceInner.type = reader.getString();
} else if ("location".equals(fieldName)) {
deserializedLogProfileResourceInner.withLocation(reader.getString());
} else if ("tags".equals(fieldName)) {
Map tags = reader.readMap(reader1 -> reader1.getString());
deserializedLogProfileResourceInner.withTags(tags);
} else if ("properties".equals(fieldName)) {
deserializedLogProfileResourceInner.innerProperties = LogProfileProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedLogProfileResourceInner;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy