func RunCreateSubcommand(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *CreateSubcommandOptions) error {
	namespace, _, err := f.DefaultNamespace()
	if err != nil {
		return err
	}
	obj, err := options.StructuredGenerator.StructuredGenerate()
	if err != nil {
		return err
	}
	mapper, typer := f.Object(cmdutil.GetIncludeThirdPartyAPIs(cmd))
	gvks, _, err := typer.ObjectKinds(obj)
	if err != nil {
		return err
	}
	gvk := gvks[0]
	mapping, err := mapper.RESTMapping(unversioned.GroupKind{Group: gvk.Group, Kind: gvk.Kind}, gvk.Version)
	if err != nil {
		return err
	}
	client, err := f.ClientForMapping(mapping)
	if err != nil {
		return err
	}
	resourceMapper := &resource.Mapper{
		ObjectTyper:  typer,
		RESTMapper:   mapper,
		ClientMapper: resource.ClientMapperFunc(f.ClientForMapping),
	}
	info, err := resourceMapper.InfoForObject(obj, nil)
	if err != nil {
		return err
	}
	if err := kubectl.UpdateApplyAnnotation(info, f.JSONEncoder()); err != nil {
		return err
	}
	if !options.DryRun {
		obj, err = resource.NewHelper(client, mapping).Create(namespace, false, info.Object)
		if err != nil {
			return err
		}
	}

	if useShortOutput := options.OutputFormat == "name"; useShortOutput || len(options.OutputFormat) == 0 {
		cmdutil.PrintSuccess(mapper, useShortOutput, out, mapping.Resource, options.Name, "created")
		return nil
	}

	return f.PrintObject(cmd, mapper, obj, out)
}
// RunCreateSubcommand executes a create subcommand using the specified options
RunCreateSubcommand executes a create subcommand using the specified options
// RunCreateSubcommand executes a create subcommand using the specified options
func RunCreateSubcommand(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *CreateSubcommandOptions) error {
	namespace, _, err := f.DefaultNamespace()
	if err != nil {
		return err
	}
	obj, err := options.StructuredGenerator.StructuredGenerate()
	if err != nil {
		return err
	}
	mapper, typer := f.Object(cmdutil.GetIncludeThirdPartyAPIs(cmd))
	gvks, _, err := typer.ObjectKinds(obj)
	if err != nil {
		return err
	}
	gvk := gvks[0]
	mapping, err := mapper.RESTMapping(unversioned.GroupKind{Group: gvk.Group, Kind: gvk.Kind}, gvk.Version)
	if err != nil {
		return err
	}
	client, err := f.ClientForMapping(mapping)
	if err != nil {
		return err
	}
	resourceMapper := &resource.Mapper{
		ObjectTyper:  typer,
		RESTMapper:   mapper,
		ClientMapper: resource.ClientMapperFunc(f.ClientForMapping),
	}
	info, err := resourceMapper.InfoForObject(obj, nil)
	if err != nil {
		return err
	}
	if err := kubectl.UpdateApplyAnnotation(info, f.JSONEncoder()); err != nil {
		return err
	}
	if !options.DryRun {
		obj, err = resource.NewHelper(client, mapping).Create(namespace, false, info.Object)
		if err != nil {
			return err
		}
	}
	if useShortOutput := options.OutputFormat == "name"; useShortOutput || len(options.OutputFormat) == 0 {
		cmdutil.PrintSuccess(mapper, useShortOutput, out, mapping.Resource, options.Name, "created")
		return nil
	}
	return f.PrintObject(cmd, mapper, obj, out)
}
func RunCreateSubcommand ( f * cmdutil . Factory , cmd * cobra . Command , out io . Writer , options * CreateSubcommandOptions ) error { namespace , _ , err := f . DefaultNamespace ( ) if err != nil { return err } obj , err := options . StructuredGenerator . StructuredGenerate ( ) if err != nil { return err } mapper , typer := f . Object ( cmdutil . GetIncludeThirdPartyAPIs ( cmd ) ) gvks , _ , err := typer . ObjectKinds ( obj ) if err != nil { return err } gvk := gvks [ 0 ] mapping , err := mapper . RESTMapping ( unversioned . GroupKind { Group : gvk . Group , Kind : gvk . Kind } , gvk . Version ) if err != nil { return err } client , err := f . ClientForMapping ( mapping ) if err != nil { return err } resourceMapper := & resource . Mapper { ObjectTyper : typer , RESTMapper : mapper , ClientMapper : resource . ClientMapperFunc ( f . ClientForMapping ) , } info , err := resourceMapper . InfoForObject ( obj , nil ) if err != nil { return err } if err := kubectl . UpdateApplyAnnotation ( info , f . JSONEncoder ( ) ) ; err != nil { return err } if ! options . DryRun { obj , err = resource . NewHelper ( client , mapping ) . Create ( namespace , false , info . Object ) if err != nil { return err } } if useShortOutput := options . OutputFormat == " " ; useShortOutput || len ( options . OutputFormat ) == 0 { cmdutil . PrintSuccess ( mapper , useShortOutput , out , mapping . Resource , options . Name , " " ) return nil } return f . PrintObject ( cmd , mapper , obj , out ) }
RunCreateSubcommand executes a create subcommand using the specified options
RunCreateSubcommand executes a create subcommand using the specified options