Skip to content
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
import static io.confluent.kafka.schemaregistry.utils.QualifiedSubject.DEFAULT_TENANT;

import com.google.common.base.Ticker;
import io.confluent.kafka.schemaregistry.client.rest.entities.Association;
import io.confluent.kafka.schemaregistry.client.rest.entities.Config;
import io.confluent.kafka.schemaregistry.client.rest.entities.Metadata;
import io.confluent.kafka.schemaregistry.client.rest.entities.RuleSet;
import io.confluent.kafka.schemaregistry.client.rest.entities.SchemaRegistryDeployment;
import io.confluent.kafka.schemaregistry.client.rest.entities.SchemaRegistryServerVersion;
import io.confluent.kafka.schemaregistry.client.rest.entities.requests.AssociationCreateRequest;
import io.confluent.kafka.schemaregistry.client.rest.entities.requests.AssociationResponse;
import io.confluent.kafka.schemaregistry.client.rest.entities.requests.RegisterSchemaResponse;
import java.io.Closeable;
import java.io.IOException;
Expand Down Expand Up @@ -403,4 +406,33 @@ public default Integer deleteSchemaVersion(

@Override
default void close() throws IOException {}

public default AssociationResponse createAssociation(AssociationCreateRequest request)
throws IOException, RestClientException {
throw new UnsupportedOperationException();
}

public default List<Association> getAssociationsBySubject(String subject,
String resourceType,
List<String> associationTypes,
String lifecycle,
int offset, int limit)
throws IOException, RestClientException {
throw new UnsupportedOperationException();
}

public default List<Association> getAssociationsByResourceId(String resourceId,
String resourceType,
List<String> associationTypes,
String lifecycle,
int offset, int limit)
throws IOException, RestClientException {
throw new UnsupportedOperationException();
}

public default void deleteAssociations(String resourceId, String resourceType,
List<String> associationTypes, boolean cascadeLifecycle)
throws IOException, RestClientException {
throw new UnsupportedOperationException();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
/*
* Copyright 2025 Confluent Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.confluent.kafka.schemaregistry.client.rest.entities;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.confluent.kafka.schemaregistry.client.rest.entities.requests.AssociationCreateInfo;
import io.confluent.kafka.schemaregistry.client.rest.entities.requests.AssociationUpdateInfo;
import java.util.Objects;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Association {

private String subject;
private String guid;
private String resourceName;
private String resourceNamespace;
private String resourceId;
private String resourceType;
private String associationType;
private LifecyclePolicy lifecycle;
private boolean frozen;

@JsonCreator
public Association(@JsonProperty("subject") String subject,
@JsonProperty("guid") String guid,
@JsonProperty("resourceName") String resourceName,
@JsonProperty("resourceNamespace") String resourceNamespace,
@JsonProperty("resourceId") String resourceId,
@JsonProperty("resourceType") String resourceType,
@JsonProperty("associationType") String associationType,
@JsonProperty("lifecycle") LifecyclePolicy lifecycle,
@JsonProperty("frozen") boolean frozen) {
this.subject = subject;
this.guid = guid;
this.resourceName = resourceName;
this.resourceNamespace = resourceNamespace;
this.resourceId = resourceId;
this.resourceType = resourceType;
this.associationType = associationType;
this.lifecycle = lifecycle;
this.frozen = frozen;
}

@JsonProperty("subject")
public String getSubject() {
return subject;
}

@JsonProperty("subject")
public void setSubject(String subject) {
this.subject = subject;
}

@JsonProperty("guid")
public String getGuid() {
return guid;
}

@JsonProperty("guid")
public void setGuid(String guid) {
this.guid = guid;
}

@JsonProperty("resourceName")
public String getResourceName() {
return resourceName;
}

@JsonProperty("resourceName")
public void setResourceName(String resourceName) {
this.resourceName = resourceName;
}

@JsonProperty("resourceNamespace")
public String getResourceNamespace() {
return resourceNamespace;
}

@JsonProperty("resourceNamespace")
public void setResourceNamespace(String resourceNamespace) {
this.resourceNamespace = resourceNamespace;
}

@JsonProperty("resourceId")
public String getResourceId() {
return resourceId;
}

@JsonProperty("resourceId")
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}

@JsonProperty("resourceType")
public String getResourceType() {
return resourceType;
}

@JsonProperty("resourceType")
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}

@JsonProperty("associationType")
public String getAssociationType() {
return associationType;
}

@JsonProperty("associationType")
public void setAssociationType(String associationType) {
this.associationType = associationType;
}

@JsonProperty("lifecycle")
public LifecyclePolicy getLifecycle() {
return lifecycle;
}

@JsonProperty("lifecycle")
public void setLifecycle(LifecyclePolicy lifecycle) {
this.lifecycle = lifecycle;
}

@JsonProperty("frozen")
public boolean isFrozen() {
return frozen;
}

@JsonProperty("frozen")
public void setFrozen(boolean frozen) {
this.frozen = frozen;
}

@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
Association that = (Association) o;
return frozen == that.frozen
&& Objects.equals(subject, that.subject)
&& Objects.equals(guid, that.guid)
&& Objects.equals(resourceName, that.resourceName)
&& Objects.equals(resourceNamespace, that.resourceNamespace)
&& Objects.equals(resourceId, that.resourceId)
&& Objects.equals(resourceType, that.resourceType)
&& Objects.equals(associationType, that.associationType)
&& lifecycle == that.lifecycle;
}

@Override
public int hashCode() {
return Objects.hash(
subject, guid, resourceName, resourceNamespace, resourceId,
resourceType, associationType, lifecycle, frozen);
}

public boolean isEquivalent(AssociationCreateInfo info) {
return Objects.equals(subject, info.getSubject())
&& Objects.equals(associationType, info.getAssociationType())
&& lifecycle == info.getLifecycle()
&& frozen == info.isFrozen();
}

public boolean isEquivalent(AssociationUpdateInfo info) {
boolean associationTypeEquals = Objects.equals(associationType, info.getAssociationType());
boolean lifecycleEquals = info.getLifecycle().isEmpty()
|| info.getLifecycle().get() == getLifecycle();
boolean frozenEquals = info.getFrozen().isEmpty() || info.getFrozen().get() == isFrozen();
return associationTypeEquals && lifecycleEquals && frozenEquals;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2025 Confluent Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.confluent.kafka.schemaregistry.client.rest.entities;

public enum LifecyclePolicy {
STRONG,
WEAK
}
Loading
Loading