All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nstream.adapter.dynamodb.DynamoDbEgressSettings Maven / Gradle / Ivy

// Copyright 2015-2023 Nstream, inc.
//
// Licensed under the Redis Source Available License 2.0 (RSALv2) Agreement;
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://redis.com/legal/rsalv2-agreement/
//
// 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 nstream.adapter.dynamodb;

import nstream.adapter.common.AdapterSettings;
import swim.codec.Format;
import swim.codec.Output;
import swim.structure.Form;
import swim.structure.Kind;
import swim.structure.Tag;

/**
 * Provides a concrete class to parse and store agent configuration
 * used for DynamoDB egress by {@link DynamoDbPublishingAgent}.
 *
 * @see DynamoDbPublishingAgent
 */
@Tag("dynamoDbEgressSettings")
public class DynamoDbEgressSettings implements AdapterSettings {

  private final String clientProvisionName;
  private final String table;

  public DynamoDbEgressSettings(final String clientProvisionName,
                               final String table) {
    this.clientProvisionName = clientProvisionName;
    this.table = table;
  }

  public DynamoDbEgressSettings() {
    this("dynamoClientProvision", null);
  }

  /**
   * Name of dynamo client provision to be used for publication.
   *
   * @return the client provision name
   */
  public String clientProvisionName() {
    return this.clientProvisionName;
  }

  /**
   * DynamoDB table name to publish to.
   *
   * @return the database name
   */
  public String table() {
    return this.table;
  }

  @Override
  public  Output debug(Output output) {
    output = output.write("DynamoDbEgressSettings").write('.').write("of").write('(').write(')')
        .write('.').write("clientProvisionName").write('(').debug(this.clientProvisionName).write(')')
        .write('.').write("table").write('(').debug(this.table).write(')');

    return output;
  }

  @Override
  public String toString() {
    return Format.debug(this);
  }

  @Kind
  private static Form form;

  private static final DynamoDbEgressSettings DEFAULT = new DynamoDbEgressSettings();

  public static Form form() {
    if (DynamoDbEgressSettings.form == null) {
      DynamoDbEgressSettings.form = Form.forClass(DynamoDbEgressSettings.class);
    }
    return DynamoDbEgressSettings.form;
  }

  public static DynamoDbEgressSettings defaultSettings() {
    return DynamoDbEgressSettings.DEFAULT;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy