Class CosmosClientProxy

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class CosmosClientProxy
    extends Object
    implements Closeable
    Proxy class which delegates method calls to client CosmosClient.

    It is required in order to stub and do not depend on implementation

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close this CosmosClient instance.
      com.azure.cosmos.models.CosmosDatabaseResponse createDatabase​(com.azure.cosmos.models.CosmosDatabaseProperties databaseProperties)
      Creates a Cosmos database.
      com.azure.cosmos.models.CosmosDatabaseResponse createDatabase​(com.azure.cosmos.models.CosmosDatabaseProperties databaseProperties, com.azure.cosmos.models.CosmosDatabaseRequestOptions options)
      Creates a database.
      com.azure.cosmos.models.CosmosDatabaseResponse createDatabase​(com.azure.cosmos.models.CosmosDatabaseProperties databaseProperties, com.azure.cosmos.models.ThroughputProperties throughputProperties)
      Creates a Cosmos database.
      com.azure.cosmos.models.CosmosDatabaseResponse createDatabase​(com.azure.cosmos.models.CosmosDatabaseProperties databaseProperties, com.azure.cosmos.models.ThroughputProperties throughputProperties, com.azure.cosmos.models.CosmosDatabaseRequestOptions options)
      Creates a Cosmos database.
      com.azure.cosmos.models.CosmosDatabaseResponse createDatabase​(String id)
      Creates a Cosmos database.
      com.azure.cosmos.models.CosmosDatabaseResponse createDatabase​(String id, com.azure.cosmos.models.ThroughputProperties throughputProperties)
      Creates a Cosmos database.
      com.azure.cosmos.models.CosmosDatabaseResponse createDatabaseIfNotExists​(String id)
      Create a Cosmos database if it does not already exist on the service.
      com.azure.cosmos.models.CosmosDatabaseResponse createDatabaseIfNotExists​(String id, com.azure.cosmos.models.ThroughputProperties throughputProperties)
      Create a Cosmos database if it does not already exist on the service.
      com.azure.cosmos.CosmosDatabase getDatabase​(String id)
      Gets the Cosmos database client.
      com.azure.cosmos.util.CosmosPagedIterable<com.azure.cosmos.models.CosmosDatabaseProperties> queryDatabases​(com.azure.cosmos.models.SqlQuerySpec querySpec, com.azure.cosmos.models.CosmosQueryRequestOptions options)
      Query a Cosmos database.
      com.azure.cosmos.util.CosmosPagedIterable<com.azure.cosmos.models.CosmosDatabaseProperties> queryDatabases​(String query, com.azure.cosmos.models.CosmosQueryRequestOptions options)
      Query a Cosmos database.
      com.azure.cosmos.util.CosmosPagedIterable<com.azure.cosmos.models.CosmosDatabaseProperties> readAllDatabases()
      Reads all Cosmos databases.
    • Constructor Detail

      • CosmosClientProxy

        public CosmosClientProxy()
    • Method Detail

      • createDatabaseIfNotExists

        public com.azure.cosmos.models.CosmosDatabaseResponse createDatabaseIfNotExists​(String id,
                                                                                        com.azure.cosmos.models.ThroughputProperties throughputProperties)
        Create a Cosmos database if it does not already exist on the service.

        The throughputProperties will only be used if the specified database does not exist and therefore a new database will be created with throughputProperties.

        Parameters:
        id - the id of the database.
        throughputProperties - the throughputProperties.
        Returns:
        the CosmosDatabaseResponse with the created database.
      • createDatabaseIfNotExists

        public com.azure.cosmos.models.CosmosDatabaseResponse createDatabaseIfNotExists​(String id)
        Create a Cosmos database if it does not already exist on the service.
        Parameters:
        id - the id of the database.
        Returns:
        the CosmosDatabaseResponse with the created database.
      • createDatabase

        public com.azure.cosmos.models.CosmosDatabaseResponse createDatabase​(com.azure.cosmos.models.CosmosDatabaseProperties databaseProperties,
                                                                             com.azure.cosmos.models.CosmosDatabaseRequestOptions options)
        Creates a database.
        Parameters:
        databaseProperties - CosmosDatabaseProperties the database properties.
        options - the request options.
        Returns:
        the CosmosDatabaseResponse with the created database.
      • createDatabase

        public com.azure.cosmos.models.CosmosDatabaseResponse createDatabase​(com.azure.cosmos.models.CosmosDatabaseProperties databaseProperties)
        Creates a Cosmos database.
        Parameters:
        databaseProperties - CosmosDatabaseProperties the database properties.
        Returns:
        the CosmosDatabaseResponse with the created database.
      • createDatabase

        public com.azure.cosmos.models.CosmosDatabaseResponse createDatabase​(String id)
        Creates a Cosmos database.
        Parameters:
        id - the id of the database.
        Returns:
        the CosmosDatabaseResponse with the created database.
      • createDatabase

        public com.azure.cosmos.models.CosmosDatabaseResponse createDatabase​(com.azure.cosmos.models.CosmosDatabaseProperties databaseProperties,
                                                                             com.azure.cosmos.models.ThroughputProperties throughputProperties,
                                                                             com.azure.cosmos.models.CosmosDatabaseRequestOptions options)
        Creates a Cosmos database.
        Parameters:
        databaseProperties - CosmosDatabaseProperties the database properties.
        throughputProperties - the throughput properties.
        options - CosmosDatabaseRequestOptions the request options.
        Returns:
        the CosmosDatabaseResponse with the created database.
      • createDatabase

        public com.azure.cosmos.models.CosmosDatabaseResponse createDatabase​(com.azure.cosmos.models.CosmosDatabaseProperties databaseProperties,
                                                                             com.azure.cosmos.models.ThroughputProperties throughputProperties)
        Creates a Cosmos database.
        Parameters:
        databaseProperties - CosmosDatabaseProperties the database properties.
        throughputProperties - the throughput properties.
        Returns:
        the CosmosDatabaseResponse with the created database.
      • createDatabase

        public com.azure.cosmos.models.CosmosDatabaseResponse createDatabase​(String id,
                                                                             com.azure.cosmos.models.ThroughputProperties throughputProperties)
        Creates a Cosmos database.
        Parameters:
        id - the id of the database.
        throughputProperties - the throughput properties.
        Returns:
        the CosmosDatabaseResponse with the created database.
      • readAllDatabases

        public com.azure.cosmos.util.CosmosPagedIterable<com.azure.cosmos.models.CosmosDatabaseProperties> readAllDatabases()
        Reads all Cosmos databases.
        Returns:
        the CosmosPagedIterable for feed response with the read databases.
      • queryDatabases

        public com.azure.cosmos.util.CosmosPagedIterable<com.azure.cosmos.models.CosmosDatabaseProperties> queryDatabases​(String query,
                                                                                                                          com.azure.cosmos.models.CosmosQueryRequestOptions options)
        Query a Cosmos database.
        Parameters:
        query - the query.
        options - CosmosQueryRequestOptionsthe feed options.
        Returns:
        the CosmosPagedIterable for feed response with the obtained databases.
      • queryDatabases

        public com.azure.cosmos.util.CosmosPagedIterable<com.azure.cosmos.models.CosmosDatabaseProperties> queryDatabases​(com.azure.cosmos.models.SqlQuerySpec querySpec,
                                                                                                                          com.azure.cosmos.models.CosmosQueryRequestOptions options)
        Query a Cosmos database.
        Parameters:
        querySpec - SqlQuerySpec the query spec.
        options - the query request options.
        Returns:
        the CosmosPagedIterable for feed response with the obtained databases.
      • getDatabase

        public com.azure.cosmos.CosmosDatabase getDatabase​(String id)
        Gets the Cosmos database client.
        Parameters:
        id - the id of the database.
        Returns:
        CosmosDatabase the cosmos sync database.