MCPcopy Create free account
hub / github.com/dagger/dagger / WithNewFile

Method WithNewFile

sdk/python/runtime/internal/dagger/dagger.gen.go:3423–3445  ·  view source on GitHub ↗

Return a new container snapshot, with a file added to its filesystem with text content

(path string, contents string, opts ...ContainerWithNewFileOpts)

Source from the content-addressed store, hash-verified

3421
3422// Return a new container snapshot, with a file added to its filesystem with text content
3423func (r *Container) WithNewFile(path string, contents string, opts ...ContainerWithNewFileOpts) *Container {
3424 q := r.query.Select("withNewFile")
3425 for i := len(opts) - 1; i >= 0; i-- {
3426 // `permissions` optional argument
3427 if !querybuilder.IsZeroValue(opts[i].Permissions) {
3428 q = q.Arg("permissions", opts[i].Permissions)
3429 }
3430 // `owner` optional argument
3431 if !querybuilder.IsZeroValue(opts[i].Owner) {
3432 q = q.Arg("owner", opts[i].Owner)
3433 }
3434 // `expand` optional argument
3435 if !querybuilder.IsZeroValue(opts[i].Expand) {
3436 q = q.Arg("expand", opts[i].Expand)
3437 }
3438 }
3439 q = q.Arg("path", path)
3440 q = q.Arg("contents", contents)
3441
3442 return &Container{
3443 query: q,
3444 }
3445}
3446
3447// Attach credentials for future publishing to a registry. Use in combination with publish
3448func (r *Container) WithRegistryAuth(address string, username string, secret *Secret) *Container {

Callers 1

AddNewFileMethod · 0.45

Calls 2

SelectMethod · 0.65
ArgMethod · 0.45

Tested by

no test coverage detected