# Cloud SQL Administration API . instances

## Instance Methods

Deletes a database instance.

Exports data from a database instance to a Google Cloud Storage bucket as a MySQL dump file.

Retrieves a resource containing information about a database instance.

Imports data into a database instance from a MySQL dump file in Google Cloud Storage.

Creates a new database instance.

Lists instances under a given project in the alphabetical order of the instance name.

Retrieves the next page of results.

Updates settings of a database instance. Caution: This is not a partial update, so you must include values for all the settings that you want to retain. For partial updates, use patch.. This method supports patch semantics.

Restarts a database instance.

Restores a backup of a database instance.

Updates settings of a database instance. Caution: This is not a partial update, so you must include values for all the settings that you want to retain. For partial updates, use patch.

### Method Details

`delete(project, instance)`

    Deletes a database instance.

    Args:
      project: string, Project ID of the project that contains the instance to be deleted. You can find this on the project summary page of the Google APIs Console. (required)
      instance: string, Database instance ID. This does not include the project ID. (required)

    Returns:
      An object of the form:

        { # Database instance delete response.
        "kind": "sql#instancesDelete", # This is always sql#instancesDelete.
        "operation": "A String", # An identifier that uniquely identifies the operation. You can use this identifier to retrieve the Operations resource that has information about the operation.
      }

`export(project, instance, body)`

    Exports data from a database instance to a Google Cloud Storage bucket as a MySQL dump file.

    Args:
      project: string, Project ID of the project that contains the instance to be exported. You can find this on the project summary page of the Google APIs Console. (required)
      instance: string, Database instance ID. This does not include the project ID. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # Database instance export request.
        "exportContext": { # Database instance export context. # Contains details about the export operation.
          "table": [ # Tables to export, or that were exported, from the specified database. If you specify tables, specify one and only one database.
            "A String",
          ],
          "kind": "sql#exportContext", # This is always sql#exportContext.
          "uri": "A String", # The path to the file in Google Cloud Storage where the export will be stored, or where it was already stored. The URI is in the form gs://bucketName/fileName. If the file already exists, the operation fails. If the filename ends with .gz, the contents are compressed.
          "database": [ # Databases (for example, guestbook) from which the export is made. If unspecified, all databases are exported.
            "A String",
          ],
        },
      }

    Returns:
      An object of the form:

        { # Database instance export response.
        "kind": "sql#instancesExport", # This is always sql#instancesExport.
        "operation": "A String", # An identifier that uniquely identifies the operation. You can use this identifier to retrieve the Operations resource that has information about the operation.
      }

`get(project, instance)`

    Retrieves a resource containing information about a database instance.

    Args:
      project: string, Project ID of the project that contains the instance. You can find this on the project summary page of the Google APIs Console. (required)
      instance: string, Database instance ID. This does not include the project ID. (required)

    Returns:
      An object of the form:

        { # A database instance resource.
          "project": "A String", # The project ID of the project containing the database instance. The Google apps domain is prefixed if applicable. You can find this on the project summary page of the Google APIs Console.
          "kind": "sql#instance", # This is always sql#instance.
          "maxDiskSize": "A String", # The maximum disk size of the instance in bytes.
          "settings": { # Database instance settings. # The user settings.
            "kind": "sql#settings", # This is always sql#settings.
            "authorizedGaeApplications": [ # The AppEngine app ids that can access this instance.
              "A String",
            ],
            "activationPolicy": "A String", # The activation policy for this instance. This specifies when the instance should be activated and is applicable only when the instance state is RUNNABLE. This can be one of the following.
                # ALWAYS: The instance should always be active.
                # NEVER: The instance should never be activated.
                # ON_DEMAND: The instance is activated upon receiving requests.
            "backupConfiguration": [ # The daily backup configuration for the instance.
              { # Database instance backup configuration.
                "kind": "sql#backupConfiguration", # This is always sql#backupConfiguration.
                "enabled": True or False, # Whether this configuration is enabled.
                "id": "A String", # Identifier for this configuration. This gets generated automatically when a backup configuration is created.
                "startTime": "A String", # Start time for the daily backup configuration in UTC timezone in the 24 hour format - HH:MM.
              },
            ],
            "pricingPlan": "A String", # The pricing plan for this instance. This can be either PER_USE or PACKAGE.
            "replicationType": "A String", # The type of replication this instance uses. This can be either ASYNCHRONOUS or SYNCHRONOUS.
            "tier": "A String", # The tier of service for this instance, for example D1, D2. For more information, see pricing.
          },
          "region": "A String", # The geographical region. Can be us-east1 or europe-west1. Defaults to us-east1. The region can not be changed after instance creation.
          "currentDiskSize": "A String", # The current disk usage of the instance in bytes.
          "instance": "A String", # Name of the database instance. This does not include the project ID.
          "state": "A String", # The current serving state of the database instance. This can be one of the following.
              # RUNNABLE: The instance is running, or is ready to run when accessed.
              # SUSPENDED: The instance is not available, for example due to problems with billing.
              # PENDING_CREATE: The instance is being created.
              # MAINTENANCE: The instance is down for maintenance.
              # UNKNOWN_STATE: The state of the instance is unknown.
          "etag": "A String", # Etag for this resource - a version number for the settings object in this resource. This field has no effect when passed as a request parameter. Instead, the contents of this field should be passed in an 'If-Match' http header for use in optimistic locking.
          "databaseVersion": "A String", # The database engine type and version, for example MYSQL_5_5 for MySQL 5.5.
        }

`import_(project, instance, body)`

    Imports data into a database instance from a MySQL dump file in Google Cloud Storage.

    Args:
      project: string, Project ID of the project that contains the instance. You can find this on the project summary page of the Google APIs Console. (required)
      instance: string, Database instance ID. This does not include the project ID. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # Database instance import request.
        "importContext": { # Database instance import context. # Contains details about the import operation.
          "kind": "sql#importContext", # This is always sql#importContext.
          "uri": [ # A path to the MySQL dump file in Google Cloud Storage from which the import is made. The URI is in the form gs://bucketName/fileName. Compressed gzip files (.gz) are also supported.
            "A String",
          ],
          "database": "A String", # The database (for example, guestbook) to which the import is made. If not set, it is assumed that the database is specified in the file to be imported.
        },
      }

    Returns:
      An object of the form:

        { # Database instance import response.
        "kind": "sql#instancesImport", # This is always sql#instancesImport.
        "operation": "A String", # An identifier that uniquely identifies the operation. You can use this identifier to retrieve the Operations resource that has information about the operation.
      }

`insert(project, body)`

    Creates a new database instance.

    Args:
      project: string, Project ID of the project to which the newly created database instances should belong. You can find this on the project summary page of the Google APIs Console. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # A database instance resource.
        "project": "A String", # The project ID of the project containing the database instance. The Google apps domain is prefixed if applicable. You can find this on the project summary page of the Google APIs Console.
        "kind": "sql#instance", # This is always sql#instance.
        "maxDiskSize": "A String", # The maximum disk size of the instance in bytes.
        "settings": { # Database instance settings. # The user settings.
          "kind": "sql#settings", # This is always sql#settings.
          "authorizedGaeApplications": [ # The AppEngine app ids that can access this instance.
            "A String",
          ],
          "activationPolicy": "A String", # The activation policy for this instance. This specifies when the instance should be activated and is applicable only when the instance state is RUNNABLE. This can be one of the following.
              # ALWAYS: The instance should always be active.
              # NEVER: The instance should never be activated.
              # ON_DEMAND: The instance is activated upon receiving requests.
          "backupConfiguration": [ # The daily backup configuration for the instance.
            { # Database instance backup configuration.
              "kind": "sql#backupConfiguration", # This is always sql#backupConfiguration.
              "enabled": True or False, # Whether this configuration is enabled.
              "id": "A String", # Identifier for this configuration. This gets generated automatically when a backup configuration is created.
              "startTime": "A String", # Start time for the daily backup configuration in UTC timezone in the 24 hour format - HH:MM.
            },
          ],
          "pricingPlan": "A String", # The pricing plan for this instance. This can be either PER_USE or PACKAGE.
          "replicationType": "A String", # The type of replication this instance uses. This can be either ASYNCHRONOUS or SYNCHRONOUS.
          "tier": "A String", # The tier of service for this instance, for example D1, D2. For more information, see pricing.
        },
        "region": "A String", # The geographical region. Can be us-east1 or europe-west1. Defaults to us-east1. The region can not be changed after instance creation.
        "currentDiskSize": "A String", # The current disk usage of the instance in bytes.
        "instance": "A String", # Name of the database instance. This does not include the project ID.
        "state": "A String", # The current serving state of the database instance. This can be one of the following.
            # RUNNABLE: The instance is running, or is ready to run when accessed.
            # SUSPENDED: The instance is not available, for example due to problems with billing.
            # PENDING_CREATE: The instance is being created.
            # MAINTENANCE: The instance is down for maintenance.
            # UNKNOWN_STATE: The state of the instance is unknown.
        "etag": "A String", # Etag for this resource - a version number for the settings object in this resource. This field has no effect when passed as a request parameter. Instead, the contents of this field should be passed in an 'If-Match' http header for use in optimistic locking.
        "databaseVersion": "A String", # The database engine type and version, for example MYSQL_5_5 for MySQL 5.5.
      }

    Returns:
      An object of the form:

        { # Database instance insert response.
        "kind": "sql#instancesInsert", # This is always sql#instancesInsert.
        "operation": "A String", # An identifier that uniquely identifies the operation. You can use this identifier to retrieve the Operations resource that has information about the operation.
      }

`list(project, pageToken=None, maxResults=None)`

    Lists instances under a given project in the alphabetical order of the instance name.

    Args:
      project: string, Project ID of the project for which to list database instances. You can find this on the project summary page of the Google APIs Console. (required)
      pageToken: string, A previously-returned page token representing part of the larger set of results to view.
      maxResults: integer, The maximum number of results to return per response.

    Returns:
      An object of the form:

        { # Database instances list response.
        "nextPageToken": "A String", # The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results.
        "items": [ # List of database instance resources.
          { # A database instance resource.
              "project": "A String", # The project ID of the project containing the database instance. The Google apps domain is prefixed if applicable. You can find this on the project summary page of the Google APIs Console.
              "kind": "sql#instance", # This is always sql#instance.
              "maxDiskSize": "A String", # The maximum disk size of the instance in bytes.
              "settings": { # Database instance settings. # The user settings.
                "kind": "sql#settings", # This is always sql#settings.
                "authorizedGaeApplications": [ # The AppEngine app ids that can access this instance.
                  "A String",
                ],
                "activationPolicy": "A String", # The activation policy for this instance. This specifies when the instance should be activated and is applicable only when the instance state is RUNNABLE. This can be one of the following.
                    # ALWAYS: The instance should always be active.
                    # NEVER: The instance should never be activated.
                    # ON_DEMAND: The instance is activated upon receiving requests.
                "backupConfiguration": [ # The daily backup configuration for the instance.
                  { # Database instance backup configuration.
                    "kind": "sql#backupConfiguration", # This is always sql#backupConfiguration.
                    "enabled": True or False, # Whether this configuration is enabled.
                    "id": "A String", # Identifier for this configuration. This gets generated automatically when a backup configuration is created.
                    "startTime": "A String", # Start time for the daily backup configuration in UTC timezone in the 24 hour format - HH:MM.
                  },
                ],
                "pricingPlan": "A String", # The pricing plan for this instance. This can be either PER_USE or PACKAGE.
                "replicationType": "A String", # The type of replication this instance uses. This can be either ASYNCHRONOUS or SYNCHRONOUS.
                "tier": "A String", # The tier of service for this instance, for example D1, D2. For more information, see pricing.
              },
              "region": "A String", # The geographical region. Can be us-east1 or europe-west1. Defaults to us-east1. The region can not be changed after instance creation.
              "currentDiskSize": "A String", # The current disk usage of the instance in bytes.
              "instance": "A String", # Name of the database instance. This does not include the project ID.
              "state": "A String", # The current serving state of the database instance. This can be one of the following.
                  # RUNNABLE: The instance is running, or is ready to run when accessed.
                  # SUSPENDED: The instance is not available, for example due to problems with billing.
                  # PENDING_CREATE: The instance is being created.
                  # MAINTENANCE: The instance is down for maintenance.
                  # UNKNOWN_STATE: The state of the instance is unknown.
              "etag": "A String", # Etag for this resource - a version number for the settings object in this resource. This field has no effect when passed as a request parameter. Instead, the contents of this field should be passed in an 'If-Match' http header for use in optimistic locking.
              "databaseVersion": "A String", # The database engine type and version, for example MYSQL_5_5 for MySQL 5.5.
            },
        ],
        "kind": "sql#instancesList", # This is always sql#instancesList.
      }

`list_next(previous_request, previous_response)`

    Retrieves the next page of results.

    Args:
      previous_request: The request for the previous page. (required)
      previous_response: The response from the request for the previous page. (required)

    Returns:
      A request object that you can call 'execute()' on to request the next
      page. Returns None if there are no more items in the collection.

`patch(project, instance, body)`

    Updates settings of a database instance. Caution: This is not a partial update, so you must include values for all the settings that you want to retain. For partial updates, use patch.. This method supports patch semantics.

    Args:
      project: string, Project ID of the project that contains the instance. You can find this on the project summary page of the Google APIs Console. (required)
      instance: string, Database instance ID. This does not include the project ID. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # A database instance resource.
        "project": "A String", # The project ID of the project containing the database instance. The Google apps domain is prefixed if applicable. You can find this on the project summary page of the Google APIs Console.
        "kind": "sql#instance", # This is always sql#instance.
        "maxDiskSize": "A String", # The maximum disk size of the instance in bytes.
        "settings": { # Database instance settings. # The user settings.
          "kind": "sql#settings", # This is always sql#settings.
          "authorizedGaeApplications": [ # The AppEngine app ids that can access this instance.
            "A String",
          ],
          "activationPolicy": "A String", # The activation policy for this instance. This specifies when the instance should be activated and is applicable only when the instance state is RUNNABLE. This can be one of the following.
              # ALWAYS: The instance should always be active.
              # NEVER: The instance should never be activated.
              # ON_DEMAND: The instance is activated upon receiving requests.
          "backupConfiguration": [ # The daily backup configuration for the instance.
            { # Database instance backup configuration.
              "kind": "sql#backupConfiguration", # This is always sql#backupConfiguration.
              "enabled": True or False, # Whether this configuration is enabled.
              "id": "A String", # Identifier for this configuration. This gets generated automatically when a backup configuration is created.
              "startTime": "A String", # Start time for the daily backup configuration in UTC timezone in the 24 hour format - HH:MM.
            },
          ],
          "pricingPlan": "A String", # The pricing plan for this instance. This can be either PER_USE or PACKAGE.
          "replicationType": "A String", # The type of replication this instance uses. This can be either ASYNCHRONOUS or SYNCHRONOUS.
          "tier": "A String", # The tier of service for this instance, for example D1, D2. For more information, see pricing.
        },
        "region": "A String", # The geographical region. Can be us-east1 or europe-west1. Defaults to us-east1. The region can not be changed after instance creation.
        "currentDiskSize": "A String", # The current disk usage of the instance in bytes.
        "instance": "A String", # Name of the database instance. This does not include the project ID.
        "state": "A String", # The current serving state of the database instance. This can be one of the following.
            # RUNNABLE: The instance is running, or is ready to run when accessed.
            # SUSPENDED: The instance is not available, for example due to problems with billing.
            # PENDING_CREATE: The instance is being created.
            # MAINTENANCE: The instance is down for maintenance.
            # UNKNOWN_STATE: The state of the instance is unknown.
        "etag": "A String", # Etag for this resource - a version number for the settings object in this resource. This field has no effect when passed as a request parameter. Instead, the contents of this field should be passed in an 'If-Match' http header for use in optimistic locking.
        "databaseVersion": "A String", # The database engine type and version, for example MYSQL_5_5 for MySQL 5.5.
      }

    Returns:
      An object of the form:

        { # Database instance update response.
        "kind": "sql#instancesUpdate", # This is always sql#instancesUpdate.
        "operation": "A String", # An identifier that uniquely identifies the operation. You can use this identifier to retrieve information about the operation.
      }

`restart(project, instance)`

    Restarts a database instance.

    Args:
      project: string, Project ID of the project that contains the instance to be restarted. You can find this on the project summary page of the Google APIs Console. (required)
      instance: string, Database instance ID. This does not include the project ID. (required)

    Returns:
      An object of the form:

        { # Database instance restart response.
        "kind": "sql#instancesRestart", # This is always sql#instancesRestart.
        "operation": "A String", # An identifier that uniquely identifies the operation. You can use this identifier to retrieve the Operations resource that has information about the operation.
      }

`restoreBackup(project, instance, backupConfiguration, dueTime)`

    Restores a backup of a database instance.

    Args:
      project: string, Project ID of the project that contains the instance. You can find this on the project summary page of the Google APIs Console. (required)
      instance: string, Database instance ID. This does not include the project ID. (required)
      backupConfiguration: string, The identifier of the backup configuration. This gets generated automatically when a backup configuration is created. (required)
      dueTime: string, The time when this run is due to start in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. (required)

    Returns:
      An object of the form:

        { # Database instance restore backup response.
        "kind": "sql#instancesRestoreBackup", # This is always sql#instancesRestoreBackup.
        "operation": "A String", # An identifier that uniquely identifies the operation. You can use this identifier to retrieve the Operations resource that has information about the operation.
      }

`update(project, instance, body)`

    Updates settings of a database instance. Caution: This is not a partial update, so you must include values for all the settings that you want to retain. For partial updates, use patch.

    Args:
      project: string, Project ID of the project that contains the instance. You can find this on the project summary page of the Google APIs Console. (required)
      instance: string, Database instance ID. This does not include the project ID. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # A database instance resource.
        "project": "A String", # The project ID of the project containing the database instance. The Google apps domain is prefixed if applicable. You can find this on the project summary page of the Google APIs Console.
        "kind": "sql#instance", # This is always sql#instance.
        "maxDiskSize": "A String", # The maximum disk size of the instance in bytes.
        "settings": { # Database instance settings. # The user settings.
          "kind": "sql#settings", # This is always sql#settings.
          "authorizedGaeApplications": [ # The AppEngine app ids that can access this instance.
            "A String",
          ],
          "activationPolicy": "A String", # The activation policy for this instance. This specifies when the instance should be activated and is applicable only when the instance state is RUNNABLE. This can be one of the following.
              # ALWAYS: The instance should always be active.
              # NEVER: The instance should never be activated.
              # ON_DEMAND: The instance is activated upon receiving requests.
          "backupConfiguration": [ # The daily backup configuration for the instance.
            { # Database instance backup configuration.
              "kind": "sql#backupConfiguration", # This is always sql#backupConfiguration.
              "enabled": True or False, # Whether this configuration is enabled.
              "id": "A String", # Identifier for this configuration. This gets generated automatically when a backup configuration is created.
              "startTime": "A String", # Start time for the daily backup configuration in UTC timezone in the 24 hour format - HH:MM.
            },
          ],
          "pricingPlan": "A String", # The pricing plan for this instance. This can be either PER_USE or PACKAGE.
          "replicationType": "A String", # The type of replication this instance uses. This can be either ASYNCHRONOUS or SYNCHRONOUS.
          "tier": "A String", # The tier of service for this instance, for example D1, D2. For more information, see pricing.
        },
        "region": "A String", # The geographical region. Can be us-east1 or europe-west1. Defaults to us-east1. The region can not be changed after instance creation.
        "currentDiskSize": "A String", # The current disk usage of the instance in bytes.
        "instance": "A String", # Name of the database instance. This does not include the project ID.
        "state": "A String", # The current serving state of the database instance. This can be one of the following.
            # RUNNABLE: The instance is running, or is ready to run when accessed.
            # SUSPENDED: The instance is not available, for example due to problems with billing.
            # PENDING_CREATE: The instance is being created.
            # MAINTENANCE: The instance is down for maintenance.
            # UNKNOWN_STATE: The state of the instance is unknown.
        "etag": "A String", # Etag for this resource - a version number for the settings object in this resource. This field has no effect when passed as a request parameter. Instead, the contents of this field should be passed in an 'If-Match' http header for use in optimistic locking.
        "databaseVersion": "A String", # The database engine type and version, for example MYSQL_5_5 for MySQL 5.5.
      }

    Returns:
      An object of the form:

        { # Database instance update response.
        "kind": "sql#instancesUpdate", # This is always sql#instancesUpdate.
        "operation": "A String", # An identifier that uniquely identifies the operation. You can use this identifier to retrieve information about the operation.
      }