func (s *SpannerBroker) Deprovision(ctx context.Context, instance models.ServiceInstanceDetails, details brokerapi.DeprovisionDetails) (*string, error) {
	client, err := s.createAdminClient(ctx)
	if err != nil {
		return nil, err
	}
	err = client.DeleteInstance(ctx, &instancepb.DeleteInstanceRequest{
		Name: s.qualifiedInstanceName(instance.Name),
	})
	if err != nil {
		return nil, fmt.Errorf("Error deleting instance: %s", err)
	}
	return nil, nil
}
Deprovision deletes the Spanner instance associated with the given instance.
package spanner
import (
	"context"
	"fmt"
	googlespanner "cloud.google.com/go/spanner/admin/instance/apiv1"
	"github.com/GoogleCloudPlatform/gcp-service-broker/pkg/providers/builtin/base"
	"github.com/GoogleCloudPlatform/gcp-service-broker/db_service/models"
	"github.com/GoogleCloudPlatform/gcp-service-broker/pkg/varcontext"
	"github.com/GoogleCloudPlatform/gcp-service-broker/utils"
	"github.com/pivotal-cf/brokerapi"
	"google.golang.org/api/option"
	instancepb "google.golang.org/genproto/googleapis/spanner/admin/instance/v1"
)
type SpannerBroker struct {
	base.BrokerBase
}
type InstanceInformation struct {
	InstanceId string `json:"instance_id"`
}
func (s *SpannerBroker) Provision(ctx context.Context, provisionContext *varcontext.VarContext) (models.ServiceInstanceDetails, error) {
	instanceName := provisionContext.GetString("name")
	instanceLocation := fmt.Sprintf("projects/%s/instanceConfigs/%s", s.ProjectId, provisionContext.GetString("location"))
	creationRequest := instancepb.CreateInstanceRequest{
		Parent:     "projects/" + s.ProjectId,
		InstanceId: instanceName,
		Instance: &instancepb.Instance{
			Name:        s.qualifiedInstanceName(instanceName),
			DisplayName: provisionContext.GetString("display_name"),
			NodeCount:   int32(provisionContext.GetInt("num_nodes")),
			Config:      instanceLocation,
			Labels:      provisionContext.GetStringMapString("labels"),
		},
	}
	if err := provisionContext.Error(); err != nil {
		return models.ServiceInstanceDetails{}, err
	}
	client, err := s.createAdminClient(ctx)
	if err != nil {
		return models.ServiceInstanceDetails{}, err
	}
	op, err := client.CreateInstance(ctx, &creationRequest)
	if err != nil {
		return models.ServiceInstanceDetails{}, fmt.Errorf("Error creating instance: %s", err)
	}
	ii := InstanceInformation{
		InstanceId: instanceName,
	}
	id := models.ServiceInstanceDetails{
		Name:          instanceName,
		Url:           "",
		Location:      instanceLocation,
		OperationType: models.ProvisionOperationType,
		OperationId:   op.Name(),
	}
	if err := id.SetOtherDetails(ii); err != nil {
		return models.ServiceInstanceDetails{}, err
	}
	return id, nil
}
func (s *SpannerBroker) PollInstance(ctx context.Context, instance models.ServiceInstanceDetails) (bool, error) {
	if instance.OperationType == models.ClearOperationType {
		return false, fmt.Errorf("No pending operations could be found for this Spanner instance.")
	}
	if instance.OperationType != models.ProvisionOperationType {
		return false, fmt.Errorf("Couldn't poll Spanner instance, unknown operation type: %s", instance.OperationType)
	}
	client, err := s.createAdminClient(ctx)
	if err != nil {
		return false, err
	}
	spannerOp := client.CreateInstanceOperation(instance.OperationId)
	_, err = spannerOp.Poll(ctx)
	done := spannerOp.Done()
	switch {
	case err != nil && !done:  
		return false, fmt.Errorf("Error checking operation status: %s", err)
	case err != nil && done:  
		return true, fmt.Errorf("Error provisioning instance: %v", err)
	case err == nil && done:  
		return true, nil
	default:  
		return false, nil
	}
}