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: Instance config create response. """ if args.clone_config: # If the config exists, it's cloned, otherwise, we display the # error from instanceConfigs.Get. config = instance_configs.Get(args.clone_config) op = instance_configs.CreateUsingExistingConfig(args, config) else: if not args.IsSpecified('display_name'): raise c_exceptions.InvalidArgumentException( '--display-name', 'Must specify --display-name.') op = instance_configs.CreateUsingReplicas( args.config, args.display_name, args.base_config, args.replicas, args.validate_only, args.labels, args.etag) if args.async_: return op return instance_config_operations.Await(op, 'Creating instance-config')
def testGet(self): response = self.msgs.InstanceConfig() ref = resources.REGISTRY.Parse( 'cfgId', params={'projectsId': self.Project()}, collection='spanner.projects.instanceConfigs') self.client.projects_instanceConfigs.Get.Expect( request=self.msgs.SpannerProjectsInstanceConfigsGetRequest( name=ref.RelativeName()), response=response) self.assertEqual(instance_configs.Get('cfgId'), response)
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. """ return instance_configs.Get(args.config)