com.azure.resourcemanager.security.fluent.models.SecurityContactInner Maven / Gradle / Ivy
// 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.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.security.models.NotificationsSource;
import com.azure.resourcemanager.security.models.SecurityContactPropertiesNotificationsByRole;
import java.io.IOException;
import java.util.List;
/**
* Contact details and configurations for notifications coming from Microsoft Defender for Cloud.
*/
@Fluent
public final class SecurityContactInner extends ProxyResource {
/*
* Security contact data
*/
private SecurityContactProperties innerProperties;
/*
* The type of the resource.
*/
private String type;
/*
* The name of the resource.
*/
private String name;
/*
* Fully qualified resource Id for the resource.
*/
private String id;
/**
* Creates an instance of SecurityContactInner class.
*/
public SecurityContactInner() {
}
/**
* Get the innerProperties property: Security contact data.
*
* @return the innerProperties value.
*/
private SecurityContactProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the type property: The type of the resource.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* Get the name property: The name of the resource.
*
* @return the name value.
*/
@Override
public String name() {
return this.name;
}
/**
* Get the id property: Fully qualified resource Id for the resource.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}
/**
* Get the emails property: List of email addresses which will get notifications from Microsoft Defender for Cloud
* by the configurations defined in this security contact.
*
* @return the emails value.
*/
public String emails() {
return this.innerProperties() == null ? null : this.innerProperties().emails();
}
/**
* Set the emails property: List of email addresses which will get notifications from Microsoft Defender for Cloud
* by the configurations defined in this security contact.
*
* @param emails the emails value to set.
* @return the SecurityContactInner object itself.
*/
public SecurityContactInner withEmails(String emails) {
if (this.innerProperties() == null) {
this.innerProperties = new SecurityContactProperties();
}
this.innerProperties().withEmails(emails);
return this;
}
/**
* Get the phone property: The security contact's phone number.
*
* @return the phone value.
*/
public String phone() {
return this.innerProperties() == null ? null : this.innerProperties().phone();
}
/**
* Set the phone property: The security contact's phone number.
*
* @param phone the phone value to set.
* @return the SecurityContactInner object itself.
*/
public SecurityContactInner withPhone(String phone) {
if (this.innerProperties() == null) {
this.innerProperties = new SecurityContactProperties();
}
this.innerProperties().withPhone(phone);
return this;
}
/**
* Get the isEnabled property: Indicates whether the security contact is enabled.
*
* @return the isEnabled value.
*/
public Boolean isEnabled() {
return this.innerProperties() == null ? null : this.innerProperties().isEnabled();
}
/**
* Set the isEnabled property: Indicates whether the security contact is enabled.
*
* @param isEnabled the isEnabled value to set.
* @return the SecurityContactInner object itself.
*/
public SecurityContactInner withIsEnabled(Boolean isEnabled) {
if (this.innerProperties() == null) {
this.innerProperties = new SecurityContactProperties();
}
this.innerProperties().withIsEnabled(isEnabled);
return this;
}
/**
* Get the notificationsSources property: A collection of sources types which evaluate the email notification.
*
* @return the notificationsSources value.
*/
public List notificationsSources() {
return this.innerProperties() == null ? null : this.innerProperties().notificationsSources();
}
/**
* Set the notificationsSources property: A collection of sources types which evaluate the email notification.
*
* @param notificationsSources the notificationsSources value to set.
* @return the SecurityContactInner object itself.
*/
public SecurityContactInner withNotificationsSources(List notificationsSources) {
if (this.innerProperties() == null) {
this.innerProperties = new SecurityContactProperties();
}
this.innerProperties().withNotificationsSources(notificationsSources);
return this;
}
/**
* Get the notificationsByRole property: Defines whether to send email notifications from Microsoft Defender for
* Cloud to persons with specific RBAC roles on the subscription.
*
* @return the notificationsByRole value.
*/
public SecurityContactPropertiesNotificationsByRole notificationsByRole() {
return this.innerProperties() == null ? null : this.innerProperties().notificationsByRole();
}
/**
* Set the notificationsByRole property: Defines whether to send email notifications from Microsoft Defender for
* Cloud to persons with specific RBAC roles on the subscription.
*
* @param notificationsByRole the notificationsByRole value to set.
* @return the SecurityContactInner object itself.
*/
public SecurityContactInner
withNotificationsByRole(SecurityContactPropertiesNotificationsByRole notificationsByRole) {
if (this.innerProperties() == null) {
this.innerProperties = new SecurityContactProperties();
}
this.innerProperties().withNotificationsByRole(notificationsByRole);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (innerProperties() != null) {
innerProperties().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SecurityContactInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SecurityContactInner 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 SecurityContactInner.
*/
public static SecurityContactInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SecurityContactInner deserializedSecurityContactInner = new SecurityContactInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedSecurityContactInner.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedSecurityContactInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedSecurityContactInner.type = reader.getString();
} else if ("properties".equals(fieldName)) {
deserializedSecurityContactInner.innerProperties = SecurityContactProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedSecurityContactInner;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy