public static object CreateDevInstance()

in bigtable/api/InstanceAdminExample/InstanceAdmin.cs [162:232]


        public static object CreateDevInstance(string displayName)
        {
            BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.Create();
            Console.WriteLine("Creating a DEVELOPMENT instance");
            // [START bigtable_create_dev_instance]
            // Creates a DEVELOPMENT Instance with "<intanceId>-dev" instance ID,
            // with cluster ID "hdd-cluster" and location us-east1-b.
            // Cluster node count should not be set while creating DEVELOPMENT instance.
            displayName += " Dev"; // display name is for display purposes only, it doesn't have to equal to instanceId and can be amended after instance is created.
            string instanceId = Regex.Replace(displayName, @"[^A-Za-z0-9_\.~]+", "-").ToLower();

            // Please refer to the link below for the full list of available locations:
            // https://cloud.google.com/bigtable/docs/locations
            string zone = "us-east1-b";

            // The instance to create.
            Instance myInstance = new Instance
            {
                DisplayName = displayName,
                // You can choose DEVELOPMENT or PRODUCTION type here.
                // If not set, will default to PRODUCTION type.
                // Instance type can be upgraded from DEVELOPMENT to PRODUCTION but cannot be dowgraded after the instance is created.
                Type = Instance.Types.Type.Development,
                Labels = { { "dev-label", "dev-label" } }
            };

            // The first cluster to be created within the instance.
            Cluster myCluster = new Cluster
            {
                // You can choose SSD or HDD storage type here: StorageType.Ssd or StorageType.Hdd.
                // Cluster storage type cannot be changed after an instance is created.
                // If not set will default to SSD type.
                DefaultStorageType = StorageType.Hdd,
                LocationAsLocationName = new LocationName(projectId, zone),
            };

            // Initialize request argument(s).
            CreateInstanceRequest request = new CreateInstanceRequest
            {
                ParentAsProjectName = new ProjectName(projectId),
                Instance = myInstance,
                InstanceId = instanceId,
                // Must specify at lease one cluster.
                // Only PRODUCTION type instance can be created with more than one cluster.
                Clusters = { { "hdd-cluster", myCluster } }
            };

            try
            {
                // Make a request.
                Operation<Instance, CreateInstanceMetadata> createInstanceResponse =
                    bigtableInstanceAdminClient.CreateInstance(request);
                Console.WriteLine("Waiting for operation to complete...");

                // Poll until the returned long-running operation is complete
                Operation<Instance, CreateInstanceMetadata> completedResponse =
                    createInstanceResponse.PollUntilCompleted();
                // [END bigtable_create_dev_instance]
                Console.WriteLine(
                    $"Instance: {displayName} {(completedResponse.IsCompleted ? "was successfully created in " : "failed to create in ")}{projectId} project");
                PrintInstanceInfo(completedResponse.Result);
                // [START bigtable_create_dev_instance]
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Exception while creating {displayName} instance");
                Console.WriteLine(ex.Message);
            }
            // [END bigtable_create_dev_instance]
            return 0;
        }