Exemplo n.º 1
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
        op = instances.Create(args.instance, args.config, args.description,
                              args.nodes, args.processing_units)
        if args.async_:
            return op
        instance_operations.Await(op, 'Creating instance')
Exemplo n.º 2
0
 def testCreate(self):
     response = self.msgs.Operation()
     ref = resources.REGISTRY.Parse(
         'cfgId',
         params={'projectsId': self.Project()},
         collection='spanner.projects.instanceConfigs')
     self.client.projects_instances.Create.Expect(
         request=self.msgs.SpannerProjectsInstancesCreateRequest(
             parent='projects/' + self.Project(),
             createInstanceRequest=self.msgs.CreateInstanceRequest(
                 instanceId='insId',
                 instance=self.msgs.Instance(config=ref.RelativeName(),
                                             displayName='name',
                                             nodeCount=3))),
         response=response)
     self.assertEqual(instances.Create('insId', 'cfgId', 'name', 3),
                      response)