public Builder mergeFrom(com.google.logging.v2.LogExclusion other) { if (other == com.google.logging.v2.LogExclusion.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getDescription().isEmpty()) { description_ = other.description_; onChanged(); } if (!other.getFilter().isEmpty()) { filter_ = other.filter_; onChanged(); } if (other.getDisabled() != false) { setDisabled(other.getDisabled()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@java.lang.Override public com.google.logging.v2.LogExclusion buildPartial() { com.google.logging.v2.LogExclusion result = new com.google.logging.v2.LogExclusion(this); result.name_ = name_; result.description_ = description_; result.filter_ = filter_; result.disabled_ = disabled_; onBuilt(); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.logging.v2.LogExclusion)) { return super.equals(obj); } com.google.logging.v2.LogExclusion other = (com.google.logging.v2.LogExclusion) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && getDescription().equals(other.getDescription()); result = result && getFilter().equals(other.getFilter()); result = result && (getDisabled() == other.getDisabled()); result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * Optional. A description of this exclusion. * </pre> * * <code>string description = 2;</code> */ public Builder clearDescription() { description_ = getDefaultInstance().getDescription(); onChanged(); return this; } /**
/** * * * <pre> * Required. A client-assigned identifier, such as * `"load-balancer-exclusion"`. Identifiers are limited to 100 characters and * can include only letters, digits, underscores, hyphens, and periods. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
@java.lang.Override public com.google.logging.v2.LogExclusion getDefaultInstanceForType() { return com.google.logging.v2.LogExclusion.getDefaultInstance(); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (!getDescriptionBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, description_); } if (!getFilterBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, filter_); } if (disabled_ != false) { output.writeBool(4, disabled_); } unknownFields.writeTo(output); }
/** * * * <pre> * Required. * An [advanced logs filter](/logging/docs/view/advanced_filters) * that matches the log entries to be excluded. By using the * [sample function](/logging/docs/view/advanced_filters#sample), * you can exclude less than 100% of the matching log entries. * For example, the following filter matches 99% of low-severity log * entries from load balancers: * `"resource.type=http_load_balancer severity<ERROR sample(insertId, 0.99)"` * </pre> * * <code>string filter = 3;</code> */ public Builder clearFilter() { filter_ = getDefaultInstance().getFilter(); onChanged(); return this; } /**
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.logging.v2.CreateExclusionRequest)) { return super.equals(obj); } com.google.logging.v2.CreateExclusionRequest other = (com.google.logging.v2.CreateExclusionRequest) obj; boolean result = true; result = result && getParent().equals(other.getParent()); result = result && (hasExclusion() == other.hasExclusion()); if (hasExclusion()) { result = result && getExclusion().equals(other.getExclusion()); } result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * Required. New values for the existing exclusion. Only the fields specified * in `update_mask` are relevant. * </pre> * * <code>.google.logging.v2.LogExclusion exclusion = 2;</code> */ public com.google.logging.v2.LogExclusion getExclusion() { return exclusion_ == null ? com.google.logging.v2.LogExclusion.getDefaultInstance() : exclusion_; } /**
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } if (!getDescriptionBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, description_); } if (!getFilterBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, filter_); } if (disabled_ != false) { size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, disabled_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.logging.v2.UpdateExclusionRequest)) { return super.equals(obj); } com.google.logging.v2.UpdateExclusionRequest other = (com.google.logging.v2.UpdateExclusionRequest) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && (hasExclusion() == other.hasExclusion()); if (hasExclusion()) { result = result && getExclusion().equals(other.getExclusion()); } result = result && (hasUpdateMask() == other.hasUpdateMask()); if (hasUpdateMask()) { result = result && getUpdateMask().equals(other.getUpdateMask()); } result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; hash = (53 * hash) + getDescription().hashCode(); hash = (37 * hash) + FILTER_FIELD_NUMBER; hash = (53 * hash) + getFilter().hashCode(); hash = (37 * hash) + DISABLED_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getDisabled()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * Required. The new exclusion, whose `name` parameter is an exclusion name * that is not already used in the parent resource. * </pre> * * <code>.google.logging.v2.LogExclusion exclusion = 2;</code> */ public com.google.logging.v2.LogExclusion getExclusion() { return exclusion_ == null ? com.google.logging.v2.LogExclusion.getDefaultInstance() : exclusion_; } /**
/** * * * <pre> * Required. The new exclusion, whose `name` parameter is an exclusion name * that is not already used in the parent resource. * </pre> * * <code>.google.logging.v2.LogExclusion exclusion = 2;</code> */ public Builder mergeExclusion(com.google.logging.v2.LogExclusion value) { if (exclusionBuilder_ == null) { if (exclusion_ != null) { exclusion_ = com.google.logging.v2.LogExclusion.newBuilder(exclusion_) .mergeFrom(value) .buildPartial(); } else { exclusion_ = value; } onChanged(); } else { exclusionBuilder_.mergeFrom(value); } return this; } /**
/** * * * <pre> * Required. The new exclusion, whose `name` parameter is an exclusion name * that is not already used in the parent resource. * </pre> * * <code>.google.logging.v2.LogExclusion exclusion = 2;</code> */ public com.google.logging.v2.LogExclusion getExclusion() { if (exclusionBuilder_ == null) { return exclusion_ == null ? com.google.logging.v2.LogExclusion.getDefaultInstance() : exclusion_; } else { return exclusionBuilder_.getMessage(); } } /**
/** * * * <pre> * Required. New values for the existing exclusion. Only the fields specified * in `update_mask` are relevant. * </pre> * * <code>.google.logging.v2.LogExclusion exclusion = 2;</code> */ public Builder mergeExclusion(com.google.logging.v2.LogExclusion value) { if (exclusionBuilder_ == null) { if (exclusion_ != null) { exclusion_ = com.google.logging.v2.LogExclusion.newBuilder(exclusion_) .mergeFrom(value) .buildPartial(); } else { exclusion_ = value; } onChanged(); } else { exclusionBuilder_.mergeFrom(value); } return this; } /**
/** * * * <pre> * Required. New values for the existing exclusion. Only the fields specified * in `update_mask` are relevant. * </pre> * * <code>.google.logging.v2.LogExclusion exclusion = 2;</code> */ public com.google.logging.v2.LogExclusion getExclusion() { if (exclusionBuilder_ == null) { return exclusion_ == null ? com.google.logging.v2.LogExclusion.getDefaultInstance() : exclusion_; } else { return exclusionBuilder_.getMessage(); } } /**
@Test @SuppressWarnings("all") public void createExclusionExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockConfigServiceV2.addException(exception); try { ParentName parent = ProjectName.of("[PROJECT]"); LogExclusion exclusion = LogExclusion.newBuilder().build(); client.createExclusion(parent, exclusion); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception } }