
com.azure.resourcemanager.network.models.DefaultAdminRule 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.network.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.SystemData;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.network.fluent.models.BaseAdminRuleInner;
import com.azure.resourcemanager.network.fluent.models.DefaultAdminPropertiesFormat;
import java.io.IOException;
import java.util.List;
/**
* Network default admin rule.
*/
@Fluent
public final class DefaultAdminRule extends BaseAdminRuleInner {
/*
* Whether the rule is custom or default.
*/
private AdminRuleKind kind = AdminRuleKind.DEFAULT;
/*
* Indicates the properties of the security admin rule
*/
private DefaultAdminPropertiesFormat innerProperties;
/*
* The system metadata related to this resource.
*/
private SystemData systemData;
/*
* A unique read-only string that changes whenever the resource is updated.
*/
private String etag;
/*
* 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 DefaultAdminRule class.
*/
public DefaultAdminRule() {
}
/**
* Get the kind property: Whether the rule is custom or default.
*
* @return the kind value.
*/
@Override
public AdminRuleKind kind() {
return this.kind;
}
/**
* Get the innerProperties property: Indicates the properties of the security admin rule.
*
* @return the innerProperties value.
*/
private DefaultAdminPropertiesFormat innerProperties() {
return this.innerProperties;
}
/**
* Get the systemData property: The system metadata related to this resource.
*
* @return the systemData value.
*/
@Override
public SystemData systemData() {
return this.systemData;
}
/**
* Get the etag property: A unique read-only string that changes whenever the resource is updated.
*
* @return the etag value.
*/
@Override
public String etag() {
return this.etag;
}
/**
* 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 description property: A description for this rule. Restricted to 140 chars.
*
* @return the description value.
*/
public String description() {
return this.innerProperties() == null ? null : this.innerProperties().description();
}
/**
* Get the flag property: Default rule flag.
*
* @return the flag value.
*/
public String flag() {
return this.innerProperties() == null ? null : this.innerProperties().flag();
}
/**
* Set the flag property: Default rule flag.
*
* @param flag the flag value to set.
* @return the DefaultAdminRule object itself.
*/
public DefaultAdminRule withFlag(String flag) {
if (this.innerProperties() == null) {
this.innerProperties = new DefaultAdminPropertiesFormat();
}
this.innerProperties().withFlag(flag);
return this;
}
/**
* Get the protocol property: Network protocol this rule applies to.
*
* @return the protocol value.
*/
public SecurityConfigurationRuleProtocol protocol() {
return this.innerProperties() == null ? null : this.innerProperties().protocol();
}
/**
* Get the sources property: The CIDR or source IP ranges.
*
* @return the sources value.
*/
public List sources() {
return this.innerProperties() == null ? null : this.innerProperties().sources();
}
/**
* Get the destinations property: The destination address prefixes. CIDR or destination IP ranges.
*
* @return the destinations value.
*/
public List destinations() {
return this.innerProperties() == null ? null : this.innerProperties().destinations();
}
/**
* Get the sourcePortRanges property: The source port ranges.
*
* @return the sourcePortRanges value.
*/
public List sourcePortRanges() {
return this.innerProperties() == null ? null : this.innerProperties().sourcePortRanges();
}
/**
* Get the destinationPortRanges property: The destination port ranges.
*
* @return the destinationPortRanges value.
*/
public List destinationPortRanges() {
return this.innerProperties() == null ? null : this.innerProperties().destinationPortRanges();
}
/**
* Get the access property: Indicates the access allowed for this particular rule.
*
* @return the access value.
*/
public SecurityConfigurationRuleAccess access() {
return this.innerProperties() == null ? null : this.innerProperties().access();
}
/**
* Get the priority property: The priority of the rule. The value can be between 1 and 4096. The priority number
* must be unique for each rule in the collection. The lower the priority number, the higher the priority of the
* rule.
*
* @return the priority value.
*/
public Integer priority() {
return this.innerProperties() == null ? null : this.innerProperties().priority();
}
/**
* Get the direction property: Indicates if the traffic matched against the rule in inbound or outbound.
*
* @return the direction value.
*/
public SecurityConfigurationRuleDirection direction() {
return this.innerProperties() == null ? null : this.innerProperties().direction();
}
/**
* Get the provisioningState property: The provisioning state of the resource.
*
* @return the provisioningState value.
*/
public ProvisioningState provisioningState() {
return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
}
/**
* Get the resourceGuid property: Unique identifier for this resource.
*
* @return the resourceGuid value.
*/
public String resourceGuid() {
return this.innerProperties() == null ? null : this.innerProperties().resourceGuid();
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (innerProperties() != null) {
innerProperties().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString());
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DefaultAdminRule from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DefaultAdminRule 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 DefaultAdminRule.
*/
public static DefaultAdminRule fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DefaultAdminRule deserializedDefaultAdminRule = new DefaultAdminRule();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedDefaultAdminRule.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedDefaultAdminRule.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedDefaultAdminRule.type = reader.getString();
} else if ("etag".equals(fieldName)) {
deserializedDefaultAdminRule.etag = reader.getString();
} else if ("systemData".equals(fieldName)) {
deserializedDefaultAdminRule.systemData = SystemData.fromJson(reader);
} else if ("kind".equals(fieldName)) {
deserializedDefaultAdminRule.kind = AdminRuleKind.fromString(reader.getString());
} else if ("properties".equals(fieldName)) {
deserializedDefaultAdminRule.innerProperties = DefaultAdminPropertiesFormat.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedDefaultAdminRule;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy