private Cluster(@Nonnull com.google.bigtable.admin.v2.Cluster proto) { Preconditions.checkNotNull(proto); Preconditions.checkArgument(!proto.getName().isEmpty(), "Name must be set"); this.stateProto = proto; }
@Override public Map<String, String> extract(Cluster request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put("name", String.valueOf(request.getName())); return params.build(); } })
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.bigtable.admin.v2.Cluster)) { return super.equals(obj); } com.google.bigtable.admin.v2.Cluster other = (com.google.bigtable.admin.v2.Cluster) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && getLocation().equals(other.getLocation()); result = result && state_ == other.state_; result = result && (getServeNodes() == other.getServeNodes()); result = result && defaultStorageType_ == other.defaultStorageType_; 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) + LOCATION_FIELD_NUMBER; hash = (53 * hash) + getLocation().hashCode(); hash = (37 * hash) + STATE_FIELD_NUMBER; hash = (53 * hash) + state_; hash = (37 * hash) + SERVE_NODES_FIELD_NUMBER; hash = (53 * hash) + getServeNodes(); hash = (37 * hash) + DEFAULT_STORAGE_TYPE_FIELD_NUMBER; hash = (53 * hash) + defaultStorageType_; hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * (`OutputOnly`) * The unique name of the cluster. Values are of the form * `projects/<project>/instances/<instance>/clusters/[a-z][-a-z0-9]*`. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
/** Gets the cluster's id. */ @SuppressWarnings("WeakerAccess") public String getId() { // Constructor ensures that name is not null ClusterName fullName = Verify.verifyNotNull(ClusterName.parse(stateProto.getName()), "Name can never be null"); //noinspection ConstantConditions return fullName.getCluster(); }
/** Gets the instance id. */ @SuppressWarnings("WeakerAccess") public String getInstanceId() { // Constructor ensures that name is not null ClusterName fullName = Verify.verifyNotNull(ClusterName.parse(stateProto.getName()), "Name can never be null"); //noinspection ConstantConditions return fullName.getInstance(); }
public Builder mergeFrom(com.google.bigtable.admin.v2.Cluster other) { if (other == com.google.bigtable.admin.v2.Cluster.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getLocation().isEmpty()) { location_ = other.location_; onChanged(); } if (other.state_ != 0) { setStateValue(other.getStateValue()); } if (other.getServeNodes() != 0) { setServeNodes(other.getServeNodes()); } if (other.defaultStorageType_ != 0) { setDefaultStorageTypeValue(other.getDefaultStorageTypeValue()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Override public Map<String, String> extract(Cluster request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put("name", String.valueOf(request.getName())); return params.build(); } })
private Cluster(@Nonnull com.google.bigtable.admin.v2.Cluster proto) { Preconditions.checkNotNull(proto); Preconditions.checkArgument(!proto.getName().isEmpty(), "Name must be set"); this.stateProto = proto; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.bigtable.admin.v2.Cluster)) { return super.equals(obj); } com.google.bigtable.admin.v2.Cluster other = (com.google.bigtable.admin.v2.Cluster) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && getLocation().equals(other.getLocation()); result = result && state_ == other.state_; result = result && (getServeNodes() == other.getServeNodes()); result = result && defaultStorageType_ == other.defaultStorageType_; result = result && unknownFields.equals(other.unknownFields); return result; }
/** * Sets a cluster size to a specific size in an instance with a single cluster * @throws InterruptedException if the cluster is in the middle of updating, and an interrupt was * received */ public void setClusterSize(int newSize) throws InterruptedException { setClusterSize(getSingleCluster().getName(), newSize); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.bigtable.admin.v2.Cluster)) { return super.equals(obj); } com.google.bigtable.admin.v2.Cluster other = (com.google.bigtable.admin.v2.Cluster) obj; boolean result = true; result = result && getName() .equals(other.getName()); result = result && getLocation() .equals(other.getLocation()); result = result && state_ == other.state_; result = result && (getServeNodes() == other.getServeNodes()); result = result && defaultStorageType_ == other.defaultStorageType_; return result; }
/** * <pre> * (`OutputOnly`) * The unique name of the cluster. Values are of the form * `projects/<project>/instances/<instance>/clusters/[a-z][-a-z0-9]*`. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
/** * * * <pre> * (`OutputOnly`) * The unique name of the cluster. Values are of the form * `projects/<project>/instances/<instance>/clusters/[a-z][-a-z0-9]*`. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
/** Gets the cluster's id. */ @SuppressWarnings("WeakerAccess") public String getId() { // Constructor ensures that name is not null ClusterName fullName = Verify.verifyNotNull(ClusterName.parse(stateProto.getName()), "Name can never be null"); //noinspection ConstantConditions return fullName.getCluster(); }
/** Gets the instance id. */ @SuppressWarnings("WeakerAccess") public String getInstanceId() { // Constructor ensures that name is not null ClusterName fullName = Verify.verifyNotNull(ClusterName.parse(stateProto.getName()), "Name can never be null"); //noinspection ConstantConditions return fullName.getInstance(); }
/** * Snapshot operations need various aspects of a {@link BigtableClusterName}. This method gets a * clusterId from either a lookup (projectId and instanceId translate to a single clusterId when * an instance has only one cluster). */ public synchronized BigtableClusterName getClusterName() throws IOException { if (this.clusterName == null) { try (BigtableClusterUtilities util = new BigtableClusterUtilities(options)) { ListClustersResponse clusters = util.getClusters(); Preconditions.checkState(clusters.getClustersCount() == 1, String.format( "Project '%s' / Instance '%s' has %d clusters. There must be exactly 1 for this operation to work.", options.getProjectId(), options.getInstanceId(), clusters.getClustersCount())); clusterName = new BigtableClusterName(clusters.getClusters(0).getName()); } catch (GeneralSecurityException e) { throw new IOException("Could not get cluster Id.", e); } } return clusterName; }
/** * Constructor for the auto-scaler with the minimum required information: project and instance ids. * @param projectId * @param instanceId * @throws GeneralSecurityException * @throws IOException */ public MetricScaler(String projectId, String instanceId) throws GeneralSecurityException, IOException { clusterUtility = BigtableClusterUtilities.forInstance(projectId, instanceId); Cluster cluster = clusterUtility.getSingleCluster(); this.clusterId = new BigtableClusterName(cluster.getName()).getClusterId(); this.zoneId = BigtableClusterUtilities.getZoneId(cluster); // Instantiates a client metricServiceClient = MetricServiceClient.create(); projectName = ProjectName.create(projectId); }
public Builder mergeFrom(com.google.bigtable.admin.v2.Cluster other) { if (other == com.google.bigtable.admin.v2.Cluster.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getLocation().isEmpty()) { location_ = other.location_; onChanged(); } if (other.state_ != 0) { setStateValue(other.getStateValue()); } if (other.getServeNodes() != 0) { setServeNodes(other.getServeNodes()); } if (other.defaultStorageType_ != 0) { setDefaultStorageTypeValue(other.getDefaultStorageTypeValue()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }