Run creates a bucket.
(ctx context.Context)
| 78 | |
| 79 | // Run creates a bucket. |
| 80 | func (b MakeBucket) Run(ctx context.Context) error { |
| 81 | bucket, err := url.New(b.src) |
| 82 | if err != nil { |
| 83 | printError(b.fullCommand, b.op, err) |
| 84 | return err |
| 85 | } |
| 86 | |
| 87 | client, err := storage.NewRemoteClient(ctx, &url.URL{}, b.storageOpts) |
| 88 | if err != nil { |
| 89 | printError(b.fullCommand, b.op, err) |
| 90 | return err |
| 91 | } |
| 92 | |
| 93 | if err := client.MakeBucket(ctx, bucket.Bucket); err != nil { |
| 94 | printError(b.fullCommand, b.op, err) |
| 95 | return err |
| 96 | } |
| 97 | |
| 98 | msg := log.InfoMessage{ |
| 99 | Operation: b.op, |
| 100 | Source: bucket, |
| 101 | } |
| 102 | log.Info(msg) |
| 103 | |
| 104 | return nil |
| 105 | } |
| 106 | |
| 107 | func validateMBCommand(c *cli.Context) error { |
| 108 | if c.Args().Len() != 1 { |
no test coverage detected