Skip to content

Make metadata optional for GCS destination #2840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-05-13 01:19:32.866177",
"spec_repo_commit": "dc3b522f"
"regenerated": "2025-05-13 14:44:51.655200",
"spec_repo_commit": "46ac8482"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-05-13 01:19:32.881522",
"spec_repo_commit": "dc3b522f"
"regenerated": "2025-05-13 14:44:51.675293",
"spec_repo_commit": "46ac8482"
}
}
}
7 changes: 3 additions & 4 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24482,7 +24482,8 @@ components:
description: Optional prefix for object keys within the GCS bucket.
type: string
metadata:
description: Custom metadata key-value pairs added to each object.
description: Custom metadata to attach to each object uploaded to the GCS
bucket.
items:
$ref: '#/components/schemas/ObservabilityPipelineMetadataEntry'
type: array
Expand All @@ -24498,7 +24499,6 @@ components:
- auth
- storage_class
- acl
- metadata
type: object
ObservabilityPipelineGoogleCloudStorageDestinationAcl:
description: Access control list setting for objects written to the bucket.
Expand Down Expand Up @@ -24777,8 +24777,7 @@ components:
x-enum-varnames:
- LOGSTASH
ObservabilityPipelineMetadataEntry:
description: A custom metadata entry to attach to each object uploaded to the
GCS bucket.
description: A custom metadata entry.
properties:
name:
description: The metadata key.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class ObservabilityPipelineGoogleCloudStorageDestination {
private String keyPrefix;

public static final String JSON_PROPERTY_METADATA = "metadata";
private List<ObservabilityPipelineMetadataEntry> metadata = new ArrayList<>();
private List<ObservabilityPipelineMetadataEntry> metadata = null;

public static final String JSON_PROPERTY_STORAGE_CLASS = "storage_class";
private ObservabilityPipelineGoogleCloudStorageDestinationStorageClass storageClass;
Expand All @@ -76,8 +76,6 @@ public ObservabilityPipelineGoogleCloudStorageDestination(
@JsonProperty(required = true, value = JSON_PROPERTY_BUCKET) String bucket,
@JsonProperty(required = true, value = JSON_PROPERTY_ID) String id,
@JsonProperty(required = true, value = JSON_PROPERTY_INPUTS) List<String> inputs,
@JsonProperty(required = true, value = JSON_PROPERTY_METADATA)
List<ObservabilityPipelineMetadataEntry> metadata,
@JsonProperty(required = true, value = JSON_PROPERTY_STORAGE_CLASS)
ObservabilityPipelineGoogleCloudStorageDestinationStorageClass storageClass,
@JsonProperty(required = true, value = JSON_PROPERTY_TYPE)
Expand All @@ -89,7 +87,6 @@ public ObservabilityPipelineGoogleCloudStorageDestination(
this.bucket = bucket;
this.id = id;
this.inputs = inputs;
this.metadata = metadata;
this.storageClass = storageClass;
this.unparsed |= !storageClass.isValid();
this.type = type;
Expand Down Expand Up @@ -240,18 +237,22 @@ public ObservabilityPipelineGoogleCloudStorageDestination metadata(

public ObservabilityPipelineGoogleCloudStorageDestination addMetadataItem(
ObservabilityPipelineMetadataEntry metadataItem) {
if (this.metadata == null) {
this.metadata = new ArrayList<>();
}
this.metadata.add(metadataItem);
this.unparsed |= metadataItem.unparsed;
return this;
}

/**
* Custom metadata key-value pairs added to each object.
* Custom metadata to attach to each object uploaded to the GCS bucket.
*
* @return metadata
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_METADATA)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<ObservabilityPipelineMetadataEntry> getMetadata() {
return metadata;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.util.Map;
import java.util.Objects;

/** A custom metadata entry to attach to each object uploaded to the GCS bucket. */
/** A custom metadata entry. */
@JsonPropertyOrder({
ObservabilityPipelineMetadataEntry.JSON_PROPERTY_NAME,
ObservabilityPipelineMetadataEntry.JSON_PROPERTY_VALUE
Expand Down