### Install Infoblox Go Client v1 Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/README.md Use this command to get the previous major version of the Go Client (v1.1.1). ```bash go get github.com/infobloxopen/infoblox-go-client ``` -------------------------------- ### Basic Client Usage Example Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/README.md A simple example demonstrating how to initialize the Infoblox Go Client and fetch grid license information. Ensure you replace placeholders like '', '', 'PORT', 'username', and 'password' with your actual credentials and configuration. ```go package main import ( "fmt" ibclient "github.com/infobloxopen/infoblox-go-client/v2" ) func main() { hostConfig := ibclient.HostConfig{ Scheme: "https", Host: "", Version: "", Port: "PORT", } authConfig := ibclient.AuthConfig{ Username: "username", Password: "password", } transportConfig := ibclient.NewTransportConfig("false", 20, 10) requestBuilder := &ibclient.WapiRequestBuilder{} requestor := &ibclient.WapiHttpRequestor{} conn, err := ibclient.NewConnector(hostConfig, authConfig, transportConfig, requestBuilder, requestor) if err != nil { fmt.Println(err) } defer conn.Logout() objMgr := ibclient.NewObjectManager(conn, "myclient", "") //Fetches grid information fmt.Println(objMgr.GetGridLicense()) } ``` -------------------------------- ### Install Ginkgo Locally Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/onsi/ginkgo/v2/CONTRIBUTING.md Installs Ginkgo locally using the go install command. Ensure Ginkgo is in your GOPATH. ```bash go install ./... ``` -------------------------------- ### Preview Documentation Changes Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/onsi/ginkgo/v2/CONTRIBUTING.md Builds and serves the Ginkgo documentation locally using Jekyll. Requires Bundler to be installed. ```bash bundle && bundle exec jekyll serve ``` -------------------------------- ### Install Infoblox Go Client v2 Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/README.md Use this command to get the latest released version of the Go Client (v2.0.0 and above). Note that these versions have breaking changes and are not backward compatible. ```bash go get github.com/infobloxopen/infoblox-go-client/v2 ``` -------------------------------- ### Ginkgo Spec Example Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/onsi/ginkgo/v2/README.md This example demonstrates a typical Ginkgo spec structure, including BeforeEach, Context, It, When, and various Gomega assertions. It also shows how to use SpecContext and SpecTimeout for managing test execution. ```go import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ... ) var _ = Describe("Checking books out of the library", Label("library"), func() { var library *libraries.Library var book *books.Book var valjean *users.User BeforeEach(func() { library = libraries.NewClient() book = &books.Book{ Title: "Les Miserables", Author: "Victor Hugo", } valjean = users.NewUser("Jean Valjean") }) When("the library has the book in question", func() { BeforeEach(func(ctx SpecContext) { Expect(library.Store(ctx, book)).To(Succeed()) }) Context("and the book is available", func() { It("lends it to the reader", func(ctx SpecContext) { Expect(valjean.Checkout(ctx, library, "Les Miserables")).To(Succeed()) Expect(valjean.Books()).To(ContainElement(book)) Expect(library.UserWithBook(ctx, book)).To(Equal(valjean)) }, SpecTimeout(time.Second * 5)) }) Context("but the book has already been checked out", func() { var javert *users.User BeforeEach(func(ctx SpecContext) { javert = users.NewUser("Javert") Expect(javert.Checkout(ctx, library, "Les Miserables")).To(Succeed()) }) It("tells the user", func(ctx SpecContext) { err := valjean.Checkout(ctx, library, "Les Miserables") Expect(err).To(MatchError("Les Miserables is currently checked out")) }, SpecTimeout(time.Second * 5)) It("lets the user place a hold and get notified later", func(ctx SpecContext) { Expect(valjean.Hold(ctx, library, "Les Miserables")).To(Succeed()) Expect(valjean.Holds(ctx)).To(ContainElement(book)) By("when Javert returns the book") Expect(javert.Return(ctx, library, book)).To(Succeed()) By("it eventually informs Valjean") notification := "Les Miserables is ready for pick up" Eventually(ctx, valjean.Notifications).Should(ContainElement(notification)) Expect(valjean.Checkout(ctx, library, "Les Miserables")).To(Succeed()) Expect(valjean.Books(ctx)).To(ContainElement(book)) Expect(valjean.Holds(ctx)).To(BeEmpty()) }, SpecTimeout(time.Second * 10)) }) }) When("the library does not have the book in question", func() { It("tells the reader the book is unavailable", func(ctx SpecContext) { err := valjean.Checkout(ctx, library, "Les Miserables") Expect(err).To(MatchError("Les Miserables is not in the library catalog")) }, SpecTimeout(time.Second * 5)) }) }) ``` -------------------------------- ### Create Root Logger Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/go-logr/logr/README.md Initialize the root logger early in an application's lifecycle. This example shows creating a logger using a hypothetical 'logimpl' implementation with initial parameters. ```go func main() { // ... other setup code ... // Create the "root" logger. We have chosen the "logimpl" implementation, // which takes some initial parameters and returns a logr.Logger. logger := logimpl.New(param1, param2) // ... other setup code ... } ``` -------------------------------- ### Logrus Logging Levels Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Shows examples of logging messages at different severity levels in Logrus, from Trace to Panic. ```go logrus.Trace("Something very low level.") llogrus.Debug("Useful debugging information.") llogrus.Info("Something noteworthy happened!") llogrus.Warn("You should probably take a look at this.") llogrus.Error("Something failed but I'm not quitting.") // Calls os.Exit(1) after logging llogrus.Fatal("Bye.") // Calls panic() after logging llogrus.Panic("I'm bailing.") ``` -------------------------------- ### Log Message in Application Code Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/go-logr/logr/README.md Shows how to use the logr.Logger object within application code to emit log messages. The logger is typically received from setup code and can be used to log information with key-value pairs. ```go type appObject struct { // ... other fields ... logger logr.Logger // ... other fields ... } func (app *appObject) Run() { app.logger.Info("starting up", "timestamp", time.Now()) // ... app code ... } ``` -------------------------------- ### Implement Custom JSON Formatter for Logrus Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Define a custom formatter by implementing the `Formatter` interface. This example shows how to create a JSON formatter that only serializes the entry's data fields. ```go type MyJSONFormatter struct{} logrus.SetFormatter(new(MyJSONFormatter)) func (f *MyJSONFormatter) Format(entry *Entry) ([]byte, error) { // Note this doesn't include Time, Level and Message which are available on // the Entry. Consult `godoc` on information about those fields or read the // source of the official loggers. serialized, err := json.Marshal(entry.Data) if err != nil { return nil, fmt.Errorf("Failed to marshal fields to JSON, %w", err) } return append(serialized, '\n'), nil } ``` -------------------------------- ### Basic Logrus Usage Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Demonstrates the simplest way to use Logrus with the package-level exported logger and fields. ```go package main import "github.com/sirupsen/logrus" func main() { logrus.WithFields(logrus.Fields{ "animal": "walrus", }).Info("A walrus appears") } ``` -------------------------------- ### Creating a Custom Logrus Logger Instance Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Demonstrates how to create and configure a separate instance of the Logrus logger, directing output to stdout. ```go package main import ( "os" "github.com/sirupsen/logrus" ) // Create a new instance of the logger. You can have any number of instances. var logger = logrus.New() func main() { // The API for setting attributes is a little different than the package level // exported logger. See Godoc. logger.Out = os.Stdout // You could set this to any `io.Writer` such as a file // file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) // if err == nil { // logger.Out = file // } else { // logger.Info("Failed to log to file, using default stderr") // } logger.WithFields(logrus.Fields{ "animal": "walrus", "size": 10, }).Info("A group of walrus emerges from the ocean") } ``` -------------------------------- ### Using Default Fields with Logrus Entry Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Shows how to create a Logrus Entry with default fields that will be included in all subsequent log statements. ```go requestLogger := logger.WithFields(logrus.Fields{"request_id": request_id, "user_ip": user_ip}) requestLogger.Info("something happened on that request") // will log request_id and user_ip requestLogger.Warn("something not great happened") ``` -------------------------------- ### Structured Logging with Fields Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Illustrates replacing formatted error messages with structured logging using fields for better discoverability. ```go logrus.WithFields(logrus.Fields{ "event": event, "topic": topic, "key": key, }).Fatal("Failed to send event") ``` -------------------------------- ### Run E2E Tests with go test Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/e2e_tests/README.md Use the standard `go test` utility to execute all tests within the `e2e_tests` directory. ```bash go test -v ./e2e_tests ``` -------------------------------- ### Use fmt.Sprintf in a logr key's value Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/go-logr/logr/README.md Demonstrates how to use fmt.Sprintf within a logr key's value when absolutely necessary. This approach should be used sparingly. ```go logger.Info("unable to reflect over type", "type", fmt.Sprintf("%T")) ``` -------------------------------- ### Run E2E Tests with ginkgo Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/e2e_tests/README.md Utilize the `ginkgo` utility for running tests, which offers advanced features like label-based filtering. ```bash # Run all e2e tests ginkgo e2e_tests ``` ```bash # Run only read-only e2e tests ginkgo --label-filter=RO e2e_tests ``` -------------------------------- ### System Call Entry Points (Assembly) Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/golang.org/x/sys/unix/README.md Defines the entry points for system call dispatch in assembly files. These differ in the number of arguments they can pass to the kernel. RawSyscall is for low-level use and bypasses scheduler notifications. ```go func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) ``` -------------------------------- ### Export WAPI Instance Parameters Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/e2e_tests/README.md Export these environment variables to configure access to your WAPI instance before running tests. ```bash export INFOBLOX_SERVER= INFOBLOX_USERNAME= INFOBLOX_PASSWORD= WAPI_VERSION= ``` -------------------------------- ### Unmarshal and Marshal YAML Data in Go Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/gopkg.in/yaml.v3/README.md Demonstrates how to unmarshal YAML data into a Go struct and a map, and then marshal them back into YAML format. Ensure struct fields are public for correct unmarshalling. ```Go package main import ( "fmt" "log" "gopkg.in/yaml.v3" ) var data = ` a: Easy! b: c: 2 d: [3, 4] ` // Note: struct fields must be public in order for unmarshal to // correctly populate the data. type T struct { A string B struct { RenamedC int `yaml:"c"` D []int `yaml:",flow"` } } func main() { t := T{} err := yaml.Unmarshal([]byte(data), &t) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- t:\n%v\n\n", t) d, err := yaml.Marshal(&t) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- t dump:\n%s\n\n", string(d)) m := make(map[interface{}]interface{}) err = yaml.Unmarshal([]byte(data), &m) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- m:\n%v\n\n", m) d, err = yaml.Marshal(&m) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- m dump:\n%s\n\n", string(d)) } ``` -------------------------------- ### Load Slim-Sprig FuncMap in Go Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/go-task/slim-sprig/v3/README.md Load the Slim-Sprig FuncMap into your Go templates. This must be done before parsing the templates themselves. ```go import ( "html/template" "github.com/go-task/slim-sprig" ) // This example illustrates that the FuncMap *must* be set before the // templates themselves are loaded. tpl := template.Must( template.New("base").Funcs(sprig.FuncMap()).ParseGlob("*.html") ) ``` -------------------------------- ### Commit, Push, and Create GitHub Release Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/onsi/ginkgo/v2/RELEASING.md After updating the version and changelog, commit the changes, push them to the remote repository, and then use the GitHub CLI to create a new release tag. ```bash git commit -m "vM.m.p" git push gh release create "vM.m.p" git fetch --tags origin master ``` -------------------------------- ### Add Custom Hooks to Logrus Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Demonstrates how to add custom hooks for error tracking (Airbrake) and syslog logging within the init function. Ensure necessary libraries are imported. ```go package main import ( "log/syslog" "github.com/sirupsen/logrus" airbrake "gopkg.in/gemnasium/logrus-airbrake-hook.v2" logrus_syslog "github.com/sirupsen/logrus/hooks/syslog" ) func init() { // Use the Airbrake hook to report errors that have Error severity or above to // an exception tracker. You can create custom hooks, see the Hooks section. logrus.AddHook(airbrake.NewHook(123, "xyz", "production")) hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") if err != nil { logrus.Error("Unable to connect to local syslog daemon") } else { logrus.AddHook(hook) } } ``` -------------------------------- ### Convert klog.Infof to logr.V.Info Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/go-logr/logr/README.md Converts a klog format string with verbosity to a logr key-value pair log. Use this when migrating from klog to logr. ```go logger.V(4).Info("got a retry-after response when requesting url", "attempt", retries, "after seconds", seconds, "url", url) ``` -------------------------------- ### Customizing Logrus Output and Level Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Configures Logrus to log as JSON, output to stdout, and set the minimum log level to Warning. ```go package main import ( "os" log "github.com/sirupsen/logrus" ) func init() { // Log as JSON instead of the default ASCII formatter. log.SetFormatter(&log.JSONFormatter{}) // Output to stdout instead of the default stderr // Can be any io.Writer, see below for File example log.SetOutput(os.Stdout) // Only log the warning severity or above. log.SetLevel(log.WarnLevel) } func main() { log.WithFields(log.Fields{ "animal": "walrus", "size": 10, }).Info("A group of walrus emerges from the ocean") log.WithFields(log.Fields{ "omg": true, "number": 122, }).Warn("The group's number increased tremendously!") log.WithFields(log.Fields{ "omg": true, "number": 100, }).Fatal("The ice breaks!") // A common pattern is to re-use fields between logging statements by re-using // the logrus.Entry returned from WithFields() contextLogger := log.WithFields(log.Fields{ "common": "this is a common field", "other": "I also should be logged always", }) contextLogger.Info("I'll be logged with common and other field") contextLogger.Info("Me too") } ``` -------------------------------- ### Run Specs in Parallel with Ginkgo Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/onsi/ginkgo/v2/README.md Use the `-p` flag with the ginkgo command to run your test suite in parallel. This is useful for speeding up execution of large test suites. ```bash ginkgo -p ``` -------------------------------- ### Vet Ginkgo Changes Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/onsi/ginkgo/v2/CONTRIBUTING.md Runs the go vet tool on all Ginkgo packages to check for suspicious constructs. ```bash go vet ./... ``` -------------------------------- ### Benchmark Caller Tracing Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Measure the performance impact of caller tracing by running benchmarks. The overhead can vary depending on the Go version. ```bash go test -bench=.*CallerTracing ``` -------------------------------- ### Run Ginkgo Tests Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/onsi/ginkgo/v2/CONTRIBUTING.md Executes all Ginkgo tests recursively and in parallel. Use this to verify your changes. ```bash ginkgo -r -p ``` -------------------------------- ### Use Slim-Sprig functions in templates Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/go-task/slim-sprig/v3/README.md Demonstrates calling Slim-Sprig functions within Go templates. Functions are typically lowercase and chained using the pipe operator. ```go {{ "hello!" | upper | repeat 5 }} ``` -------------------------------- ### Convert klog.Infof to logr.Error Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/go-logr/logr/README.md Converts a klog format string to a logr key-value pair log. Use this when migrating from klog to logr. ```go logger.Error(err, "client returned an error", "code", responseCode) ``` -------------------------------- ### Enable Caller Reporting Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md To include the calling method as a field in log entries, enable caller reporting using SetReportCaller(true). This adds overhead, so use it judiciously. ```go logrus.SetReportCaller(true) ``` -------------------------------- ### Conditional Logrus Formatter by Environment Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Illustrates how to conditionally set Logrus formatters (JSON or Text) based on an environment variable. This is useful for tailoring logging output for different deployment environments. ```go import ( "github.com/sirupsen/logrus" ) func init() { // do something here to set environment depending on an environment variable // or command-line flag if Environment == "production" { logrus.SetFormatter(&logrus.JSONFormatter{}) } else { // The TextFormatter is default, you don't actually have to do this. logrus.SetFormatter(&logrus.TextFormatter{}) } } ``` -------------------------------- ### Set Logrus Logging Level Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Demonstrates how to set the minimum logging level for a Logrus logger. Only messages at or above the set level will be logged. ```go // Will log anything that is info or above (warn, error, fatal, panic). Default. llogrus.SetLevel(logrus.InfoLevel) ``` -------------------------------- ### Replace Standard Library Logger with Logrus Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Configure logrus to output to the standard library's logger using `log.SetOutput`. This redirects all standard log messages through the configured logrus instance. ```go logger := logrus.New() logger.Formatter = &logrus.JSONFormatter{} // Use logrus for standard log output // Note that `log` here references stdlib's log // Not logrus imported under the name `log`. log.SetOutput(logger.Writer()) ``` -------------------------------- ### Host Record Operations Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/README.md Operations for creating, deleting, retrieving, and updating host records. ```APIDOC ## CreateHostRecord ### Description Creates a host record. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## DeleteHostRecord ### Description Deletes a host record. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## GetHostRecord ### Description Retrieves a host record. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## GetHostRecordByRef ### Description Retrieves a host record by its reference. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## SearchHostRecordByAltId ### Description Searches for a host record using an alternative ID. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## SearchObjectByAltId ### Description Searches for an object using an alternative ID. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## GetIpAddressFromHostRecord ### Description Retrieves the IP address associated with a host record. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## UpdateHostRecord ### Description Updates a host record. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` -------------------------------- ### Pass Logger to Other Libraries Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/go-logr/logr/README.md Demonstrates passing a logr.Logger object to other parts of the application, such as when creating objects or in structs. The logger can be stored in structs or used as a package-global variable. ```go app := createTheAppObject(logger) app.Run() ``` -------------------------------- ### Text Formatter Output (No TTY) Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md When using the default TextFormatter and a TTY is not attached, the output is compatible with the logfmt format. ```text time="2015-03-26T01:27:38-04:00" level=debug msg="Started observing beach" animal=walrus number=8 time="2015-03-26T01:27:38-04:00" level=info msg="A group of walrus emerges from the ocean" animal=walrus size=10 time="2015-03-26T01:27:38-04:00" level=warning msg="The group's number increased tremendously!" number=122 omg=true time="2015-03-26T01:27:38-04:00" level=debug msg="Temperature changes" temperature=-4 time="2015-03-26T01:27:38-04:00" level=panic msg="It's over 9000!" animal=orca size=9009 time="2015-03-26T01:27:38-04:00" level=fatal msg="The ice breaks!" err=&{0x2082280c0 map[animal:orca size:9009] 2015-03-26 01:27:38.441574009 -0400 EDT panic It's over 9000!} number=100 omg=true ``` -------------------------------- ### Force TextFormatter Without Colors Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md To ensure logfmt-compatible output even when a TTY is attached, configure the TextFormatter with DisableColors set to true and FullTimestamp set to true. ```go logrus.SetFormatter(&logrus.TextFormatter{ DisableColors: true, FullTimestamp: true, }) ``` -------------------------------- ### Update CHANGELOG.md with Git Log Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/onsi/ginkgo/v2/RELEASING.md Use this bash script to automatically populate the CHANGELOG.md with recent commits since the last tag. Ensure you categorize the changes appropriately after running the script. ```bash LAST_VERSION=$(git tag --sort=version:refname | tail -n1) CHANGES=$(git log --pretty=format:'- %s [%h]' HEAD...$LAST_VERSION) echo -e "## NEXT\n\n$CHANGES\n\n### Features\n\n### Fixes\n\n### Maintenance\n\n$(cat CHANGELOG.md)" > CHANGELOG.md ``` -------------------------------- ### Testing Logrus Messages Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Use the test hook to assert the presence and content of log messages during testing. Initialize with NewNullLogger to record messages without outputting them. Remember to reset the hook to clear recorded entries. ```go import( "testing" "github.com/sirupsen/logrus" "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/assert" ) func TestSomething(t*testing.T){ logger, hook := test.NewNullLogger() logger.Error("Helloerror") assert.Equal(t, 1, len(hook.Entries)) assert.Equal(t, logrus.ErrorLevel, hook.LastEntry().Level) assert.Equal(t, "Helloerror", hook.LastEntry().Message) hook.Reset() assert.Nil(t, hook.LastEntry()) } ``` -------------------------------- ### Text Output with Caller Information Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md When caller reporting is enabled, text formatted logs will include the 'method' field, indicating the calling function. ```text time="2015-03-26T01:27:38-04:00" level=fatal method=github.com/sirupsen/arcticcreatures.migrate msg="a penguin swims by" animal=penguin ``` -------------------------------- ### Integrate Logrus Writer with http.Server ErrorLog Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md Transform a logrus logger into an io.Writer to be used with the standard library's `log.Logger`. This allows `http.Server` to log errors using logrus. ```go w := logger.Writer() defer w.Close() srv := http.Server{ // create a stdlib log.Logger that writes to // logrus.Logger. ErrorLog: log.New(w, "", 0), } ``` -------------------------------- ### JSON Output with Caller Information Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/vendor/github.com/sirupsen/logrus/README.md When caller reporting is enabled, JSON formatted logs will include the 'method' field, indicating the calling function. ```json {"animal":"penguin","level":"fatal","method":"github.com/sirupsen/arcticcreatures.migrate","msg":"a penguin swims by", "time":"2014-03-10 19:57:38.562543129 -0400 EDT"} ``` -------------------------------- ### Grid Operations Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/README.md Operations for retrieving grid-level information. ```APIDOC ## GetGridInfo ### Description Retrieves information about the grid. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## GetGridLicense ### Description Retrieves information about the grid license. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` -------------------------------- ### Extensible Attribute (EA) Operations Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/README.md Operations for creating, retrieving, and deleting extensible attribute definitions. ```APIDOC ## CreateEADefinition ### Description Creates an extensible attribute definition. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## GetEADefinition ### Description Retrieves an extensible attribute definition. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` -------------------------------- ### Network View Operations Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/README.md Operations for creating, deleting, retrieving, and updating network views. ```APIDOC ## CreateNetworkView ### Description Creates a network view. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## DeleteNetworkView ### Description Deletes a network view. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## GetNetworkView ### Description Retrieves a network view. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## GetNetworkViewByRef ### Description Retrieves a network view by its reference. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## UpdateNetworkView ### Description Updates a network view. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` -------------------------------- ### Zone Operations Source: https://github.com/infobloxopen/infoblox-go-client/blob/master/README.md Operations for managing DNS zones, including creation and delegation. ```APIDOC ## CreateZoneAuth ### Description Creates an authoritative zone. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## CreateZoneForward ### Description Creates a forward zone. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## CreateZoneDelegated ### Description Creates a delegated zone. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## DeleteZoneAuth ### Description Deletes an authoritative zone. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## DeleteZoneForward ### Description Deletes a forward zone. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## DeleteZoneDelegated ### Description Deletes a delegated zone. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## GetZoneAuthByRef ### Description Retrieves an authoritative zone by its reference. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## GetZoneDelegated ### Description Retrieves a delegated zone. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## GetZoneForwardByRef ### Description Retrieves a forward zone by its reference. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## GetZoneForwardFilters ### Description Retrieves filters for forward zones. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## UpdateZoneDelegated ### Description Updates a delegated zone. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ``` ```APIDOC ## UpdateZoneForward ### Description Updates a forward zone. ### Method APIDOC ### Endpoint APIDOC ### Parameters APIDOC ### Request Example APIDOC ### Response APIDOC ```