MCPcopy Index your code
hub / github.com/docker/cli / updateService

Function updateService

cli/command/service/update.go:261–544  ·  view source on GitHub ↗

nolint:gocyclo

(ctx context.Context, apiClient client.NetworkAPIClient, flags *pflag.FlagSet, spec *swarm.ServiceSpec)

Source from the content-addressed store, hash-verified

259
260//nolint:gocyclo
261func updateService(ctx context.Context, apiClient client.NetworkAPIClient, flags *pflag.FlagSet, spec *swarm.ServiceSpec) error {
262 updateBoolPtr := func(flag string, field **bool) {
263 if flags.Changed(flag) {
264 b, _ := flags.GetBool(flag)
265 *field = &b
266 }
267 }
268 updateString := func(flag string, field *string) {
269 if flags.Changed(flag) {
270 *field, _ = flags.GetString(flag)
271 }
272 }
273
274 updateInt64Value := func(flag string, field *int64) {
275 if flags.Changed(flag) {
276 *field = flags.Lookup(flag).Value.(int64Value).Value()
277 }
278 }
279
280 updateFloatValue := func(flag string, field *float32) {
281 if flags.Changed(flag) {
282 *field = flags.Lookup(flag).Value.(*floatValue).Value()
283 }
284 }
285
286 updateDuration := func(flag string, field *time.Duration) {
287 if flags.Changed(flag) {
288 *field, _ = flags.GetDuration(flag)
289 }
290 }
291
292 updateDurationOpt := func(flag string, field **time.Duration) {
293 if flags.Changed(flag) {
294 val := *flags.Lookup(flag).Value.(*opts.DurationOpt).Value()
295 *field = &val
296 }
297 }
298
299 updateInt64 := func(flag string, field *int64) {
300 if flags.Changed(flag) {
301 *field, _ = flags.GetInt64(flag)
302 }
303 }
304
305 updateUint64 := func(flag string, field *uint64) {
306 if flags.Changed(flag) {
307 *field, _ = flags.GetUint64(flag)
308 }
309 }
310
311 updateUint64Opt := func(flag string, field **uint64) {
312 if flags.Changed(flag) {
313 val := *flags.Lookup(flag).Value.(*Uint64Opt).Value()
314 *field = &val
315 }
316 }
317
318 updateIsolation := func(flag string, field *container.Isolation) error {

Callers 12

runUpdateFunction · 0.85
TestUpdateServiceArgsFunction · 0.85
TestUpdateReadOnlyFunction · 0.85
TestUpdateInitFunction · 0.85
TestUpdateStopSignalFunction · 0.85
TestUpdateIsolationValidFunction · 0.85
TestUpdateNetworksFunction · 0.85
TestUpdateMaxReplicasFunction · 0.85
TestUpdateSysCtlsFunction · 0.85
TestUpdateUlimitsFunction · 0.85

Calls 15

updateLabelsFunction · 0.85
updateContainerLabelsFunction · 0.85
updateStringToSliceFunction · 0.85
updateMountsFunction · 0.85
updateSysCtlsFunction · 0.85
updateUlimitsFunction · 0.85
anyChangedFunction · 0.85
addGenericResourcesFunction · 0.85
removeGenericResourcesFunction · 0.85
defaultRestartPolicyFunction · 0.85

Tested by 11

TestUpdateServiceArgsFunction · 0.68
TestUpdateReadOnlyFunction · 0.68
TestUpdateInitFunction · 0.68
TestUpdateStopSignalFunction · 0.68
TestUpdateIsolationValidFunction · 0.68
TestUpdateNetworksFunction · 0.68
TestUpdateMaxReplicasFunction · 0.68
TestUpdateSysCtlsFunction · 0.68
TestUpdateUlimitsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…