示例#1
0
func (command *commandDelete) HandleFlags(resource *handler.Resource) error {
	err := command.Ctx.CheckFlagsSet([]string{"container"})
	if err != nil {
		return err
	}

	containerName := command.Ctx.CLIContext.String("container")

	if err := objectcommands.CheckContainerExists(command.Ctx.ServiceClient, containerName); err != nil {
		return err
	}

	resource.Params = &paramsDelete{
		container: containerName,
	}

	return nil
}
示例#2
0
func (command *commandUpload) HandleFlags(resource *handler.Resource) error {
	err := command.Ctx.CheckFlagsSet([]string{"container", "name", "size-pieces"})
	if err != nil {
		return err
	}

	c := command.Ctx.CLIContext
	containerName := c.String("container")

	if err := objectcommands.CheckContainerExists(command.Ctx.ServiceClient, containerName); err != nil {
		return err
	}

	opts := osObjects.CreateLargeOpts{
		CreateOpts: osObjects.CreateOpts{
			ContentLength: int64(c.Int("content-length")),
			ContentType:   c.String("content-type"),
		},
		SizePieces:  int64(c.Int("size-pieces")),
		Concurrency: c.Int("concurrency"),
	}

	/*
		if c.IsSet("metadata") {
			metadata, err := command.Ctx.CheckKVFlag("metadata")
			if err != nil {
				return err
			}
			opts.Metadata = metadata
		}
	*/

	resource.Params = &paramsUpload{
		container: containerName,
		object:    c.String("name"),
		opts:      opts,
	}

	return nil
}