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

org.apache.gobblin.http.HttpOperation Maven / Gradle / Ivy

/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package org.apache.gobblin.http;

import org.apache.avro.specific.SpecificData;

@SuppressWarnings("all")
/** Represents an operation to be performed over http */
@org.apache.avro.specific.AvroGenerated
public class HttpOperation extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = 7490946453649230552L;
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"HttpOperation\",\"namespace\":\"org.apache.gobblin.http\",\"doc\":\"Represents an operation to be performed over http\",\"fields\":[{\"name\":\"keys\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"},\"doc\":\"Key of the resource on which the operation is executed. Complex key resources are identified by more than one key. Hence this field is a map as opposed to a string. The map is used to interpolate the url template in job spec.\",\"default\":{}},{\"name\":\"queryParams\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"},\"doc\":\"query parameters.\",\"default\":{}},{\"name\":\"headers\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"},\"doc\":\"header key/value pairs.\",\"default\":{}},{\"name\":\"body\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"body of the http request. It must be either a plain string or a json string.\",\"default\":\"\"}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  /** Key of the resource on which the operation is executed. Complex key resources are identified by more than one key. Hence this field is a map as opposed to a string. The map is used to interpolate the url template in job spec. */
  @Deprecated public java.util.Map keys;
  /** query parameters. */
  @Deprecated public java.util.Map queryParams;
  /** header key/value pairs. */
  @Deprecated public java.util.Map headers;
  /** body of the http request. It must be either a plain string or a json string. */
  @Deprecated public java.lang.String body;

  /**
   * Default constructor.  Note that this does not initialize fields
   * to their default values from the schema.  If that is desired then
   * one should use newBuilder().
   */
  public HttpOperation() {}

  /**
   * All-args constructor.
   * @param keys Key of the resource on which the operation is executed. Complex key resources are identified by more than one key. Hence this field is a map as opposed to a string. The map is used to interpolate the url template in job spec.
   * @param queryParams query parameters.
   * @param headers header key/value pairs.
   * @param body body of the http request. It must be either a plain string or a json string.
   */
  public HttpOperation(java.util.Map keys, java.util.Map queryParams, java.util.Map headers, java.lang.String body) {
    this.keys = keys;
    this.queryParams = queryParams;
    this.headers = headers;
    this.body = body;
  }

  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
  // Used by DatumWriter.  Applications should not call.
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return keys;
    case 1: return queryParams;
    case 2: return headers;
    case 3: return body;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  // Used by DatumReader.  Applications should not call.
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: keys = (java.util.Map)value$; break;
    case 1: queryParams = (java.util.Map)value$; break;
    case 2: headers = (java.util.Map)value$; break;
    case 3: body = (java.lang.String)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'keys' field.
   * @return Key of the resource on which the operation is executed. Complex key resources are identified by more than one key. Hence this field is a map as opposed to a string. The map is used to interpolate the url template in job spec.
   */
  public java.util.Map getKeys() {
    return keys;
  }

  /**
   * Sets the value of the 'keys' field.
   * Key of the resource on which the operation is executed. Complex key resources are identified by more than one key. Hence this field is a map as opposed to a string. The map is used to interpolate the url template in job spec.
   * @param value the value to set.
   */
  public void setKeys(java.util.Map value) {
    this.keys = value;
  }

  /**
   * Gets the value of the 'queryParams' field.
   * @return query parameters.
   */
  public java.util.Map getQueryParams() {
    return queryParams;
  }

  /**
   * Sets the value of the 'queryParams' field.
   * query parameters.
   * @param value the value to set.
   */
  public void setQueryParams(java.util.Map value) {
    this.queryParams = value;
  }

  /**
   * Gets the value of the 'headers' field.
   * @return header key/value pairs.
   */
  public java.util.Map getHeaders() {
    return headers;
  }

  /**
   * Sets the value of the 'headers' field.
   * header key/value pairs.
   * @param value the value to set.
   */
  public void setHeaders(java.util.Map value) {
    this.headers = value;
  }

  /**
   * Gets the value of the 'body' field.
   * @return body of the http request. It must be either a plain string or a json string.
   */
  public java.lang.String getBody() {
    return body;
  }

  /**
   * Sets the value of the 'body' field.
   * body of the http request. It must be either a plain string or a json string.
   * @param value the value to set.
   */
  public void setBody(java.lang.String value) {
    this.body = value;
  }

  /**
   * Creates a new HttpOperation RecordBuilder.
   * @return A new HttpOperation RecordBuilder
   */
  public static org.apache.gobblin.http.HttpOperation.Builder newBuilder() {
    return new org.apache.gobblin.http.HttpOperation.Builder();
  }

  /**
   * Creates a new HttpOperation RecordBuilder by copying an existing Builder.
   * @param other The existing builder to copy.
   * @return A new HttpOperation RecordBuilder
   */
  public static org.apache.gobblin.http.HttpOperation.Builder newBuilder(org.apache.gobblin.http.HttpOperation.Builder other) {
    return new org.apache.gobblin.http.HttpOperation.Builder(other);
  }

  /**
   * Creates a new HttpOperation RecordBuilder by copying an existing HttpOperation instance.
   * @param other The existing instance to copy.
   * @return A new HttpOperation RecordBuilder
   */
  public static org.apache.gobblin.http.HttpOperation.Builder newBuilder(org.apache.gobblin.http.HttpOperation other) {
    return new org.apache.gobblin.http.HttpOperation.Builder(other);
  }

  /**
   * RecordBuilder for HttpOperation instances.
   */
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
    implements org.apache.avro.data.RecordBuilder {

    /** Key of the resource on which the operation is executed. Complex key resources are identified by more than one key. Hence this field is a map as opposed to a string. The map is used to interpolate the url template in job spec. */
    private java.util.Map keys;
    /** query parameters. */
    private java.util.Map queryParams;
    /** header key/value pairs. */
    private java.util.Map headers;
    /** body of the http request. It must be either a plain string or a json string. */
    private java.lang.String body;

    /** Creates a new Builder */
    private Builder() {
      super(SCHEMA$);
    }

    /**
     * Creates a Builder by copying an existing Builder.
     * @param other The existing Builder to copy.
     */
    private Builder(org.apache.gobblin.http.HttpOperation.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.keys)) {
        this.keys = data().deepCopy(fields()[0].schema(), other.keys);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.queryParams)) {
        this.queryParams = data().deepCopy(fields()[1].schema(), other.queryParams);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.headers)) {
        this.headers = data().deepCopy(fields()[2].schema(), other.headers);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.body)) {
        this.body = data().deepCopy(fields()[3].schema(), other.body);
        fieldSetFlags()[3] = true;
      }
    }

    /**
     * Creates a Builder by copying an existing HttpOperation instance
     * @param other The existing instance to copy.
     */
    private Builder(org.apache.gobblin.http.HttpOperation other) {
            super(SCHEMA$);
      if (isValidValue(fields()[0], other.keys)) {
        this.keys = data().deepCopy(fields()[0].schema(), other.keys);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.queryParams)) {
        this.queryParams = data().deepCopy(fields()[1].schema(), other.queryParams);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.headers)) {
        this.headers = data().deepCopy(fields()[2].schema(), other.headers);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.body)) {
        this.body = data().deepCopy(fields()[3].schema(), other.body);
        fieldSetFlags()[3] = true;
      }
    }

    /**
      * Gets the value of the 'keys' field.
      * Key of the resource on which the operation is executed. Complex key resources are identified by more than one key. Hence this field is a map as opposed to a string. The map is used to interpolate the url template in job spec.
      * @return The value.
      */
    public java.util.Map getKeys() {
      return keys;
    }

    /**
      * Sets the value of the 'keys' field.
      * Key of the resource on which the operation is executed. Complex key resources are identified by more than one key. Hence this field is a map as opposed to a string. The map is used to interpolate the url template in job spec.
      * @param value The value of 'keys'.
      * @return This builder.
      */
    public org.apache.gobblin.http.HttpOperation.Builder setKeys(java.util.Map value) {
      validate(fields()[0], value);
      this.keys = value;
      fieldSetFlags()[0] = true;
      return this;
    }

    /**
      * Checks whether the 'keys' field has been set.
      * Key of the resource on which the operation is executed. Complex key resources are identified by more than one key. Hence this field is a map as opposed to a string. The map is used to interpolate the url template in job spec.
      * @return True if the 'keys' field has been set, false otherwise.
      */
    public boolean hasKeys() {
      return fieldSetFlags()[0];
    }


    /**
      * Clears the value of the 'keys' field.
      * Key of the resource on which the operation is executed. Complex key resources are identified by more than one key. Hence this field is a map as opposed to a string. The map is used to interpolate the url template in job spec.
      * @return This builder.
      */
    public org.apache.gobblin.http.HttpOperation.Builder clearKeys() {
      keys = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /**
      * Gets the value of the 'queryParams' field.
      * query parameters.
      * @return The value.
      */
    public java.util.Map getQueryParams() {
      return queryParams;
    }

    /**
      * Sets the value of the 'queryParams' field.
      * query parameters.
      * @param value The value of 'queryParams'.
      * @return This builder.
      */
    public org.apache.gobblin.http.HttpOperation.Builder setQueryParams(java.util.Map value) {
      validate(fields()[1], value);
      this.queryParams = value;
      fieldSetFlags()[1] = true;
      return this;
    }

    /**
      * Checks whether the 'queryParams' field has been set.
      * query parameters.
      * @return True if the 'queryParams' field has been set, false otherwise.
      */
    public boolean hasQueryParams() {
      return fieldSetFlags()[1];
    }


    /**
      * Clears the value of the 'queryParams' field.
      * query parameters.
      * @return This builder.
      */
    public org.apache.gobblin.http.HttpOperation.Builder clearQueryParams() {
      queryParams = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /**
      * Gets the value of the 'headers' field.
      * header key/value pairs.
      * @return The value.
      */
    public java.util.Map getHeaders() {
      return headers;
    }

    /**
      * Sets the value of the 'headers' field.
      * header key/value pairs.
      * @param value The value of 'headers'.
      * @return This builder.
      */
    public org.apache.gobblin.http.HttpOperation.Builder setHeaders(java.util.Map value) {
      validate(fields()[2], value);
      this.headers = value;
      fieldSetFlags()[2] = true;
      return this;
    }

    /**
      * Checks whether the 'headers' field has been set.
      * header key/value pairs.
      * @return True if the 'headers' field has been set, false otherwise.
      */
    public boolean hasHeaders() {
      return fieldSetFlags()[2];
    }


    /**
      * Clears the value of the 'headers' field.
      * header key/value pairs.
      * @return This builder.
      */
    public org.apache.gobblin.http.HttpOperation.Builder clearHeaders() {
      headers = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    /**
      * Gets the value of the 'body' field.
      * body of the http request. It must be either a plain string or a json string.
      * @return The value.
      */
    public java.lang.String getBody() {
      return body;
    }

    /**
      * Sets the value of the 'body' field.
      * body of the http request. It must be either a plain string or a json string.
      * @param value The value of 'body'.
      * @return This builder.
      */
    public org.apache.gobblin.http.HttpOperation.Builder setBody(java.lang.String value) {
      validate(fields()[3], value);
      this.body = value;
      fieldSetFlags()[3] = true;
      return this;
    }

    /**
      * Checks whether the 'body' field has been set.
      * body of the http request. It must be either a plain string or a json string.
      * @return True if the 'body' field has been set, false otherwise.
      */
    public boolean hasBody() {
      return fieldSetFlags()[3];
    }


    /**
      * Clears the value of the 'body' field.
      * body of the http request. It must be either a plain string or a json string.
      * @return This builder.
      */
    public org.apache.gobblin.http.HttpOperation.Builder clearBody() {
      body = null;
      fieldSetFlags()[3] = false;
      return this;
    }

    @Override
    public HttpOperation build() {
      try {
        HttpOperation record = new HttpOperation();
        record.keys = fieldSetFlags()[0] ? this.keys : (java.util.Map) defaultValue(fields()[0]);
        record.queryParams = fieldSetFlags()[1] ? this.queryParams : (java.util.Map) defaultValue(fields()[1]);
        record.headers = fieldSetFlags()[2] ? this.headers : (java.util.Map) defaultValue(fields()[2]);
        record.body = fieldSetFlags()[3] ? this.body : (java.lang.String) defaultValue(fields()[3]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }

  private static final org.apache.avro.io.DatumWriter
    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);

  @Override public void writeExternal(java.io.ObjectOutput out)
    throws java.io.IOException {
    WRITER$.write(this, SpecificData.getEncoder(out));
  }

  private static final org.apache.avro.io.DatumReader
    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);

  @Override public void readExternal(java.io.ObjectInput in)
    throws java.io.IOException {
    READER$.read(this, SpecificData.getDecoder(in));
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy