Class OSPolicy.Builder

  • All Implemented Interfaces:
    OSPolicyOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
    Enclosing class:
    OSPolicy

    public static final class OSPolicy.Builder
    extends com.google.protobuf.GeneratedMessageV3.Builder<OSPolicy.Builder>
    implements OSPolicyOrBuilder
     An OS policy defines the desired state configuration for a VM.
     
    Protobuf type google.cloud.osconfig.v1.OSPolicy
    • Method Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<OSPolicy.Builder>
      • clear

        public OSPolicy.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessageV3.Builder<OSPolicy.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<OSPolicy.Builder>
      • getDefaultInstanceForType

        public OSPolicy getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public OSPolicy build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public OSPolicy buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • clone

        public OSPolicy.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<OSPolicy.Builder>
      • setField

        public OSPolicy.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                         Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<OSPolicy.Builder>
      • clearField

        public OSPolicy.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<OSPolicy.Builder>
      • clearOneof

        public OSPolicy.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<OSPolicy.Builder>
      • setRepeatedField

        public OSPolicy.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                 int index,
                                                 Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<OSPolicy.Builder>
      • addRepeatedField

        public OSPolicy.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                 Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<OSPolicy.Builder>
      • mergeFrom

        public OSPolicy.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<OSPolicy.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<OSPolicy.Builder>
      • mergeFrom

        public OSPolicy.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                   throws IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<OSPolicy.Builder>
        Throws:
        IOException
      • getId

        public String getId()
         Required. The id of the OS policy with the following restrictions:
        
         * Must contain only lowercase letters, numbers, and hyphens.
         * Must start with a letter.
         * Must be between 1-63 characters.
         * Must end with a number or a letter.
         * Must be unique within the assignment.
         
        string id = 1 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getId in interface OSPolicyOrBuilder
        Returns:
        The id.
      • getIdBytes

        public com.google.protobuf.ByteString getIdBytes()
         Required. The id of the OS policy with the following restrictions:
        
         * Must contain only lowercase letters, numbers, and hyphens.
         * Must start with a letter.
         * Must be between 1-63 characters.
         * Must end with a number or a letter.
         * Must be unique within the assignment.
         
        string id = 1 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getIdBytes in interface OSPolicyOrBuilder
        Returns:
        The bytes for id.
      • setId

        public OSPolicy.Builder setId​(String value)
         Required. The id of the OS policy with the following restrictions:
        
         * Must contain only lowercase letters, numbers, and hyphens.
         * Must start with a letter.
         * Must be between 1-63 characters.
         * Must end with a number or a letter.
         * Must be unique within the assignment.
         
        string id = 1 [(.google.api.field_behavior) = REQUIRED];
        Parameters:
        value - The id to set.
        Returns:
        This builder for chaining.
      • clearId

        public OSPolicy.Builder clearId()
         Required. The id of the OS policy with the following restrictions:
        
         * Must contain only lowercase letters, numbers, and hyphens.
         * Must start with a letter.
         * Must be between 1-63 characters.
         * Must end with a number or a letter.
         * Must be unique within the assignment.
         
        string id = 1 [(.google.api.field_behavior) = REQUIRED];
        Returns:
        This builder for chaining.
      • setIdBytes

        public OSPolicy.Builder setIdBytes​(com.google.protobuf.ByteString value)
         Required. The id of the OS policy with the following restrictions:
        
         * Must contain only lowercase letters, numbers, and hyphens.
         * Must start with a letter.
         * Must be between 1-63 characters.
         * Must end with a number or a letter.
         * Must be unique within the assignment.
         
        string id = 1 [(.google.api.field_behavior) = REQUIRED];
        Parameters:
        value - The bytes for id to set.
        Returns:
        This builder for chaining.
      • getDescription

        public String getDescription()
         Policy description.
         Length of the description is limited to 1024 characters.
         
        string description = 2;
        Specified by:
        getDescription in interface OSPolicyOrBuilder
        Returns:
        The description.
      • getDescriptionBytes

        public com.google.protobuf.ByteString getDescriptionBytes()
         Policy description.
         Length of the description is limited to 1024 characters.
         
        string description = 2;
        Specified by:
        getDescriptionBytes in interface OSPolicyOrBuilder
        Returns:
        The bytes for description.
      • setDescription

        public OSPolicy.Builder setDescription​(String value)
         Policy description.
         Length of the description is limited to 1024 characters.
         
        string description = 2;
        Parameters:
        value - The description to set.
        Returns:
        This builder for chaining.
      • clearDescription

        public OSPolicy.Builder clearDescription()
         Policy description.
         Length of the description is limited to 1024 characters.
         
        string description = 2;
        Returns:
        This builder for chaining.
      • setDescriptionBytes

        public OSPolicy.Builder setDescriptionBytes​(com.google.protobuf.ByteString value)
         Policy description.
         Length of the description is limited to 1024 characters.
         
        string description = 2;
        Parameters:
        value - The bytes for description to set.
        Returns:
        This builder for chaining.
      • getModeValue

        public int getModeValue()
         Required. Policy mode
         
        .google.cloud.osconfig.v1.OSPolicy.Mode mode = 3 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getModeValue in interface OSPolicyOrBuilder
        Returns:
        The enum numeric value on the wire for mode.
      • setModeValue

        public OSPolicy.Builder setModeValue​(int value)
         Required. Policy mode
         
        .google.cloud.osconfig.v1.OSPolicy.Mode mode = 3 [(.google.api.field_behavior) = REQUIRED];
        Parameters:
        value - The enum numeric value on the wire for mode to set.
        Returns:
        This builder for chaining.
      • getMode

        public OSPolicy.Mode getMode()
         Required. Policy mode
         
        .google.cloud.osconfig.v1.OSPolicy.Mode mode = 3 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getMode in interface OSPolicyOrBuilder
        Returns:
        The mode.
      • setMode

        public OSPolicy.Builder setMode​(OSPolicy.Mode value)
         Required. Policy mode
         
        .google.cloud.osconfig.v1.OSPolicy.Mode mode = 3 [(.google.api.field_behavior) = REQUIRED];
        Parameters:
        value - The mode to set.
        Returns:
        This builder for chaining.
      • clearMode

        public OSPolicy.Builder clearMode()
         Required. Policy mode
         
        .google.cloud.osconfig.v1.OSPolicy.Mode mode = 3 [(.google.api.field_behavior) = REQUIRED];
        Returns:
        This builder for chaining.
      • getResourceGroupsList

        public List<OSPolicy.ResourceGroup> getResourceGroupsList()
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getResourceGroupsList in interface OSPolicyOrBuilder
      • getResourceGroupsCount

        public int getResourceGroupsCount()
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getResourceGroupsCount in interface OSPolicyOrBuilder
      • getResourceGroups

        public OSPolicy.ResourceGroup getResourceGroups​(int index)
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getResourceGroups in interface OSPolicyOrBuilder
      • setResourceGroups

        public OSPolicy.Builder setResourceGroups​(int index,
                                                  OSPolicy.ResourceGroup value)
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
      • setResourceGroups

        public OSPolicy.Builder setResourceGroups​(int index,
                                                  OSPolicy.ResourceGroup.Builder builderForValue)
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
      • addResourceGroups

        public OSPolicy.Builder addResourceGroups​(OSPolicy.ResourceGroup value)
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
      • addResourceGroups

        public OSPolicy.Builder addResourceGroups​(int index,
                                                  OSPolicy.ResourceGroup value)
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
      • addResourceGroups

        public OSPolicy.Builder addResourceGroups​(OSPolicy.ResourceGroup.Builder builderForValue)
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
      • addResourceGroups

        public OSPolicy.Builder addResourceGroups​(int index,
                                                  OSPolicy.ResourceGroup.Builder builderForValue)
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
      • addAllResourceGroups

        public OSPolicy.Builder addAllResourceGroups​(Iterable<? extends OSPolicy.ResourceGroup> values)
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
      • clearResourceGroups

        public OSPolicy.Builder clearResourceGroups()
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
      • removeResourceGroups

        public OSPolicy.Builder removeResourceGroups​(int index)
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
      • getResourceGroupsBuilder

        public OSPolicy.ResourceGroup.Builder getResourceGroupsBuilder​(int index)
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
      • getResourceGroupsOrBuilder

        public OSPolicy.ResourceGroupOrBuilder getResourceGroupsOrBuilder​(int index)
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getResourceGroupsOrBuilder in interface OSPolicyOrBuilder
      • getResourceGroupsOrBuilderList

        public List<? extends OSPolicy.ResourceGroupOrBuilder> getResourceGroupsOrBuilderList()
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getResourceGroupsOrBuilderList in interface OSPolicyOrBuilder
      • addResourceGroupsBuilder

        public OSPolicy.ResourceGroup.Builder addResourceGroupsBuilder()
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
      • addResourceGroupsBuilder

        public OSPolicy.ResourceGroup.Builder addResourceGroupsBuilder​(int index)
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
      • getResourceGroupsBuilderList

        public List<OSPolicy.ResourceGroup.Builder> getResourceGroupsBuilderList()
         Required. List of resource groups for the policy.
         For a particular VM, resource groups are evaluated in the order specified
         and the first resource group that is applicable is selected and the rest
         are ignored.
        
         If none of the resource groups are applicable for a VM, the VM is
         considered to be non-compliant w.r.t this policy. This behavior can be
         toggled by the flag `allow_no_resource_group_match`
         
        repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];
      • getAllowNoResourceGroupMatch

        public boolean getAllowNoResourceGroupMatch()
         This flag determines the OS policy compliance status when none of the
         resource groups within the policy are applicable for a VM. Set this value
         to `true` if the policy needs to be reported as compliant even if the
         policy has nothing to validate or enforce.
         
        bool allow_no_resource_group_match = 5;
        Specified by:
        getAllowNoResourceGroupMatch in interface OSPolicyOrBuilder
        Returns:
        The allowNoResourceGroupMatch.
      • setAllowNoResourceGroupMatch

        public OSPolicy.Builder setAllowNoResourceGroupMatch​(boolean value)
         This flag determines the OS policy compliance status when none of the
         resource groups within the policy are applicable for a VM. Set this value
         to `true` if the policy needs to be reported as compliant even if the
         policy has nothing to validate or enforce.
         
        bool allow_no_resource_group_match = 5;
        Parameters:
        value - The allowNoResourceGroupMatch to set.
        Returns:
        This builder for chaining.
      • clearAllowNoResourceGroupMatch

        public OSPolicy.Builder clearAllowNoResourceGroupMatch()
         This flag determines the OS policy compliance status when none of the
         resource groups within the policy are applicable for a VM. Set this value
         to `true` if the policy needs to be reported as compliant even if the
         policy has nothing to validate or enforce.
         
        bool allow_no_resource_group_match = 5;
        Returns:
        This builder for chaining.
      • setUnknownFields

        public final OSPolicy.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<OSPolicy.Builder>
      • mergeUnknownFields

        public final OSPolicy.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<OSPolicy.Builder>