// Module included in the following assemblies: // // * operators/operator_sdk/java/osdk-java-tutorial.adoc :_mod-docs-content-type: PROCEDURE [id="osdk-java-define-api_{context}"] = Defining the API Define the API for the `Memcached` custom resource (CR). .Procedure * Edit the following files that were generated as part of the `create api` process: .. Update the following attributes in the `MemcachedSpec.java` file to define the desired state of the `Memcached` CR: + [source,java] ---- public class MemcachedSpec { private Integer size; public Integer getSize() { return size; } public void setSize(Integer size) { this.size = size; } } ---- .. Update the following attributes in the `MemcachedStatus.java` file to define the observed state of the `Memcached` CR: + [NOTE] ==== The example below illustrates a Node status field. It is recommended that you use link:https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties[typical status properties] in practice. ==== + [source,java] ---- import java.util.ArrayList; import java.util.List; public class MemcachedStatus { // Add Status information here // Nodes are the names of the memcached pods private List nodes; public List getNodes() { if (nodes == null) { nodes = new ArrayList<>(); } return nodes; } public void setNodes(List nodes) { this.nodes = nodes; } } ---- .. Update the `Memcached.java` file to define the Schema for Memcached APIs that extends to both `MemcachedSpec.java` and `MemcachedStatus.java` files. + [source,java] ---- @Version("v1") @Group("cache.example.com") public class Memcached extends CustomResource implements Namespaced {} ----