(cfg *Config, confirm bool)
| 74 | } |
| 75 | |
| 76 | func internalNew(cfg *Config, confirm bool) (*Azure, error) { |
| 77 | ctx := context.Background() |
| 78 | |
| 79 | c, err := getContainerClient(ctx, cfg, false) |
| 80 | if err != nil { |
| 81 | return nil, fmt.Errorf("getting storage container: %w", err) |
| 82 | } |
| 83 | |
| 84 | hedgedContainer, err := getContainerClient(ctx, cfg, true) |
| 85 | if err != nil { |
| 86 | return nil, fmt.Errorf("getting hedged storage container: %w", err) |
| 87 | } |
| 88 | |
| 89 | if confirm { |
| 90 | // Getting container properties to check if container exists |
| 91 | _, err = c.GetProperties(ctx, &container.GetPropertiesOptions{}) |
| 92 | if err != nil { |
| 93 | return nil, fmt.Errorf("failed to GetProperties: %w", err) |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | rw := &Azure{ |
| 98 | cfg: cfg, |
| 99 | containerClient: c, |
| 100 | hedgedContainerClient: hedgedContainer, |
| 101 | } |
| 102 | |
| 103 | return rw, nil |
| 104 | } |
| 105 | |
| 106 | func readError(err error) error { |
| 107 | if bloberror.HasCode(err, bloberror.BlobNotFound) { |
no test coverage detected