/*
 * 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.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.firebaserules.v1;

/**
 * Service definition for FirebaseRules (v1).
 *
 * <p>
 * Creates and manages rules that determine when a Firebase Rules-enabled service should permit a request. 
 * </p>
 *
 * <p>
 * For more information about this service, see the
 * <a href="https://firebase.google.com/docs/storage/security" target="_blank">API Documentation</a>
 * </p>
 *
 * <p>
 * This service uses {@link FirebaseRulesRequestInitializer} to initialize global parameters via its
 * {@link Builder}.
 * </p>
 *
 * @since 1.3
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public class FirebaseRules extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient {

  // Note: Leave this static initializer at the top of the file.
  static {
    com.google.api.client.util.Preconditions.checkState(
        com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION == 1 &&
        (com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION >= 32 ||
        (com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION == 31 &&
        com.google.api.client.googleapis.GoogleUtils.BUGFIX_VERSION >= 1)),
        "You are currently running with version %s of google-api-client. " +
        "You need at least version 1.31.1 of google-api-client to run version " +
        "1.32.1 of the Firebase Rules API library.", com.google.api.client.googleapis.GoogleUtils.VERSION);
  }

  /**
   * The default encoded root URL of the service. This is determined when the library is generated
   * and normally should not be changed.
   *
   * @since 1.7
   */
  public static final String DEFAULT_ROOT_URL = "https://firebaserules.googleapis.com/";

  /**
   * The default encoded mTLS root URL of the service. This is determined when the library is generated
   * and normally should not be changed.
   *
   * @since 1.31
   */
  public static final String DEFAULT_MTLS_ROOT_URL = "https://firebaserules.mtls.googleapis.com/";

  /**
   * The default encoded service path of the service. This is determined when the library is
   * generated and normally should not be changed.
   *
   * @since 1.7
   */
  public static final String DEFAULT_SERVICE_PATH = "";

  /**
   * The default encoded batch path of the service. This is determined when the library is
   * generated and normally should not be changed.
   *
   * @since 1.23
   */
  public static final String DEFAULT_BATCH_PATH = "batch";

  /**
   * The default encoded base URL of the service. This is determined when the library is generated
   * and normally should not be changed.
   */
  public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH;

  /**
   * Constructor.
   *
   * <p>
   * Use {@link Builder} if you need to specify any of the optional parameters.
   * </p>
   *
   * @param transport HTTP transport, which should normally be:
   *        <ul>
   *        <li>Google App Engine:
   *        {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
   *        <li>Android: {@code newCompatibleTransport} from
   *        {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
   *        <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
   *        </li>
   *        </ul>
   * @param jsonFactory JSON factory, which may be:
   *        <ul>
   *        <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
   *        <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
   *        <li>Android Honeycomb or higher:
   *        {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
   *        </ul>
   * @param httpRequestInitializer HTTP request initializer or {@code null} for none
   * @since 1.7
   */
  public FirebaseRules(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
      com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
    this(new Builder(transport, jsonFactory, httpRequestInitializer));
  }

  /**
   * @param builder builder
   */
  FirebaseRules(Builder builder) {
    super(builder);
  }

  @Override
  protected void initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest<?> httpClientRequest) throws java.io.IOException {
    super.initialize(httpClientRequest);
  }

  /**
   * An accessor for creating requests from the Projects collection.
   *
   * <p>The typical use is:</p>
   * <pre>
   *   {@code FirebaseRules firebaserules = new FirebaseRules(...);}
   *   {@code FirebaseRules.Projects.List request = firebaserules.projects().list(parameters ...)}
   * </pre>
   *
   * @return the resource collection
   */
  public Projects projects() {
    return new Projects();
  }

  /**
   * The "projects" collection of methods.
   */
  public class Projects {

    /**
     * Test `Source` for syntactic and semantic correctness. Issues present, if any, will be returned to
     * the caller with a description, severity, and source location. The test method may be executed
     * with `Source` or a `Ruleset` name. Passing `Source` is useful for unit testing new rules. Passing
     * a `Ruleset` name is useful for regression testing an existing rule. The following is an example
     * of `Source` that permits users to upload images to a bucket bearing their user id and matching
     * the correct metadata: _*Example*_ // Users are allowed to subscribe and unsubscribe to the blog.
     * service firebase.storage { match /users/{userId}/images/{imageName} { allow write: if userId ==
     * request.auth.uid && (imageName.matches('*.png$') || imageName.matches('*.jpg$')) &&
     * resource.mimeType.matches('^image/') } }
     *
     * Create a request for the method "projects.test".
     *
     * This request holds the parameters needed by the firebaserules server.  After setting any optional
     * parameters, call the {@link Test#execute()} method to invoke the remote operation.
     *
     * @param name Required. Tests may either provide `source` or a `Ruleset` resource name. For tests against
     *        `source`, the resource name must refer to the project: Format: `projects/{project_id}` For
     *        tests against a `Ruleset`, this must be the `Ruleset` resource name: Format:
     *        `projects/{project_id}/rulesets/{ruleset_id}`
     * @param content the {@link com.google.api.services.firebaserules.v1.model.TestRulesetRequest}
     * @return the request
     */
    public Test test(java.lang.String name, com.google.api.services.firebaserules.v1.model.TestRulesetRequest content) throws java.io.IOException {
      Test result = new Test(name, content);
      initialize(result);
      return result;
    }

    public class Test extends FirebaseRulesRequest<com.google.api.services.firebaserules.v1.model.TestRulesetResponse> {

      private static final String REST_PATH = "v1/{+name}:test";

      private final java.util.regex.Pattern NAME_PATTERN =
          java.util.regex.Pattern.compile("^projects/.*$");

      /**
       * Test `Source` for syntactic and semantic correctness. Issues present, if any, will be returned
       * to the caller with a description, severity, and source location. The test method may be
       * executed with `Source` or a `Ruleset` name. Passing `Source` is useful for unit testing new
       * rules. Passing a `Ruleset` name is useful for regression testing an existing rule. The
       * following is an example of `Source` that permits users to upload images to a bucket bearing
       * their user id and matching the correct metadata: _*Example*_ // Users are allowed to subscribe
       * and unsubscribe to the blog. service firebase.storage { match
       * /users/{userId}/images/{imageName} { allow write: if userId == request.auth.uid &&
       * (imageName.matches('*.png$') || imageName.matches('*.jpg$')) &&
       * resource.mimeType.matches('^image/') } }
       *
       * Create a request for the method "projects.test".
       *
       * This request holds the parameters needed by the the firebaserules server.  After setting any
       * optional parameters, call the {@link Test#execute()} method to invoke the remote operation. <p>
       * {@link Test#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
       * must be called to initialize this instance immediately after invoking the constructor. </p>
       *
       * @param name Required. Tests may either provide `source` or a `Ruleset` resource name. For tests against
     *        `source`, the resource name must refer to the project: Format: `projects/{project_id}` For
     *        tests against a `Ruleset`, this must be the `Ruleset` resource name: Format:
     *        `projects/{project_id}/rulesets/{ruleset_id}`
       * @param content the {@link com.google.api.services.firebaserules.v1.model.TestRulesetRequest}
       * @since 1.13
       */
      protected Test(java.lang.String name, com.google.api.services.firebaserules.v1.model.TestRulesetRequest content) {
        super(FirebaseRules.this, "POST", REST_PATH, content, com.google.api.services.firebaserules.v1.model.TestRulesetResponse.class);
        this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
        if (!getSuppressPatternChecks()) {
          com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
              "Parameter name must conform to the pattern " +
              "^projects/.*$");
        }
      }

      @Override
      public Test set$Xgafv(java.lang.String $Xgafv) {
        return (Test) super.set$Xgafv($Xgafv);
      }

      @Override
      public Test setAccessToken(java.lang.String accessToken) {
        return (Test) super.setAccessToken(accessToken);
      }

      @Override
      public Test setAlt(java.lang.String alt) {
        return (Test) super.setAlt(alt);
      }

      @Override
      public Test setCallback(java.lang.String callback) {
        return (Test) super.setCallback(callback);
      }

      @Override
      public Test setFields(java.lang.String fields) {
        return (Test) super.setFields(fields);
      }

      @Override
      public Test setKey(java.lang.String key) {
        return (Test) super.setKey(key);
      }

      @Override
      public Test setOauthToken(java.lang.String oauthToken) {
        return (Test) super.setOauthToken(oauthToken);
      }

      @Override
      public Test setPrettyPrint(java.lang.Boolean prettyPrint) {
        return (Test) super.setPrettyPrint(prettyPrint);
      }

      @Override
      public Test setQuotaUser(java.lang.String quotaUser) {
        return (Test) super.setQuotaUser(quotaUser);
      }

      @Override
      public Test setUploadType(java.lang.String uploadType) {
        return (Test) super.setUploadType(uploadType);
      }

      @Override
      public Test setUploadProtocol(java.lang.String uploadProtocol) {
        return (Test) super.setUploadProtocol(uploadProtocol);
      }

      /**
       * Required. Tests may either provide `source` or a `Ruleset` resource name. For tests against
       * `source`, the resource name must refer to the project: Format: `projects/{project_id}` For
       * tests against a `Ruleset`, this must be the `Ruleset` resource name: Format:
       * `projects/{project_id}/rulesets/{ruleset_id}`
       */
      @com.google.api.client.util.Key
      private java.lang.String name;

      /** Required. Tests may either provide `source` or a `Ruleset` resource name. For tests against
     `source`, the resource name must refer to the project: Format: `projects/{project_id}` For tests
     against a `Ruleset`, this must be the `Ruleset` resource name: Format:
     `projects/{project_id}/rulesets/{ruleset_id}`
       */
      public java.lang.String getName() {
        return name;
      }

      /**
       * Required. Tests may either provide `source` or a `Ruleset` resource name. For tests against
       * `source`, the resource name must refer to the project: Format: `projects/{project_id}` For
       * tests against a `Ruleset`, this must be the `Ruleset` resource name: Format:
       * `projects/{project_id}/rulesets/{ruleset_id}`
       */
      public Test setName(java.lang.String name) {
        if (!getSuppressPatternChecks()) {
          com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
              "Parameter name must conform to the pattern " +
              "^projects/.*$");
        }
        this.name = name;
        return this;
      }

      @Override
      public Test set(String parameterName, Object value) {
        return (Test) super.set(parameterName, value);
      }
    }

    /**
     * An accessor for creating requests from the Releases collection.
     *
     * <p>The typical use is:</p>
     * <pre>
     *   {@code FirebaseRules firebaserules = new FirebaseRules(...);}
     *   {@code FirebaseRules.Releases.List request = firebaserules.releases().list(parameters ...)}
     * </pre>
     *
     * @return the resource collection
     */
    public Releases releases() {
      return new Releases();
    }

    /**
     * The "releases" collection of methods.
     */
    public class Releases {

      /**
       * Create a `Release`. Release names should reflect the developer's deployment practices. For
       * example, the release name may include the environment name, application name, application
       * version, or any other name meaningful to the developer. Once a `Release` refers to a `Ruleset`,
       * the rules can be enforced by Firebase Rules-enabled services. More than one `Release` may be
       * 'live' concurrently. Consider the following three `Release` names for `projects/foo` and the
       * `Ruleset` to which they refer. Release Name -> Ruleset Name * projects/foo/releases/prod ->
       * projects/foo/rulesets/uuid123 * projects/foo/releases/prod/beta -> projects/foo/rulesets/uuid123
       * * projects/foo/releases/prod/v23 -> projects/foo/rulesets/uuid456 The relationships reflect a
       * `Ruleset` rollout in progress. The `prod` and `prod/beta` releases refer to the same `Ruleset`.
       * However, `prod/v23` refers to a new `Ruleset`. The `Ruleset` reference for a `Release` may be
       * updated using the UpdateRelease method.
       *
       * Create a request for the method "releases.create".
       *
       * This request holds the parameters needed by the firebaserules server.  After setting any optional
       * parameters, call the {@link Create#execute()} method to invoke the remote operation.
       *
       * @param name Required. Resource name for the project which owns this `Release`. Format: `projects/{project_id}`
       * @param content the {@link com.google.api.services.firebaserules.v1.model.Release}
       * @return the request
       */
      public Create create(java.lang.String name, com.google.api.services.firebaserules.v1.model.Release content) throws java.io.IOException {
        Create result = new Create(name, content);
        initialize(result);
        return result;
      }

      public class Create extends FirebaseRulesRequest<com.google.api.services.firebaserules.v1.model.Release> {

        private static final String REST_PATH = "v1/{+name}/releases";

        private final java.util.regex.Pattern NAME_PATTERN =
            java.util.regex.Pattern.compile("^projects/[^/]+$");

        /**
         * Create a `Release`. Release names should reflect the developer's deployment practices. For
         * example, the release name may include the environment name, application name, application
         * version, or any other name meaningful to the developer. Once a `Release` refers to a `Ruleset`,
         * the rules can be enforced by Firebase Rules-enabled services. More than one `Release` may be
         * 'live' concurrently. Consider the following three `Release` names for `projects/foo` and the
         * `Ruleset` to which they refer. Release Name -> Ruleset Name * projects/foo/releases/prod ->
         * projects/foo/rulesets/uuid123 * projects/foo/releases/prod/beta ->
         * projects/foo/rulesets/uuid123 * projects/foo/releases/prod/v23 -> projects/foo/rulesets/uuid456
         * The relationships reflect a `Ruleset` rollout in progress. The `prod` and `prod/beta` releases
         * refer to the same `Ruleset`. However, `prod/v23` refers to a new `Ruleset`. The `Ruleset`
         * reference for a `Release` may be updated using the UpdateRelease method.
         *
         * Create a request for the method "releases.create".
         *
         * This request holds the parameters needed by the the firebaserules server.  After setting any
         * optional parameters, call the {@link Create#execute()} method to invoke the remote operation.
         * <p> {@link
         * Create#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
         * be called to initialize this instance immediately after invoking the constructor. </p>
         *
         * @param name Required. Resource name for the project which owns this `Release`. Format: `projects/{project_id}`
         * @param content the {@link com.google.api.services.firebaserules.v1.model.Release}
         * @since 1.13
         */
        protected Create(java.lang.String name, com.google.api.services.firebaserules.v1.model.Release content) {
          super(FirebaseRules.this, "POST", REST_PATH, content, com.google.api.services.firebaserules.v1.model.Release.class);
          this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+$");
          }
        }

        @Override
        public Create set$Xgafv(java.lang.String $Xgafv) {
          return (Create) super.set$Xgafv($Xgafv);
        }

        @Override
        public Create setAccessToken(java.lang.String accessToken) {
          return (Create) super.setAccessToken(accessToken);
        }

        @Override
        public Create setAlt(java.lang.String alt) {
          return (Create) super.setAlt(alt);
        }

        @Override
        public Create setCallback(java.lang.String callback) {
          return (Create) super.setCallback(callback);
        }

        @Override
        public Create setFields(java.lang.String fields) {
          return (Create) super.setFields(fields);
        }

        @Override
        public Create setKey(java.lang.String key) {
          return (Create) super.setKey(key);
        }

        @Override
        public Create setOauthToken(java.lang.String oauthToken) {
          return (Create) super.setOauthToken(oauthToken);
        }

        @Override
        public Create setPrettyPrint(java.lang.Boolean prettyPrint) {
          return (Create) super.setPrettyPrint(prettyPrint);
        }

        @Override
        public Create setQuotaUser(java.lang.String quotaUser) {
          return (Create) super.setQuotaUser(quotaUser);
        }

        @Override
        public Create setUploadType(java.lang.String uploadType) {
          return (Create) super.setUploadType(uploadType);
        }

        @Override
        public Create setUploadProtocol(java.lang.String uploadProtocol) {
          return (Create) super.setUploadProtocol(uploadProtocol);
        }

        /**
         * Required. Resource name for the project which owns this `Release`. Format:
         * `projects/{project_id}`
         */
        @com.google.api.client.util.Key
        private java.lang.String name;

        /** Required. Resource name for the project which owns this `Release`. Format: `projects/{project_id}`
         */
        public java.lang.String getName() {
          return name;
        }

        /**
         * Required. Resource name for the project which owns this `Release`. Format:
         * `projects/{project_id}`
         */
        public Create setName(java.lang.String name) {
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+$");
          }
          this.name = name;
          return this;
        }

        @Override
        public Create set(String parameterName, Object value) {
          return (Create) super.set(parameterName, value);
        }
      }
      /**
       * Delete a `Release` by resource name.
       *
       * Create a request for the method "releases.delete".
       *
       * This request holds the parameters needed by the firebaserules server.  After setting any optional
       * parameters, call the {@link Delete#execute()} method to invoke the remote operation.
       *
       * @param name Required. Resource name for the `Release` to delete. Format:
       *        `projects/{project_id}/releases/{release_id}`
       * @return the request
       */
      public Delete delete(java.lang.String name) throws java.io.IOException {
        Delete result = new Delete(name);
        initialize(result);
        return result;
      }

      public class Delete extends FirebaseRulesRequest<com.google.api.services.firebaserules.v1.model.Empty> {

        private static final String REST_PATH = "v1/{+name}";

        private final java.util.regex.Pattern NAME_PATTERN =
            java.util.regex.Pattern.compile("^projects/[^/]+/releases/.*$");

        /**
         * Delete a `Release` by resource name.
         *
         * Create a request for the method "releases.delete".
         *
         * This request holds the parameters needed by the the firebaserules server.  After setting any
         * optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
         * <p> {@link
         * Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
         * be called to initialize this instance immediately after invoking the constructor. </p>
         *
         * @param name Required. Resource name for the `Release` to delete. Format:
       *        `projects/{project_id}/releases/{release_id}`
         * @since 1.13
         */
        protected Delete(java.lang.String name) {
          super(FirebaseRules.this, "DELETE", REST_PATH, null, com.google.api.services.firebaserules.v1.model.Empty.class);
          this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+/releases/.*$");
          }
        }

        @Override
        public Delete set$Xgafv(java.lang.String $Xgafv) {
          return (Delete) super.set$Xgafv($Xgafv);
        }

        @Override
        public Delete setAccessToken(java.lang.String accessToken) {
          return (Delete) super.setAccessToken(accessToken);
        }

        @Override
        public Delete setAlt(java.lang.String alt) {
          return (Delete) super.setAlt(alt);
        }

        @Override
        public Delete setCallback(java.lang.String callback) {
          return (Delete) super.setCallback(callback);
        }

        @Override
        public Delete setFields(java.lang.String fields) {
          return (Delete) super.setFields(fields);
        }

        @Override
        public Delete setKey(java.lang.String key) {
          return (Delete) super.setKey(key);
        }

        @Override
        public Delete setOauthToken(java.lang.String oauthToken) {
          return (Delete) super.setOauthToken(oauthToken);
        }

        @Override
        public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
          return (Delete) super.setPrettyPrint(prettyPrint);
        }

        @Override
        public Delete setQuotaUser(java.lang.String quotaUser) {
          return (Delete) super.setQuotaUser(quotaUser);
        }

        @Override
        public Delete setUploadType(java.lang.String uploadType) {
          return (Delete) super.setUploadType(uploadType);
        }

        @Override
        public Delete setUploadProtocol(java.lang.String uploadProtocol) {
          return (Delete) super.setUploadProtocol(uploadProtocol);
        }

        /**
         * Required. Resource name for the `Release` to delete. Format:
         * `projects/{project_id}/releases/{release_id}`
         */
        @com.google.api.client.util.Key
        private java.lang.String name;

        /** Required. Resource name for the `Release` to delete. Format:
       `projects/{project_id}/releases/{release_id}`
         */
        public java.lang.String getName() {
          return name;
        }

        /**
         * Required. Resource name for the `Release` to delete. Format:
         * `projects/{project_id}/releases/{release_id}`
         */
        public Delete setName(java.lang.String name) {
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+/releases/.*$");
          }
          this.name = name;
          return this;
        }

        @Override
        public Delete set(String parameterName, Object value) {
          return (Delete) super.set(parameterName, value);
        }
      }
      /**
       * Get a `Release` by name.
       *
       * Create a request for the method "releases.get".
       *
       * This request holds the parameters needed by the firebaserules server.  After setting any optional
       * parameters, call the {@link Get#execute()} method to invoke the remote operation.
       *
       * @param name Required. Resource name of the `Release`. Format: `projects/{project_id}/releases/{release_id}`
       * @return the request
       */
      public Get get(java.lang.String name) throws java.io.IOException {
        Get result = new Get(name);
        initialize(result);
        return result;
      }

      public class Get extends FirebaseRulesRequest<com.google.api.services.firebaserules.v1.model.Release> {

        private static final String REST_PATH = "v1/{+name}";

        private final java.util.regex.Pattern NAME_PATTERN =
            java.util.regex.Pattern.compile("^projects/[^/]+/releases/.*$");

        /**
         * Get a `Release` by name.
         *
         * Create a request for the method "releases.get".
         *
         * This request holds the parameters needed by the the firebaserules server.  After setting any
         * optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
         * {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
         * must be called to initialize this instance immediately after invoking the constructor. </p>
         *
         * @param name Required. Resource name of the `Release`. Format: `projects/{project_id}/releases/{release_id}`
         * @since 1.13
         */
        protected Get(java.lang.String name) {
          super(FirebaseRules.this, "GET", REST_PATH, null, com.google.api.services.firebaserules.v1.model.Release.class);
          this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+/releases/.*$");
          }
        }

        @Override
        public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
          return super.executeUsingHead();
        }

        @Override
        public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
          return super.buildHttpRequestUsingHead();
        }

        @Override
        public Get set$Xgafv(java.lang.String $Xgafv) {
          return (Get) super.set$Xgafv($Xgafv);
        }

        @Override
        public Get setAccessToken(java.lang.String accessToken) {
          return (Get) super.setAccessToken(accessToken);
        }

        @Override
        public Get setAlt(java.lang.String alt) {
          return (Get) super.setAlt(alt);
        }

        @Override
        public Get setCallback(java.lang.String callback) {
          return (Get) super.setCallback(callback);
        }

        @Override
        public Get setFields(java.lang.String fields) {
          return (Get) super.setFields(fields);
        }

        @Override
        public Get setKey(java.lang.String key) {
          return (Get) super.setKey(key);
        }

        @Override
        public Get setOauthToken(java.lang.String oauthToken) {
          return (Get) super.setOauthToken(oauthToken);
        }

        @Override
        public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
          return (Get) super.setPrettyPrint(prettyPrint);
        }

        @Override
        public Get setQuotaUser(java.lang.String quotaUser) {
          return (Get) super.setQuotaUser(quotaUser);
        }

        @Override
        public Get setUploadType(java.lang.String uploadType) {
          return (Get) super.setUploadType(uploadType);
        }

        @Override
        public Get setUploadProtocol(java.lang.String uploadProtocol) {
          return (Get) super.setUploadProtocol(uploadProtocol);
        }

        /**
         * Required. Resource name of the `Release`. Format:
         * `projects/{project_id}/releases/{release_id}`
         */
        @com.google.api.client.util.Key
        private java.lang.String name;

        /** Required. Resource name of the `Release`. Format: `projects/{project_id}/releases/{release_id}`
         */
        public java.lang.String getName() {
          return name;
        }

        /**
         * Required. Resource name of the `Release`. Format:
         * `projects/{project_id}/releases/{release_id}`
         */
        public Get setName(java.lang.String name) {
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+/releases/.*$");
          }
          this.name = name;
          return this;
        }

        @Override
        public Get set(String parameterName, Object value) {
          return (Get) super.set(parameterName, value);
        }
      }
      /**
       * Get the `Release` executable to use when enforcing rules.
       *
       * Create a request for the method "releases.getExecutable".
       *
       * This request holds the parameters needed by the firebaserules server.  After setting any optional
       * parameters, call the {@link GetExecutable#execute()} method to invoke the remote operation.
       *
       * @param name Required. Resource name of the `Release`. Format: `projects/{project_id}/releases/{release_id}`
       * @return the request
       */
      public GetExecutable getExecutable(java.lang.String name) throws java.io.IOException {
        GetExecutable result = new GetExecutable(name);
        initialize(result);
        return result;
      }

      public class GetExecutable extends FirebaseRulesRequest<com.google.api.services.firebaserules.v1.model.GetReleaseExecutableResponse> {

        private static final String REST_PATH = "v1/{+name}:getExecutable";

        private final java.util.regex.Pattern NAME_PATTERN =
            java.util.regex.Pattern.compile("^projects/[^/]+/releases/.*$");

        /**
         * Get the `Release` executable to use when enforcing rules.
         *
         * Create a request for the method "releases.getExecutable".
         *
         * This request holds the parameters needed by the the firebaserules server.  After setting any
         * optional parameters, call the {@link GetExecutable#execute()} method to invoke the remote
         * operation. <p> {@link GetExecutable#initialize(com.google.api.client.googleapis.services.Abstra
         * ctGoogleClientRequest)} must be called to initialize this instance immediately after invoking
         * the constructor. </p>
         *
         * @param name Required. Resource name of the `Release`. Format: `projects/{project_id}/releases/{release_id}`
         * @since 1.13
         */
        protected GetExecutable(java.lang.String name) {
          super(FirebaseRules.this, "GET", REST_PATH, null, com.google.api.services.firebaserules.v1.model.GetReleaseExecutableResponse.class);
          this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+/releases/.*$");
          }
        }

        @Override
        public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
          return super.executeUsingHead();
        }

        @Override
        public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
          return super.buildHttpRequestUsingHead();
        }

        @Override
        public GetExecutable set$Xgafv(java.lang.String $Xgafv) {
          return (GetExecutable) super.set$Xgafv($Xgafv);
        }

        @Override
        public GetExecutable setAccessToken(java.lang.String accessToken) {
          return (GetExecutable) super.setAccessToken(accessToken);
        }

        @Override
        public GetExecutable setAlt(java.lang.String alt) {
          return (GetExecutable) super.setAlt(alt);
        }

        @Override
        public GetExecutable setCallback(java.lang.String callback) {
          return (GetExecutable) super.setCallback(callback);
        }

        @Override
        public GetExecutable setFields(java.lang.String fields) {
          return (GetExecutable) super.setFields(fields);
        }

        @Override
        public GetExecutable setKey(java.lang.String key) {
          return (GetExecutable) super.setKey(key);
        }

        @Override
        public GetExecutable setOauthToken(java.lang.String oauthToken) {
          return (GetExecutable) super.setOauthToken(oauthToken);
        }

        @Override
        public GetExecutable setPrettyPrint(java.lang.Boolean prettyPrint) {
          return (GetExecutable) super.setPrettyPrint(prettyPrint);
        }

        @Override
        public GetExecutable setQuotaUser(java.lang.String quotaUser) {
          return (GetExecutable) super.setQuotaUser(quotaUser);
        }

        @Override
        public GetExecutable setUploadType(java.lang.String uploadType) {
          return (GetExecutable) super.setUploadType(uploadType);
        }

        @Override
        public GetExecutable setUploadProtocol(java.lang.String uploadProtocol) {
          return (GetExecutable) super.setUploadProtocol(uploadProtocol);
        }

        /**
         * Required. Resource name of the `Release`. Format:
         * `projects/{project_id}/releases/{release_id}`
         */
        @com.google.api.client.util.Key
        private java.lang.String name;

        /** Required. Resource name of the `Release`. Format: `projects/{project_id}/releases/{release_id}`
         */
        public java.lang.String getName() {
          return name;
        }

        /**
         * Required. Resource name of the `Release`. Format:
         * `projects/{project_id}/releases/{release_id}`
         */
        public GetExecutable setName(java.lang.String name) {
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+/releases/.*$");
          }
          this.name = name;
          return this;
        }

        /** The requested runtime executable version. Defaults to FIREBASE_RULES_EXECUTABLE_V1. */
        @com.google.api.client.util.Key
        private java.lang.String executableVersion;

        /** The requested runtime executable version. Defaults to FIREBASE_RULES_EXECUTABLE_V1.
         */
        public java.lang.String getExecutableVersion() {
          return executableVersion;
        }

        /** The requested runtime executable version. Defaults to FIREBASE_RULES_EXECUTABLE_V1. */
        public GetExecutable setExecutableVersion(java.lang.String executableVersion) {
          this.executableVersion = executableVersion;
          return this;
        }

        @Override
        public GetExecutable set(String parameterName, Object value) {
          return (GetExecutable) super.set(parameterName, value);
        }
      }
      /**
       * List the `Release` values for a project. This list may optionally be filtered by `Release` name,
       * `Ruleset` name, `TestSuite` name, or any combination thereof.
       *
       * Create a request for the method "releases.list".
       *
       * This request holds the parameters needed by the firebaserules server.  After setting any optional
       * parameters, call the {@link List#execute()} method to invoke the remote operation.
       *
       * @param name Required. Resource name for the project. Format: `projects/{project_id}`
       * @return the request
       */
      public List list(java.lang.String name) throws java.io.IOException {
        List result = new List(name);
        initialize(result);
        return result;
      }

      public class List extends FirebaseRulesRequest<com.google.api.services.firebaserules.v1.model.ListReleasesResponse> {

        private static final String REST_PATH = "v1/{+name}/releases";

        private final java.util.regex.Pattern NAME_PATTERN =
            java.util.regex.Pattern.compile("^projects/[^/]+$");

        /**
         * List the `Release` values for a project. This list may optionally be filtered by `Release`
         * name, `Ruleset` name, `TestSuite` name, or any combination thereof.
         *
         * Create a request for the method "releases.list".
         *
         * This request holds the parameters needed by the the firebaserules server.  After setting any
         * optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p>
         * {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
         * must be called to initialize this instance immediately after invoking the constructor. </p>
         *
         * @param name Required. Resource name for the project. Format: `projects/{project_id}`
         * @since 1.13
         */
        protected List(java.lang.String name) {
          super(FirebaseRules.this, "GET", REST_PATH, null, com.google.api.services.firebaserules.v1.model.ListReleasesResponse.class);
          this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+$");
          }
        }

        @Override
        public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
          return super.executeUsingHead();
        }

        @Override
        public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
          return super.buildHttpRequestUsingHead();
        }

        @Override
        public List set$Xgafv(java.lang.String $Xgafv) {
          return (List) super.set$Xgafv($Xgafv);
        }

        @Override
        public List setAccessToken(java.lang.String accessToken) {
          return (List) super.setAccessToken(accessToken);
        }

        @Override
        public List setAlt(java.lang.String alt) {
          return (List) super.setAlt(alt);
        }

        @Override
        public List setCallback(java.lang.String callback) {
          return (List) super.setCallback(callback);
        }

        @Override
        public List setFields(java.lang.String fields) {
          return (List) super.setFields(fields);
        }

        @Override
        public List setKey(java.lang.String key) {
          return (List) super.setKey(key);
        }

        @Override
        public List setOauthToken(java.lang.String oauthToken) {
          return (List) super.setOauthToken(oauthToken);
        }

        @Override
        public List setPrettyPrint(java.lang.Boolean prettyPrint) {
          return (List) super.setPrettyPrint(prettyPrint);
        }

        @Override
        public List setQuotaUser(java.lang.String quotaUser) {
          return (List) super.setQuotaUser(quotaUser);
        }

        @Override
        public List setUploadType(java.lang.String uploadType) {
          return (List) super.setUploadType(uploadType);
        }

        @Override
        public List setUploadProtocol(java.lang.String uploadProtocol) {
          return (List) super.setUploadProtocol(uploadProtocol);
        }

        /** Required. Resource name for the project. Format: `projects/{project_id}` */
        @com.google.api.client.util.Key
        private java.lang.String name;

        /** Required. Resource name for the project. Format: `projects/{project_id}`
         */
        public java.lang.String getName() {
          return name;
        }

        /** Required. Resource name for the project. Format: `projects/{project_id}` */
        public List setName(java.lang.String name) {
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+$");
          }
          this.name = name;
          return this;
        }

        /**
         * `Release` filter. The list method supports filters with restrictions on the
         * `Release.name`, and `Release.ruleset_name`. Example 1: A filter of 'name=prod*' might
         * return `Release`s with names within 'projects/foo' prefixed with 'prod': Name -> Ruleset
         * Name: * projects/foo/releases/prod -> projects/foo/rulesets/uuid1234 *
         * projects/foo/releases/prod/v1 -> projects/foo/rulesets/uuid1234 *
         * projects/foo/releases/prod/v2 -> projects/foo/rulesets/uuid8888 Example 2: A filter of
         * `name=prod* ruleset_name=uuid1234` would return only `Release` instances for
         * 'projects/foo' with names prefixed with 'prod' referring to the same `Ruleset` name of
         * 'uuid1234': Name -> Ruleset Name: * projects/foo/releases/prod ->
         * projects/foo/rulesets/1234 * projects/foo/releases/prod/v1 -> projects/foo/rulesets/1234
         * In the examples, the filter parameters refer to the search filters are relative to the
         * project. Fully qualified prefixed may also be used.
         */
        @com.google.api.client.util.Key
        private java.lang.String filter;

        /**` Release` filter. The list method supports filters with restrictions on the `Release.name`, and
      ` `Release.ruleset_name`. Example 1: A filter of 'name=prod*' might return `Release`s with names
      ` within 'projects/foo' prefixed with 'prod': Name -> Ruleset Name: * projects/foo/releases/prod ->
      ` projects/foo/rulesets/uuid1234 * projects/foo/releases/prod/v1 -> projects/foo/rulesets/uuid1234 *
      ` projects/foo/releases/prod/v2 -> projects/foo/rulesets/uuid8888 Example 2: A filter of `name=prod*
      ` ruleset_name=uuid1234` would return only `Release` instances for 'projects/foo' with names
      ` prefixed with 'prod' referring to the same `Ruleset` name of 'uuid1234': Name -> Ruleset Name: *
      ` projects/foo/releases/prod -> projects/foo/rulesets/1234 * projects/foo/releases/prod/v1 ->
      ` projects/foo/rulesets/1234 In the examples, the filter parameters refer to the search filters are
      ` relative to the project. Fully qualified prefixed may also be used.
      `

         */
        public java.lang.String getFilter() {
          return filter;
        }

        /**
         * `Release` filter. The list method supports filters with restrictions on the
         * `Release.name`, and `Release.ruleset_name`. Example 1: A filter of 'name=prod*' might
         * return `Release`s with names within 'projects/foo' prefixed with 'prod': Name -> Ruleset
         * Name: * projects/foo/releases/prod -> projects/foo/rulesets/uuid1234 *
         * projects/foo/releases/prod/v1 -> projects/foo/rulesets/uuid1234 *
         * projects/foo/releases/prod/v2 -> projects/foo/rulesets/uuid8888 Example 2: A filter of
         * `name=prod* ruleset_name=uuid1234` would return only `Release` instances for
         * 'projects/foo' with names prefixed with 'prod' referring to the same `Ruleset` name of
         * 'uuid1234': Name -> Ruleset Name: * projects/foo/releases/prod ->
         * projects/foo/rulesets/1234 * projects/foo/releases/prod/v1 -> projects/foo/rulesets/1234
         * In the examples, the filter parameters refer to the search filters are relative to the
         * project. Fully qualified prefixed may also be used.
         */
        public List setFilter(java.lang.String filter) {
          this.filter = filter;
          return this;
        }

        /**
         * Page size to load. Maximum of 100. Defaults to 10. Note: `page_size` is just a hint and
         * the service may choose to load fewer than `page_size` results due to the size of the
         * output. To traverse all of the releases, the caller should iterate until the `page_token`
         * on the response is empty.
         */
        @com.google.api.client.util.Key
        private java.lang.Integer pageSize;

        /** Page size to load. Maximum of 100. Defaults to 10. Note: `page_size` is just a hint and the service
       may choose to load fewer than `page_size` results due to the size of the output. To traverse all of
       the releases, the caller should iterate until the `page_token` on the response is empty.
         */
        public java.lang.Integer getPageSize() {
          return pageSize;
        }

        /**
         * Page size to load. Maximum of 100. Defaults to 10. Note: `page_size` is just a hint and
         * the service may choose to load fewer than `page_size` results due to the size of the
         * output. To traverse all of the releases, the caller should iterate until the `page_token`
         * on the response is empty.
         */
        public List setPageSize(java.lang.Integer pageSize) {
          this.pageSize = pageSize;
          return this;
        }

        /** Next page token for the next batch of `Release` instances. */
        @com.google.api.client.util.Key
        private java.lang.String pageToken;

        /** Next page token for the next batch of `Release` instances.
         */
        public java.lang.String getPageToken() {
          return pageToken;
        }

        /** Next page token for the next batch of `Release` instances. */
        public List setPageToken(java.lang.String pageToken) {
          this.pageToken = pageToken;
          return this;
        }

        @Override
        public List set(String parameterName, Object value) {
          return (List) super.set(parameterName, value);
        }
      }
      /**
       * Update a `Release` via PATCH. Only updates to `ruleset_name` will be honored. `Release` rename is
       * not supported. To create a `Release` use the CreateRelease method.
       *
       * Create a request for the method "releases.patch".
       *
       * This request holds the parameters needed by the firebaserules server.  After setting any optional
       * parameters, call the {@link Patch#execute()} method to invoke the remote operation.
       *
       * @param name Required. Resource name for the project which owns this `Release`. Format: `projects/{project_id}`
       * @param content the {@link com.google.api.services.firebaserules.v1.model.UpdateReleaseRequest}
       * @return the request
       */
      public Patch patch(java.lang.String name, com.google.api.services.firebaserules.v1.model.UpdateReleaseRequest content) throws java.io.IOException {
        Patch result = new Patch(name, content);
        initialize(result);
        return result;
      }

      public class Patch extends FirebaseRulesRequest<com.google.api.services.firebaserules.v1.model.Release> {

        private static final String REST_PATH = "v1/{+name}";

        private final java.util.regex.Pattern NAME_PATTERN =
            java.util.regex.Pattern.compile("^projects/[^/]+/releases/.*$");

        /**
         * Update a `Release` via PATCH. Only updates to `ruleset_name` will be honored. `Release` rename
         * is not supported. To create a `Release` use the CreateRelease method.
         *
         * Create a request for the method "releases.patch".
         *
         * This request holds the parameters needed by the the firebaserules server.  After setting any
         * optional parameters, call the {@link Patch#execute()} method to invoke the remote operation.
         * <p> {@link
         * Patch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
         * be called to initialize this instance immediately after invoking the constructor. </p>
         *
         * @param name Required. Resource name for the project which owns this `Release`. Format: `projects/{project_id}`
         * @param content the {@link com.google.api.services.firebaserules.v1.model.UpdateReleaseRequest}
         * @since 1.13
         */
        protected Patch(java.lang.String name, com.google.api.services.firebaserules.v1.model.UpdateReleaseRequest content) {
          super(FirebaseRules.this, "PATCH", REST_PATH, content, com.google.api.services.firebaserules.v1.model.Release.class);
          this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+/releases/.*$");
          }
        }

        @Override
        public Patch set$Xgafv(java.lang.String $Xgafv) {
          return (Patch) super.set$Xgafv($Xgafv);
        }

        @Override
        public Patch setAccessToken(java.lang.String accessToken) {
          return (Patch) super.setAccessToken(accessToken);
        }

        @Override
        public Patch setAlt(java.lang.String alt) {
          return (Patch) super.setAlt(alt);
        }

        @Override
        public Patch setCallback(java.lang.String callback) {
          return (Patch) super.setCallback(callback);
        }

        @Override
        public Patch setFields(java.lang.String fields) {
          return (Patch) super.setFields(fields);
        }

        @Override
        public Patch setKey(java.lang.String key) {
          return (Patch) super.setKey(key);
        }

        @Override
        public Patch setOauthToken(java.lang.String oauthToken) {
          return (Patch) super.setOauthToken(oauthToken);
        }

        @Override
        public Patch setPrettyPrint(java.lang.Boolean prettyPrint) {
          return (Patch) super.setPrettyPrint(prettyPrint);
        }

        @Override
        public Patch setQuotaUser(java.lang.String quotaUser) {
          return (Patch) super.setQuotaUser(quotaUser);
        }

        @Override
        public Patch setUploadType(java.lang.String uploadType) {
          return (Patch) super.setUploadType(uploadType);
        }

        @Override
        public Patch setUploadProtocol(java.lang.String uploadProtocol) {
          return (Patch) super.setUploadProtocol(uploadProtocol);
        }

        /**
         * Required. Resource name for the project which owns this `Release`. Format:
         * `projects/{project_id}`
         */
        @com.google.api.client.util.Key
        private java.lang.String name;

        /** Required. Resource name for the project which owns this `Release`. Format: `projects/{project_id}`
         */
        public java.lang.String getName() {
          return name;
        }

        /**
         * Required. Resource name for the project which owns this `Release`. Format:
         * `projects/{project_id}`
         */
        public Patch setName(java.lang.String name) {
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+/releases/.*$");
          }
          this.name = name;
          return this;
        }

        @Override
        public Patch set(String parameterName, Object value) {
          return (Patch) super.set(parameterName, value);
        }
      }

    }
    /**
     * An accessor for creating requests from the Rulesets collection.
     *
     * <p>The typical use is:</p>
     * <pre>
     *   {@code FirebaseRules firebaserules = new FirebaseRules(...);}
     *   {@code FirebaseRules.Rulesets.List request = firebaserules.rulesets().list(parameters ...)}
     * </pre>
     *
     * @return the resource collection
     */
    public Rulesets rulesets() {
      return new Rulesets();
    }

    /**
     * The "rulesets" collection of methods.
     */
    public class Rulesets {

      /**
       * Create a `Ruleset` from `Source`. The `Ruleset` is given a unique generated name which is
       * returned to the caller. `Source` containing syntactic or semantics errors will result in an error
       * response indicating the first error encountered. For a detailed view of `Source` issues, use
       * TestRuleset.
       *
       * Create a request for the method "rulesets.create".
       *
       * This request holds the parameters needed by the firebaserules server.  After setting any optional
       * parameters, call the {@link Create#execute()} method to invoke the remote operation.
       *
       * @param name Required. Resource name for Project which owns this `Ruleset`. Format: `projects/{project_id}`
       * @param content the {@link com.google.api.services.firebaserules.v1.model.Ruleset}
       * @return the request
       */
      public Create create(java.lang.String name, com.google.api.services.firebaserules.v1.model.Ruleset content) throws java.io.IOException {
        Create result = new Create(name, content);
        initialize(result);
        return result;
      }

      public class Create extends FirebaseRulesRequest<com.google.api.services.firebaserules.v1.model.Ruleset> {

        private static final String REST_PATH = "v1/{+name}/rulesets";

        private final java.util.regex.Pattern NAME_PATTERN =
            java.util.regex.Pattern.compile("^projects/[^/]+$");

        /**
         * Create a `Ruleset` from `Source`. The `Ruleset` is given a unique generated name which is
         * returned to the caller. `Source` containing syntactic or semantics errors will result in an
         * error response indicating the first error encountered. For a detailed view of `Source` issues,
         * use TestRuleset.
         *
         * Create a request for the method "rulesets.create".
         *
         * This request holds the parameters needed by the the firebaserules server.  After setting any
         * optional parameters, call the {@link Create#execute()} method to invoke the remote operation.
         * <p> {@link
         * Create#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
         * be called to initialize this instance immediately after invoking the constructor. </p>
         *
         * @param name Required. Resource name for Project which owns this `Ruleset`. Format: `projects/{project_id}`
         * @param content the {@link com.google.api.services.firebaserules.v1.model.Ruleset}
         * @since 1.13
         */
        protected Create(java.lang.String name, com.google.api.services.firebaserules.v1.model.Ruleset content) {
          super(FirebaseRules.this, "POST", REST_PATH, content, com.google.api.services.firebaserules.v1.model.Ruleset.class);
          this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+$");
          }
        }

        @Override
        public Create set$Xgafv(java.lang.String $Xgafv) {
          return (Create) super.set$Xgafv($Xgafv);
        }

        @Override
        public Create setAccessToken(java.lang.String accessToken) {
          return (Create) super.setAccessToken(accessToken);
        }

        @Override
        public Create setAlt(java.lang.String alt) {
          return (Create) super.setAlt(alt);
        }

        @Override
        public Create setCallback(java.lang.String callback) {
          return (Create) super.setCallback(callback);
        }

        @Override
        public Create setFields(java.lang.String fields) {
          return (Create) super.setFields(fields);
        }

        @Override
        public Create setKey(java.lang.String key) {
          return (Create) super.setKey(key);
        }

        @Override
        public Create setOauthToken(java.lang.String oauthToken) {
          return (Create) super.setOauthToken(oauthToken);
        }

        @Override
        public Create setPrettyPrint(java.lang.Boolean prettyPrint) {
          return (Create) super.setPrettyPrint(prettyPrint);
        }

        @Override
        public Create setQuotaUser(java.lang.String quotaUser) {
          return (Create) super.setQuotaUser(quotaUser);
        }

        @Override
        public Create setUploadType(java.lang.String uploadType) {
          return (Create) super.setUploadType(uploadType);
        }

        @Override
        public Create setUploadProtocol(java.lang.String uploadProtocol) {
          return (Create) super.setUploadProtocol(uploadProtocol);
        }

        /**
         * Required. Resource name for Project which owns this `Ruleset`. Format:
         * `projects/{project_id}`
         */
        @com.google.api.client.util.Key
        private java.lang.String name;

        /** Required. Resource name for Project which owns this `Ruleset`. Format: `projects/{project_id}`
         */
        public java.lang.String getName() {
          return name;
        }

        /**
         * Required. Resource name for Project which owns this `Ruleset`. Format:
         * `projects/{project_id}`
         */
        public Create setName(java.lang.String name) {
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+$");
          }
          this.name = name;
          return this;
        }

        @Override
        public Create set(String parameterName, Object value) {
          return (Create) super.set(parameterName, value);
        }
      }
      /**
       * Delete a `Ruleset` by resource name. If the `Ruleset` is referenced by a `Release` the operation
       * will fail.
       *
       * Create a request for the method "rulesets.delete".
       *
       * This request holds the parameters needed by the firebaserules server.  After setting any optional
       * parameters, call the {@link Delete#execute()} method to invoke the remote operation.
       *
       * @param name Required. Resource name for the ruleset to delete. Format:
       *        `projects/{project_id}/rulesets/{ruleset_id}`
       * @return the request
       */
      public Delete delete(java.lang.String name) throws java.io.IOException {
        Delete result = new Delete(name);
        initialize(result);
        return result;
      }

      public class Delete extends FirebaseRulesRequest<com.google.api.services.firebaserules.v1.model.Empty> {

        private static final String REST_PATH = "v1/{+name}";

        private final java.util.regex.Pattern NAME_PATTERN =
            java.util.regex.Pattern.compile("^projects/[^/]+/rulesets/[^/]+$");

        /**
         * Delete a `Ruleset` by resource name. If the `Ruleset` is referenced by a `Release` the
         * operation will fail.
         *
         * Create a request for the method "rulesets.delete".
         *
         * This request holds the parameters needed by the the firebaserules server.  After setting any
         * optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
         * <p> {@link
         * Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
         * be called to initialize this instance immediately after invoking the constructor. </p>
         *
         * @param name Required. Resource name for the ruleset to delete. Format:
       *        `projects/{project_id}/rulesets/{ruleset_id}`
         * @since 1.13
         */
        protected Delete(java.lang.String name) {
          super(FirebaseRules.this, "DELETE", REST_PATH, null, com.google.api.services.firebaserules.v1.model.Empty.class);
          this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+/rulesets/[^/]+$");
          }
        }

        @Override
        public Delete set$Xgafv(java.lang.String $Xgafv) {
          return (Delete) super.set$Xgafv($Xgafv);
        }

        @Override
        public Delete setAccessToken(java.lang.String accessToken) {
          return (Delete) super.setAccessToken(accessToken);
        }

        @Override
        public Delete setAlt(java.lang.String alt) {
          return (Delete) super.setAlt(alt);
        }

        @Override
        public Delete setCallback(java.lang.String callback) {
          return (Delete) super.setCallback(callback);
        }

        @Override
        public Delete setFields(java.lang.String fields) {
          return (Delete) super.setFields(fields);
        }

        @Override
        public Delete setKey(java.lang.String key) {
          return (Delete) super.setKey(key);
        }

        @Override
        public Delete setOauthToken(java.lang.String oauthToken) {
          return (Delete) super.setOauthToken(oauthToken);
        }

        @Override
        public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
          return (Delete) super.setPrettyPrint(prettyPrint);
        }

        @Override
        public Delete setQuotaUser(java.lang.String quotaUser) {
          return (Delete) super.setQuotaUser(quotaUser);
        }

        @Override
        public Delete setUploadType(java.lang.String uploadType) {
          return (Delete) super.setUploadType(uploadType);
        }

        @Override
        public Delete setUploadProtocol(java.lang.String uploadProtocol) {
          return (Delete) super.setUploadProtocol(uploadProtocol);
        }

        /**
         * Required. Resource name for the ruleset to delete. Format:
         * `projects/{project_id}/rulesets/{ruleset_id}`
         */
        @com.google.api.client.util.Key
        private java.lang.String name;

        /** Required. Resource name for the ruleset to delete. Format:
       `projects/{project_id}/rulesets/{ruleset_id}`
         */
        public java.lang.String getName() {
          return name;
        }

        /**
         * Required. Resource name for the ruleset to delete. Format:
         * `projects/{project_id}/rulesets/{ruleset_id}`
         */
        public Delete setName(java.lang.String name) {
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+/rulesets/[^/]+$");
          }
          this.name = name;
          return this;
        }

        @Override
        public Delete set(String parameterName, Object value) {
          return (Delete) super.set(parameterName, value);
        }
      }
      /**
       * Get a `Ruleset` by name including the full `Source` contents.
       *
       * Create a request for the method "rulesets.get".
       *
       * This request holds the parameters needed by the firebaserules server.  After setting any optional
       * parameters, call the {@link Get#execute()} method to invoke the remote operation.
       *
       * @param name Required. Resource name for the ruleset to get. Format:
       *        `projects/{project_id}/rulesets/{ruleset_id}`
       * @return the request
       */
      public Get get(java.lang.String name) throws java.io.IOException {
        Get result = new Get(name);
        initialize(result);
        return result;
      }

      public class Get extends FirebaseRulesRequest<com.google.api.services.firebaserules.v1.model.Ruleset> {

        private static final String REST_PATH = "v1/{+name}";

        private final java.util.regex.Pattern NAME_PATTERN =
            java.util.regex.Pattern.compile("^projects/[^/]+/rulesets/[^/]+$");

        /**
         * Get a `Ruleset` by name including the full `Source` contents.
         *
         * Create a request for the method "rulesets.get".
         *
         * This request holds the parameters needed by the the firebaserules server.  After setting any
         * optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
         * {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
         * must be called to initialize this instance immediately after invoking the constructor. </p>
         *
         * @param name Required. Resource name for the ruleset to get. Format:
       *        `projects/{project_id}/rulesets/{ruleset_id}`
         * @since 1.13
         */
        protected Get(java.lang.String name) {
          super(FirebaseRules.this, "GET", REST_PATH, null, com.google.api.services.firebaserules.v1.model.Ruleset.class);
          this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+/rulesets/[^/]+$");
          }
        }

        @Override
        public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
          return super.executeUsingHead();
        }

        @Override
        public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
          return super.buildHttpRequestUsingHead();
        }

        @Override
        public Get set$Xgafv(java.lang.String $Xgafv) {
          return (Get) super.set$Xgafv($Xgafv);
        }

        @Override
        public Get setAccessToken(java.lang.String accessToken) {
          return (Get) super.setAccessToken(accessToken);
        }

        @Override
        public Get setAlt(java.lang.String alt) {
          return (Get) super.setAlt(alt);
        }

        @Override
        public Get setCallback(java.lang.String callback) {
          return (Get) super.setCallback(callback);
        }

        @Override
        public Get setFields(java.lang.String fields) {
          return (Get) super.setFields(fields);
        }

        @Override
        public Get setKey(java.lang.String key) {
          return (Get) super.setKey(key);
        }

        @Override
        public Get setOauthToken(java.lang.String oauthToken) {
          return (Get) super.setOauthToken(oauthToken);
        }

        @Override
        public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
          return (Get) super.setPrettyPrint(prettyPrint);
        }

        @Override
        public Get setQuotaUser(java.lang.String quotaUser) {
          return (Get) super.setQuotaUser(quotaUser);
        }

        @Override
        public Get setUploadType(java.lang.String uploadType) {
          return (Get) super.setUploadType(uploadType);
        }

        @Override
        public Get setUploadProtocol(java.lang.String uploadProtocol) {
          return (Get) super.setUploadProtocol(uploadProtocol);
        }

        /**
         * Required. Resource name for the ruleset to get. Format:
         * `projects/{project_id}/rulesets/{ruleset_id}`
         */
        @com.google.api.client.util.Key
        private java.lang.String name;

        /** Required. Resource name for the ruleset to get. Format:
       `projects/{project_id}/rulesets/{ruleset_id}`
         */
        public java.lang.String getName() {
          return name;
        }

        /**
         * Required. Resource name for the ruleset to get. Format:
         * `projects/{project_id}/rulesets/{ruleset_id}`
         */
        public Get setName(java.lang.String name) {
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+/rulesets/[^/]+$");
          }
          this.name = name;
          return this;
        }

        @Override
        public Get set(String parameterName, Object value) {
          return (Get) super.set(parameterName, value);
        }
      }
      /**
       * List `Ruleset` metadata only and optionally filter the results by `Ruleset` name. The full
       * `Source` contents of a `Ruleset` may be retrieved with GetRuleset.
       *
       * Create a request for the method "rulesets.list".
       *
       * This request holds the parameters needed by the firebaserules server.  After setting any optional
       * parameters, call the {@link List#execute()} method to invoke the remote operation.
       *
       * @param name Required. Resource name for the project. Format: `projects/{project_id}`
       * @return the request
       */
      public List list(java.lang.String name) throws java.io.IOException {
        List result = new List(name);
        initialize(result);
        return result;
      }

      public class List extends FirebaseRulesRequest<com.google.api.services.firebaserules.v1.model.ListRulesetsResponse> {

        private static final String REST_PATH = "v1/{+name}/rulesets";

        private final java.util.regex.Pattern NAME_PATTERN =
            java.util.regex.Pattern.compile("^projects/[^/]+$");

        /**
         * List `Ruleset` metadata only and optionally filter the results by `Ruleset` name. The full
         * `Source` contents of a `Ruleset` may be retrieved with GetRuleset.
         *
         * Create a request for the method "rulesets.list".
         *
         * This request holds the parameters needed by the the firebaserules server.  After setting any
         * optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p>
         * {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
         * must be called to initialize this instance immediately after invoking the constructor. </p>
         *
         * @param name Required. Resource name for the project. Format: `projects/{project_id}`
         * @since 1.13
         */
        protected List(java.lang.String name) {
          super(FirebaseRules.this, "GET", REST_PATH, null, com.google.api.services.firebaserules.v1.model.ListRulesetsResponse.class);
          this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+$");
          }
        }

        @Override
        public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
          return super.executeUsingHead();
        }

        @Override
        public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
          return super.buildHttpRequestUsingHead();
        }

        @Override
        public List set$Xgafv(java.lang.String $Xgafv) {
          return (List) super.set$Xgafv($Xgafv);
        }

        @Override
        public List setAccessToken(java.lang.String accessToken) {
          return (List) super.setAccessToken(accessToken);
        }

        @Override
        public List setAlt(java.lang.String alt) {
          return (List) super.setAlt(alt);
        }

        @Override
        public List setCallback(java.lang.String callback) {
          return (List) super.setCallback(callback);
        }

        @Override
        public List setFields(java.lang.String fields) {
          return (List) super.setFields(fields);
        }

        @Override
        public List setKey(java.lang.String key) {
          return (List) super.setKey(key);
        }

        @Override
        public List setOauthToken(java.lang.String oauthToken) {
          return (List) super.setOauthToken(oauthToken);
        }

        @Override
        public List setPrettyPrint(java.lang.Boolean prettyPrint) {
          return (List) super.setPrettyPrint(prettyPrint);
        }

        @Override
        public List setQuotaUser(java.lang.String quotaUser) {
          return (List) super.setQuotaUser(quotaUser);
        }

        @Override
        public List setUploadType(java.lang.String uploadType) {
          return (List) super.setUploadType(uploadType);
        }

        @Override
        public List setUploadProtocol(java.lang.String uploadProtocol) {
          return (List) super.setUploadProtocol(uploadProtocol);
        }

        /** Required. Resource name for the project. Format: `projects/{project_id}` */
        @com.google.api.client.util.Key
        private java.lang.String name;

        /** Required. Resource name for the project. Format: `projects/{project_id}`
         */
        public java.lang.String getName() {
          return name;
        }

        /** Required. Resource name for the project. Format: `projects/{project_id}` */
        public List setName(java.lang.String name) {
          if (!getSuppressPatternChecks()) {
            com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
                "Parameter name must conform to the pattern " +
                "^projects/[^/]+$");
          }
          this.name = name;
          return this;
        }

        /**
         * `Ruleset` filter. The list method supports filters with restrictions on `Ruleset.name`.
         * Filters on `Ruleset.create_time` should use the `date` function which parses strings that
         * conform to the RFC 3339 date/time specifications. Example: `create_time >
         * date("2017-01-01T00:00:00Z") AND name=UUID-*`
         */
        @com.google.api.client.util.Key
        private java.lang.String filter;

        /**` Ruleset` filter. The list method supports filters with restrictions on `Ruleset.name`. Filters on
      ` `Ruleset.create_time` should use the `date` function which parses strings that conform to the RFC
      ` 3339 date/time specifications. Example: `create_time > date("2017-01-01T00:00:00Z") AND
      ` name=UUID-*`
      `

         */
        public java.lang.String getFilter() {
          return filter;
        }

        /**
         * `Ruleset` filter. The list method supports filters with restrictions on `Ruleset.name`.
         * Filters on `Ruleset.create_time` should use the `date` function which parses strings that
         * conform to the RFC 3339 date/time specifications. Example: `create_time >
         * date("2017-01-01T00:00:00Z") AND name=UUID-*`
         */
        public List setFilter(java.lang.String filter) {
          this.filter = filter;
          return this;
        }

        /**
         * Page size to load. Maximum of 100. Defaults to 10. Note: `page_size` is just a hint and
         * the service may choose to load less than `page_size` due to the size of the output. To
         * traverse all of the releases, caller should iterate until the `page_token` is empty.
         */
        @com.google.api.client.util.Key
        private java.lang.Integer pageSize;

        /** Page size to load. Maximum of 100. Defaults to 10. Note: `page_size` is just a hint and the service
       may choose to load less than `page_size` due to the size of the output. To traverse all of the
       releases, caller should iterate until the `page_token` is empty.
         */
        public java.lang.Integer getPageSize() {
          return pageSize;
        }

        /**
         * Page size to load. Maximum of 100. Defaults to 10. Note: `page_size` is just a hint and
         * the service may choose to load less than `page_size` due to the size of the output. To
         * traverse all of the releases, caller should iterate until the `page_token` is empty.
         */
        public List setPageSize(java.lang.Integer pageSize) {
          this.pageSize = pageSize;
          return this;
        }

        /** Next page token for loading the next batch of `Ruleset` instances. */
        @com.google.api.client.util.Key
        private java.lang.String pageToken;

        /** Next page token for loading the next batch of `Ruleset` instances.
         */
        public java.lang.String getPageToken() {
          return pageToken;
        }

        /** Next page token for loading the next batch of `Ruleset` instances. */
        public List setPageToken(java.lang.String pageToken) {
          this.pageToken = pageToken;
          return this;
        }

        @Override
        public List set(String parameterName, Object value) {
          return (List) super.set(parameterName, value);
        }
      }

    }
  }

  /**
   * Builder for {@link FirebaseRules}.
   *
   * <p>
   * Implementation is not thread-safe.
   * </p>
   *
   * @since 1.3.0
   */
  public static final class Builder extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder {

    private static String chooseEndpoint(com.google.api.client.http.HttpTransport transport) {
      // If the GOOGLE_API_USE_MTLS_ENDPOINT environment variable value is "always", use mTLS endpoint.
      // If the env variable is "auto", use mTLS endpoint if and only if the transport is mTLS.
      // Use the regular endpoint for all other cases.
      String useMtlsEndpoint = System.getenv("GOOGLE_API_USE_MTLS_ENDPOINT");
      useMtlsEndpoint = useMtlsEndpoint == null ? "auto" : useMtlsEndpoint;
      if ("always".equals(useMtlsEndpoint) || ("auto".equals(useMtlsEndpoint) && transport != null && transport.isMtls())) {
        return DEFAULT_MTLS_ROOT_URL;
      }
      return DEFAULT_ROOT_URL;
    }

    /**
     * Returns an instance of a new builder.
     *
     * @param transport HTTP transport, which should normally be:
     *        <ul>
     *        <li>Google App Engine:
     *        {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
     *        <li>Android: {@code newCompatibleTransport} from
     *        {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
     *        <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
     *        </li>
     *        </ul>
     * @param jsonFactory JSON factory, which may be:
     *        <ul>
     *        <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
     *        <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
     *        <li>Android Honeycomb or higher:
     *        {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
     *        </ul>
     * @param httpRequestInitializer HTTP request initializer or {@code null} for none
     * @since 1.7
     */
    public Builder(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
        com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
      super(
          transport,
          jsonFactory,
          Builder.chooseEndpoint(transport),
          DEFAULT_SERVICE_PATH,
          httpRequestInitializer,
          false);
      setBatchPath(DEFAULT_BATCH_PATH);
    }

    /** Builds a new instance of {@link FirebaseRules}. */
    @Override
    public FirebaseRules build() {
      return new FirebaseRules(this);
    }

    @Override
    public Builder setRootUrl(String rootUrl) {
      return (Builder) super.setRootUrl(rootUrl);
    }

    @Override
    public Builder setServicePath(String servicePath) {
      return (Builder) super.setServicePath(servicePath);
    }

    @Override
    public Builder setBatchPath(String batchPath) {
      return (Builder) super.setBatchPath(batchPath);
    }

    @Override
    public Builder setHttpRequestInitializer(com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
      return (Builder) super.setHttpRequestInitializer(httpRequestInitializer);
    }

    @Override
    public Builder setApplicationName(String applicationName) {
      return (Builder) super.setApplicationName(applicationName);
    }

    @Override
    public Builder setSuppressPatternChecks(boolean suppressPatternChecks) {
      return (Builder) super.setSuppressPatternChecks(suppressPatternChecks);
    }

    @Override
    public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) {
      return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks);
    }

    @Override
    public Builder setSuppressAllChecks(boolean suppressAllChecks) {
      return (Builder) super.setSuppressAllChecks(suppressAllChecks);
    }

    /**
     * Set the {@link FirebaseRulesRequestInitializer}.
     *
     * @since 1.12
     */
    public Builder setFirebaseRulesRequestInitializer(
        FirebaseRulesRequestInitializer firebaserulesRequestInitializer) {
      return (Builder) super.setGoogleClientRequestInitializer(firebaserulesRequestInitializer);
    }

    @Override
    public Builder setGoogleClientRequestInitializer(
        com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) {
      return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer);
    }
  }
}
