Skip to content

PostAs3Bigip() does not handle partial success as error #123

@ronchi-oss

Description

@ronchi-oss

The Go SDK function PostAs3Bigip does not handle partial success responses correctly.

A partial success response is one where:

  • The HTTP status code is 200
  • The JSON response payload:
    • contains a key .code set to 207
    • contains a key .results[] where at least one of its entries has a code other than 200, such as 422

Actual behavior

The function returns a nil error for the following JSON response payload:

{
  "results": [
    {
      "code": 200,
      "message": "no change",
      "host": "localhost",
      "tenant": "Common",
      "runTime": 8544,
      "declarationId": "autogen_d988ce22-cf5f-46ca-ad3d-a125c8db529e"
    },
    {
      "code": 422,
      "message": "declaration failed",
      "response": "0107019a:3: Wide IP or alias (my-test-app-01-qa of type A) entered is not a fully qualified domain name or contains invalid characters. Additional character support can be enabled by modifying the Domain Name Check settings.",
      "host": "localhost",
      "tenant": "domain_7b4e6772-bfb5-11f0-b43e-0a3b97e32b2b",
      "runTime": 2983,
      "declarationId": "autogen_d988ce22-cf5f-46ca-ad3d-a125c8db529e"
    },
    {
      "code": 200,
      "message": "no change",
      "host": "localhost",
      "tenant": "Common",
      "runTime": 3350,
      "declarationId": "autogen_d988ce22-cf5f-46ca-ad3d-a125c8db529e"
    }
  ],
  "declaration": {
    "Common": {
      "Shared": {
        "cc_andromeda_monitor_fa6cbe48-bfc2-11f0-b43e-0a3b97e32b2b": {
          "class": "GSLB_Monitor",
          "monitorType": "http",
          "interval": 60,
          "probeTimeout": 10
        },
        "cc_andromeda_srv_<redacted>_cc_dc_qa-de-1": {
          "class": "GSLB_Server",
          "dataCenter": {
            "bigip": "/Common/cc_dc_qa-de-1"
          },
          "devices": [
            {
              "address": "<redacted>"
            }
          ],
          "virtualServers": [
            {
              "address": "<redacted>",
              "name": "<redacted>:80",
              "port": 80
            }
          ],
          "monitors": [
            {
              "use": "cc_andromeda_monitor_fa6cbe48-bfc2-11f0-b43e-0a3b97e32b2b"
            }
          ],
          "serverType": "generic-host"
        },
        "cc_andromeda_srv_<redacted>_cc_dc_qa-de-1": {
          "class": "GSLB_Server",
          "dataCenter": {
            "bigip": "/Common/cc_dc_qa-de-1"
          },
          "devices": [
            {
              "address": "<redacted>"
            }
          ],
          "virtualServers": [
            {
              "address": "<redacted>",
              "name": "<redacted>:80",
              "port": 80
            }
          ],
          "monitors": [
            {
              "use": "cc_andromeda_monitor_fa6cbe48-bfc2-11f0-b43e-0a3b97e32b2b"
            }
          ],
          "serverType": "generic-host"
        },
        "class": "Application",
        "label": "",
        "remark": "",
        "template": "shared"
      },
      "class": "Tenant",
      "label": "",
      "remark": ""
    },
    "domain_7b4e6772-bfb5-11f0-b43e-0a3b97e32b2b": {
      "application": {
        "class": "Application",
        "label": "",
        "pool_11d419e7-bfc0-11f0-b43e-0a3b97e32b2b": {
          "class": "GSLB_Pool",
          "resourceRecordType": "A",
          "members": [
            {
              "server": {
                "use": "/Common/Shared/cc_andromeda_srv_<redacted>_cc_dc_qa-de-1"
              },
              "virtualServer": "<redacted>:80"
            },
            {
              "server": {
                "use": "/Common/Shared/cc_andromeda_srv_<redacted>_cc_dc_qa-de-1"
              },
              "virtualServer": "<redacted>:80"
            }
          ],
          "lbModePreferred": "round-robin",
          "lbModeAlternate": "none",
          "lbModeFallback": "none"
        },
        "remark": "",
        "template": "",
        "wideip": {
          "class": "GSLB_Domain",
          "domainName": "my-test-app-01-qa.<redacted>",
          "resourceRecordType": "A",
          "poolLbMode": "global-availability",
          "pools": [
            {
              "use": "pool_11d419e7-bfc0-11f0-b43e-0a3b97e32b2b"
            }
          ]
        }
      },
      "class": "Tenant",
      "label": "",
      "remark": ""
    },
    "class": "ADC",
    "id": "autogen_d988ce22-cf5f-46ca-ad3d-a125c8db529e",
    "schemaVersion": "3.36.0",
    "updateMode": "complete",
    "controls": {
      "archiveTimestamp": "2025-11-13T14:40:31.546Z"
    }
  },
  "code": 207
}

Expected behavior

A .code with value 207 should always be considered an error and for each .results[] entry with a .code other than 200, a debugging message should print the respective entry (all key/value pairs) for convenient debugging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions