### Install go-version Library Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/vendor/github.com/hashicorp/go-version/README.md Install the go-version library using the go get command. ```bash $ go get github.com/hashicorp/go-version ``` -------------------------------- ### Get OS Bulk Install Info List Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/OsApi.md Retrieves a list of OS bulk install information with various filtering, sorting, and selection options. This example demonstrates how to set multiple query parameters for the API call. ```go package main import ( "context" "fmt" "os" openapi client "github.com/CiscoDevNet/intersight-go" ) func main() { filter := "$filter=CreateTime gt 2012-08-29T21:58:33Z" // string | Filter criteria for the resources to return. A URI with a $filter query option identifies a subset of the entries from the Collection of Entries. The subset is determined by selecting only the Entries that satisfy the predicate expression specified by the $filter option. The expression language that is used in $filter queries supports references to properties and literals. The literal values can be strings enclosed in single quotes, numbers and boolean values (true or false). (optional) (default to "") orderby := "$orderby=CreationTime" // string | Determines what properties are used to sort the collection of resources. (optional) top := int32($top=10) // int32 | Specifies the maximum number of resources to return in the response. (optional) (default to 100) skip := int32($skip=100) // int32 | Specifies the number of resources to skip in the response. (optional) (default to 0) select_ := "$select=CreateTime,ModTime" // string | Specifies a subset of properties to return. (optional) (default to "") expand := "$expand=DisplayNames" // string | Specify additional attributes or related resources to return in addition to the primary resources. (optional) apply := "apply_example" // string | Specify one or more transformation operations to perform aggregation on the resources. The transformations are processed in order with the output from a transformation being used as input for the subsequent transformation. The \"$apply\" query takes a sequence of set transformations, separated by forward slashes to express that they are consecutively applied, i.e., the result of each transformation is the input to the next transformation. Supported aggregation methods are \"aggregate\" and \"groupby\". The **aggregate** transformation takes a comma-separated list of one or more aggregate expressions as parameters and returns a result set with a single instance, representing the aggregated value for all instances in the input set. The **groupby** transformation takes one or two parameters and 1. Splits the initial set into subsets where all instances in a subset have the same values for the grouping properties specified in the first parameter, 2. Applies set transformations to each subset according to the second parameter, resulting in a new set of potentially different structure and cardinality, 3. Ensures that the instances in the result set contain all grouping properties with the correct values for the group, 4. Concatenates the intermediate result sets into one result set. A groupby transformation affects the structure of the result set. (optional) count := false // bool | The $count query specifies the service should return the count of the matching resources, instead of returning the resources. (optional) inlinecount := "$inlinecount=true" // string | The $inlinecount query option allows clients to request an inline count of the matching resources included with the resources in the response. (optional) (default to "allpages") at := "at=VersionType eq 'Configured'" // string | Similar to \"$filter\", but \"at\" is specifically used to filter versioning information properties for resources to return. A URI with an \"at\" Query Option identifies a subset of the Entries from the Collection of Entries identified by the Resource Path section of the URI. The subset is determined by selecting only the Entries that satisfy the predicate expression specified by the query option. The expression language that is used in at operators supports references to properties and literals. The literal values can be strings enclosed in single quotes, numbers and boolean values (true or false) or any of the additional literal representations shown in the Abstract Type System section. (optional) tags := "tags_example" // string | The 'tags' parameter is used to request a summary of the Tag utilization for this resource. When the 'tags' parameter is specified, the response provides a list of tag keys, the number of times the key has been used across all documents, and the tag values that have been assigned to the tag key. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OsApi.GetOsBulkInstallInfoList(context.Background()).Filter(filter).Orderby(orderby).Top(top).Skip(skip).Select_(select_).Expand(expand).Apply(apply).Count(count).Inlinecount(inlinecount).At(at).Tags(tags).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OsApi.GetOsBulkInstallInfoList``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOsBulkInstallInfoList`: OsBulkInstallInfoResponse fmt.Fprintf(os.Stdout, "Response from `OsApi.GetOsBulkInstallInfoList`: %v\n", resp) } ``` -------------------------------- ### Get OS Install List with Various Query Parameters Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/OsApi.md Demonstrates how to fetch a list of OS installations with various query parameters like filter, orderby, top, skip, select, expand, apply, count, inlinecount, at, and tags. ```Go package main import ( "context" "fmt" "os" openapiclient "github.com/CiscoDevNet/intersight-go" ) func main() { filter := "$filter=CreateTime gt 2012-08-29T21:58:33Z" // string | Filter criteria for the resources to return. A URI with a $filter query option identifies a subset of the entries from the Collection of Entries. The subset is determined by selecting only the Entries that satisfy the predicate expression specified by the $filter option. The expression language that is used in $filter queries supports references to properties and literals. The literal values can be strings enclosed in single quotes, numbers and boolean values (true or false). (optional) (default to "") orderby := "$orderby=CreationTime" // string | Determines what properties are are used to sort the collection of resources. (optional) top := int32($top=10) // int32 | Specifies the maximum number of resources to return in the response. (optional) (default to 100) skip := int32($skip=100) // int32 | Specifies the number of resources to skip in the response. (optional) (default to 0) select_ := "$select=CreateTime,ModTime" // string | Specifies a subset of properties to return. (optional) (default to "") expand := "$expand=DisplayNames" // string | Specify additional attributes or related resources to return in addition to the primary resources. (optional) apply := "apply_example" // string | Specify one or more transformation operations to perform aggregation on the resources. The transformations are processed in order with the output from a transformation being used as input for the subsequent transformation. The \"$apply\" query takes a sequence of set transformations, separated by forward slashes to express that they are consecutively applied, i.e., the result of each transformation is the input to the next transformation. Supported aggregation methods are \"aggregate\" and \"groupby\". The **aggregate** transformation takes a comma-separated list of one or more aggregate expressions as parameters and returns a result set with a single instance, representing the aggregated value for all instances in the input set. The **groupby** transformation takes one or two parameters and 1. Splits the initial set into subsets where all instances in a subset have the same values for the grouping properties specified in the first parameter, 2. Applies set transformations to each subset according to the second parameter, resulting in a new set of potentially different structure and cardinality, 3. Ensures that the instances in the result set contain all grouping properties with the correct values for the group, 4. Concatenates the intermediate result sets into one result set. A groupby transformation affects the structure of the result set. (optional) count := false // bool | The $count query specifies the service should return the count of the matching resources, instead of returning the resources. (optional) inlinecount := "$inlinecount=true" // string | The $inlinecount query option allows clients to request an inline count of the matching resources included with the resources in the response. (optional) (default to "allpages") at := "at=VersionType eq 'Configured'" // string | Similar to \"$filter\", but \"at\" is specifically used to filter versioning information properties for resources to return. A URI with an \"at\" Query Option identifies a subset of the Entries from the Collection of Entries identified by the Resource Path section of the URI. The subset is determined by selecting only the Entries that satisfy the predicate expression specified by the query option. The expression language that is used in at operators supports references to properties and literals. The literal values can be strings enclosed in single quotes, numbers and boolean values (true or false) or any of the additional literal representations shown in the Abstract Type System section. (optional) tags := "tags_example" // string | The 'tags' parameter is used to request a summary of the Tag utilization for this resource. When the 'tags' parameter is specified, the response provides a list of tag keys, the number of times the key has been used across all documents, and the tag values that have been assigned to the tag key. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OsApi.GetOsInstallList(context.Background()).Filter(filter).Orderby(orderby).Top(top).Skip(skip).Select_(select_).Expand(expand).Apply(apply).Count(count).Inlinecount(inlinecount).At(at).Tags(tags).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OsApi.GetOsInstallList``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOsInstallList`: OsInstallResponse fmt.Fprintf(os.Stdout, "Response from `OsApi.GetOsInstallList`: %v\n", resp) } ``` -------------------------------- ### Install go-isatty Package Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/vendor/github.com/mattn/go-isatty/README.md Install the go-isatty package using the go get command. ```bash go get github.com/mattn/go-isatty ``` -------------------------------- ### Get Appliance Setup Info List Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/ApplianceApi.md Retrieves a list of appliance setup information. Supports filtering, ordering, and pagination. ```go ApplianceSetupInfoResponse GetApplianceSetupInfoList(ctx).Filter(filter).Orderby(orderby).Top(top).Skip(skip).Select_(select_).Expand(expand).Apply(apply).Count(count).Inlinecount(inlinecount).At(at).Tags(tags).Execute() ``` -------------------------------- ### Install msgpack Package Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/vendor/github.com/vmihailenco/msgpack/README.md Install the msgpack package using go get. ```shell go get -u github.com/vmihailenco/msgpack ``` -------------------------------- ### Install Color Package Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/vendor/github.com/fatih/color/README.md Install the color package using go get. ```bash go get github.com/fatih/color ``` -------------------------------- ### Get Appliance Setup Info List Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/ApplianceApi.md Retrieves a list of appliance setup information with options for filtering, sorting, pagination, selecting specific fields, expanding related resources, applying transformations, and including counts. Ensure the Intersight Go SDK is imported and configured. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/CiscoDevNet/intersight-go" ) func main() { filter := "$filter=CreateTime gt 2012-08-29T21:58:33Z" // string | Filter criteria for the resources to return. A URI with a $filter query option identifies a subset of the entries from the Collection of Entries. The subset is determined by selecting only the Entries that satisfy the predicate expression specified by the $filter option. The expression language that is used in $filter queries supports references to properties and literals. The literal values can be strings enclosed in single quotes, numbers and boolean values (true or false). (optional) (default to "") orderby := "$orderby=CreationTime" // string | Determines what properties are are used to sort the collection of resources. (optional) top := int32($top=10) // int32 | Specifies the maximum number of resources to return in the response. (optional) (default to 100) skip := int32($skip=100) // int32 | Specifies the number of resources to skip in the response. (optional) (default to 0) select_ := "$select=CreateTime,ModTime" // string | Specifies a subset of properties to return. (optional) (default to "") expand := "$expand=DisplayNames" // string | Specify additional attributes or related resources to return in addition to the primary resources. (optional) apply := "apply_example" // string | Specify one or more transformation operations to perform aggregation on the resources. The transformations are processed in order with the output from a transformation being used as input for the subsequent transformation. The "$apply" query takes a sequence of set transformations, separated by forward slashes to express that they are consecutively applied, i.e., the result of each transformation is the input to the next transformation. Supported aggregation methods are "aggregate" and "groupby". The **aggregate** transformation takes a comma-separated list of one or more aggregate expressions as parameters and returns a result set with a single instance, representing the aggregated value for all instances in the input set. The **groupby** transformation takes one or two parameters and 1. Splits the initial set into subsets where all instances in a subset have the same values for the grouping properties specified in the first parameter, 2. Applies set transformations to each subset according to the second parameter, resulting in a new set of potentially different structure and cardinality, 3. Ensures that the instances in the result set contain all grouping properties with the correct values for the group, 4. Concatenates the intermediate result sets into one result set. A groupby transformation affects the structure of the result set. (optional) count := false // bool | The $count query specifies the service should return the count of the matching resources, instead of returning the resources. (optional) inlinecount := "$inlinecount=true" // string | The $inlinecount query option allows clients to request an inline count of the matching resources included with the resources in the response. (optional) (default to "allpages") at := "at=VersionType eq 'Configured'" // string | Similar to "$filter", but "at" is specifically used to filter versioning information properties for resources to return. A URI with an "at" Query Option identifies a subset of the Entries from the Collection of Entries identified by the Resource Path section of the URI. The subset is determined by selecting only the Entries that satisfy the predicate expression specified by the query option. The expression language that is used in at operators supports references to properties and literals. The literal values can be strings enclosed in single quotes, numbers and boolean values (true or false) or any of the additional literal representations shown in the Abstract Type System section. (optional) tags := "tags_example" // string | The 'tags' parameter is used to request a summary of the Tag utilization for this resource. When the 'tags' parameter is specified, the response provides a list of tag keys, the number of times the key has been used across all documents, and the tag values that have been assigned to the tag key. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.ApplianceApi.GetApplianceSetupInfoList(context.Background()).Filter(filter).Orderby(orderby).Top(top).Skip(skip).Select_(select_).Expand(expand).Apply(apply).Count(count).Inlinecount(inlinecount).At(at).Tags(tags).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `ApplianceApi.GetApplianceSetupInfoList``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetApplianceSetupInfoList`: ApplianceSetupInfoResponse fmt.Fprintf(os.Stdout, "Response from `ApplianceApi.GetApplianceSetupInfoList`: %v\n", resp) } ``` -------------------------------- ### GetBootPxeDeviceByMoid Go Example Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/BootApi.md Demonstrates how to retrieve a 'boot.PxeDevice' resource using its Moid. It shows how to set optional query parameters like $select, $expand, and 'at' for filtering and expanding the response. Ensure you have the Intersight GoSDK configured and imported. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/CiscoDevNet/intersight-go" ) func main() { moid := "moid_example" // string | The unique Moid identifier of a resource instance. select_ := "$select=CreateTime,ModTime" // string | Specifies a subset of properties to return. (optional) (default to "") expand := "$expand=DisplayNames" // string | Specify additional attributes or related resources to return in addition to the primary resources. (optional) at := "at=VersionType eq 'Configured'" // string | Similar to \"$filter\", but \"at\" is specifically used to filter versioning information properties for resources to return. A URI with an \"at\" Query Option identifies a subset of the Entries from the Collection of Entries identified by the Resource Path section of the URI. The subset is determined by selecting only the Entries that satisfy the predicate expression specified by the query option. The expression language that is used in at operators supports references to properties and literals. The literal values can be strings enclosed in single quotes, numbers and boolean values (true or false) or any of the additional literal representations shown in the Abstract Type System section. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.BootApi.GetBootPxeDeviceByMoid(context.Background(), moid).Select_(select_).Expand(expand).At(at).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `BootApi.GetBootPxeDeviceByMoid``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetBootPxeDeviceByMoid`: BootPxeDevice fmt.Fprintf(os.Stdout, "Response from `BootApi.GetBootPxeDeviceByMoid`: %v\n", resp) } ``` -------------------------------- ### Guid Method Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/IaasUcsdManagedInfra.md Provides a method to get the Guid field. ```APIDOC ## GetGuid ### Description GetGuid returns the Guid field if non-nil, zero value otherwise. ### Method Signature `func (o *IaasUcsdManagedInfra) GetGuid() IaasUcsdInfoRelationship` ``` -------------------------------- ### Create OS Bulk Install Info Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/OsApi.md Use this snippet to create a new 'os.BulkInstallInfo' resource. It requires specifying the resource details and optionally includes 'If-Match' and 'If-None-Match' headers for conditional requests. ```go package main import ( "context" "fmt" "os" openapi client "github.com/CiscoDevNet/intersight-go" ) func main() { osBulkInstallInfo := *openapiclient.NewOsBulkInstallInfo("ClassId_example", "ObjectType_example") // OsBulkInstallInfo | The 'os.BulkInstallInfo' resource to create. ifMatch := "ifMatch_example" // string | For methods that apply server-side changes, and in particular for PUT, If-Match can be used to prevent the lost update problem. It can check if the modification of a resource that the user wants to upload will not override another change that has been done since the original resource was fetched. If the request cannot be fulfilled, the 412 (Precondition Failed) response is returned. When modifying a resource using POST or PUT, the If-Match header must be set to the value of the resource ModTime property after which no lost update problem should occur. For example, a client send a GET request to obtain a resource, which includes the ModTime property. The ModTime indicates the last time the resource was created or modified. The client then sends a POST or PUT request with the If-Match header set to the ModTime property of the resource as obtained in the GET request. (optional) ifNoneMatch := "ifNoneMatch_example" // string | For methods that apply server-side changes, If-None-Match used with the * value can be used to create a resource not known to exist, guaranteeing that another resource creation didn't happen before, losing the data of the previous put. The request will be processed only if the eventually existing resource's ETag doesn't match any of the values listed. Otherwise, the status code 412 (Precondition Failed) is used. The asterisk is a special value representing any resource. It is only useful when creating a resource, usually with PUT, to check if another resource with the identity has already been created before. The comparison with the stored ETag uses the weak comparison algorithm, meaning two resources are considered identical if the content is equivalent - they don't have to be identical byte for byte. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OsApi.CreateOsBulkInstallInfo(context.Background()).OsBulkInstallInfo(osBulkInstallInfo).IfMatch(ifMatch).IfNoneMatch(ifNoneMatch).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OsApi.CreateOsBulkInstallInfo``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `CreateOsBulkInstallInfo`: OsBulkInstallInfo fmt.Fprintf(os.Stdout, "Response from `OsApi.CreateOsBulkInstallInfo`: %v\n", resp) } ``` -------------------------------- ### CreateOsInstall Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/OsApi.md Creates a new 'os.Install' resource. This initiates a new operating system installation process. ```APIDOC ## Post /api/v1/os/Installs ### Description Create a 'os.Install' resource. ### Method POST ### Endpoint /api/v1/os/Installs ``` -------------------------------- ### Install Levenshtein Package Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/vendor/github.com/agext/levenshtein/README.md Use 'go get' to install the levenshtein package. This command fetches and installs the package and its dependencies. ```go go get github.com/agext/levenshtein ``` -------------------------------- ### Create OS Install Resource Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/OsApi.md This Go code snippet demonstrates how to create an 'os.Install' resource using the Intersight GoSDK. It shows the necessary imports, configuration, and API call to execute the creation. The example includes handling potential errors and printing the response. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/CiscoDevNet/intersight-go" ) func main() { osInstall := *openapiclient.NewOsInstall("ClassId_example", "ObjectType_example") // OsInstall | The 'os.Install' resource to create. ifMatch := "ifMatch_example" // string | For methods that apply server-side changes, and in particular for PUT, If-Match can be used to prevent the lost update problem. It can check if the modification of a resource that the user wants to upload will not override another change that has been done since the original resource was fetched. If the request cannot be fulfilled, the 412 (Precondition Failed) response is returned. When modifying a resource using POST or PUT, the If-Match header must be set to the value of the resource ModTime property after which no lost update problem should occur. For example, a client send a GET request to obtain a resource, which includes the ModTime property. The ModTime indicates the last time the resource was created or modified. The client then sends a POST or PUT request with the If-Match header set to the ModTime property of the resource as obtained in the GET request. (optional) ifNoneMatch := "ifNoneMatch_example" // string | For methods that apply server-side changes, If-None-Match used with the * value can be used to create a resource not known to exist, guaranteeing that another resource creation didn't happen before, losing the data of the previous put. The request will be processed only if the eventually existing resource's ETag doesn't match any of the values listed. Otherwise, the status code 412 (Precondition Failed) is used. The asterisk is a special value representing any resource. It is only useful when creating a resource, usually with PUT, to check if another resource with the identity has already been created before. The comparison with the stored ETag uses the weak comparison algorithm, meaning two resources are considered identical if the content is equivalent - they don't have to be identical byte for byte. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OsApi.CreateOsInstall(context.Background()).OsInstall(osInstall).IfMatch(ifMatch).IfNoneMatch(ifNoneMatch).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OsApi.CreateOsInstall``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `CreateOsInstall`: OsInstall fmt.Fprintf(os.Stdout, "Response from `OsApi.CreateOsInstall`: %v\n", resp) } ``` -------------------------------- ### Create TechSupportBundle Go Example Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/TechsupportmanagementApi.md Demonstrates how to create a 'techsupportmanagement.TechSupportBundle' resource using the Intersight Go SDK. Includes setting optional If-Match and If-None-Match headers. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/CiscoDevNet/intersight-go" ) func main() { techsupportmanagementTechSupportBundle := *openapiclient.NewTechsupportmanagementTechSupportBundle("ClassId_example", "ObjectType_example") // TechsupportmanagementTechSupportBundle | The 'techsupportmanagement.TechSupportBundle' resource to create. ifMatch := "ifMatch_example" // string | For methods that apply server-side changes, and in particular for PUT, If-Match can be used to prevent the lost update problem. It can check if the modification of a resource that the user wants to upload will not override another change that has been done since the original resource was fetched. If the request cannot be fulfilled, the 412 (Precondition Failed) response is returned. When modifying a resource using POST or PUT, the If-Match header must be set to the value of the resource ModTime property after which no lost update problem should occur. For example, a client send a GET request to obtain a resource, which includes the ModTime property. The ModTime indicates the last time the resource was created or modified. The client then sends a POST or PUT request with the If-Match header set to the ModTime property of the resource as obtained in the GET request. (optional) ifNoneMatch := "ifNoneMatch_example" // string | For methods that apply server-side changes, If-None-Match used with the * value can be used to create a resource not known to exist, guaranteeing that another resource creation didn't happen before, losing the data of the previous put. The request will be processed only if the eventually existing resource's ETag doesn't match any of the values listed. Otherwise, the status code 412 (Precondition Failed) is used. The asterisk is a special value representing any resource. It is only useful when creating a resource, usually with PUT, to check if another resource with the identity has already been created before. The comparison with the stored ETag uses the weak comparison algorithm, meaning two resources are considered identical if the content is equivalent - they don't have to be identical byte for byte. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.TechsupportmanagementApi.CreateTechsupportmanagementTechSupportBundle(context.Background()).TechsupportmanagementTechSupportBundle(techsupportmanagementTechSupportBundle).IfMatch(ifMatch).IfNoneMatch(ifNoneMatch).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `TechsupportmanagementApi.CreateTechsupportmanagementTechSupportBundle``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `CreateTechsupportmanagementTechSupportBundle`: TechsupportmanagementTechSupportBundle fmt.Fprintf(os.Stdout, "Response from `TechsupportmanagementApi.CreateTechsupportmanagementTechSupportBundle`: %v\n", resp) } ``` -------------------------------- ### Install go-colorable Package Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/vendor/github.com/mattn/go-colorable/README.md This command installs the go-colorable package using the go get command. ```bash $ go get github.com/mattn/go-colorable ``` -------------------------------- ### Get Server Configuration Import List with Options Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/ServerApi.md Demonstrates how to fetch a list of server configurations with various query parameters like filter, orderby, top, skip, select, expand, apply, count, inlinecount, and tags. This is useful for precise data retrieval and manipulation. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/CiscoDevNet/intersight-go" ) func main() { filter := "$filter=CreateTime gt 2012-08-29T21:58:33Z" // string | Filter criteria for the resources to return. A URI with a $filter query option identifies a subset of the entries from the Collection of Entries. The subset is determined by selecting only the Entries that satisfy the predicate expression specified by the $filter option. The expression language that is used in $filter queries supports references to properties and literals. The literal values can be strings enclosed in single quotes, numbers and boolean values (true or false). (optional) (default to "") orderby := "$orderby=CreationTime" // string | Determines what properties are used to sort the collection of resources. (optional) top := int32($top=10) // int32 | Specifies the maximum number of resources to return in the response. (optional) (default to 100) skip := int32($skip=100) // int32 | Specifies the number of resources to skip in the response. (optional) (default to 0) select_ := "$select=CreateTime,ModTime" // string | Specifies a subset of properties to return. (optional) (default to "") expand := "$expand=DisplayNames" // string | Specify additional attributes or related resources to return in addition to the primary resources. (optional) apply := "apply_example" // string | Specify one or more transformation operations to perform aggregation on the resources. The transformations are processed in order with the output from a transformation being used as input for the subsequent transformation. The "$apply" query takes a sequence of set transformations, separated by forward slashes to express that they are consecutively applied, i.e., the result of each transformation is the input to the next transformation. Supported aggregation methods are "aggregate" and "groupby". The **aggregate** transformation takes a comma-separated list of one or more aggregate expressions as parameters and returns a result set with a single instance, representing the aggregated value for all instances in the input set. The **groupby** transformation takes one or two parameters and 1. Splits the initial set into subsets where all instances in a subset have the same values for the grouping properties specified in the first parameter, 2. Applies set transformations to each subset according to the second parameter, resulting in a new set of potentially different structure and cardinality, 3. Ensures that the instances in the result set contain all grouping properties with the correct values for the group, 4. Concatenates the intermediate result sets into one result set. A groupby transformation affects the structure of the result set. (optional) count := false // bool | The $count query specifies the service should return the count of the matching resources, instead of returning the resources. (optional) inlinecount := "$inlinecount=true" // string | The $inlinecount query option allows clients to request an inline count of the matching resources included with the resources in the response. (optional) (default to "allpages") at := "at=VersionType eq 'Configured'" // string | Similar to "$filter", but "at" is specifically used to filter versioning information properties for resources to return. A URI with an "at" Query Option identifies a subset of the Entries from the Collection of Entries identified by the Resource Path section of the URI. The subset is determined by selecting only the Entries that satisfy the predicate expression specified by the query option. The expression language that is used in at operators supports references to properties and literals. The literal values can be strings enclosed in single quotes, numbers and boolean values (true or false) or any of the additional literal representations shown in the Abstract Type System section. (optional) tags := "tags_example" // string | The 'tags' parameter is used to request a summary of the Tag utilization for this resource. When the 'tags' parameter is specified, the response provides a list of tag keys, the number of times the key has been used across all documents, and the tag values that have been assigned to the tag key. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.ServerApi.GetServerConfigImportList(context.Background()).Filter(filter).Orderby(orderby).Top(top).Skip(skip).Select_(select_).Expand(expand).Apply(apply).Count(count).Inlinecount(inlinecount).At(at).Tags(tags).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `ServerApi.GetServerConfigImportList``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetServerConfigImportList`: ServerConfigImportResponse fmt.Fprintf(os.Stdout, "Response from `ServerApi.GetServerConfigImportList`: %v\n", resp) } ``` -------------------------------- ### Guid Methods Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/IaasLicenseInfo.md Provides methods to get, set, unset, and check the status of the Guid field. ```APIDOC ## GetGuid ### Description Gets the Guid field, returning its value. ### Method `GetGuid` ### Parameters None ### Response - **IaasUcsdInfoRelationship**: The value of the Guid field. ## GetGuidOk ### Description Gets the Guid field, returning the value and a boolean indicating if it's set. ### Method `GetGuidOk` ### Parameters None ### Response - **IaasUcsdInfoRelationship**: The value of the Guid field. - **bool**: True if the Guid field has been set, false otherwise. ## SetGuid ### Description Sets the Guid field to a given IaasUcsdInfoRelationship value. ### Method `SetGuid` ### Parameters - **v** (IaasUcsdInfoRelationship) - The value to set for Guid. ### Response None ## HasGuid ### Description Checks if the Guid field has been set. ### Method `HasGuid` ### Parameters None ### Response - **bool**: True if the Guid field has been set, false otherwise. ## SetGuidNil ### Description Sets the Guid field to an explicit nil value. ### Method `SetGuidNil` ### Parameters - **b** (bool) - If true, sets the field to nil. ### Response None ## UnsetGuid ### Description Ensures that no value is present for the Guid field, not even an explicit nil. ### Method `UnsetGuid` ### Parameters None ### Response None ``` -------------------------------- ### Quickstart: Marshal and Unmarshal Struct Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/vendor/github.com/vmihailenco/msgpack/README.md Demonstrates basic encoding (Marshal) and decoding (Unmarshal) of a struct using msgpack. Ensure the struct fields are exported for proper encoding. ```go func ExampleMarshal() { tpe Item struct { Foo string } b, err := msgpack.Marshal(&Item{Foo: "bar"}) if err != nil { panic(err) } var item Item err = msgpack.Unmarshal(b, &item) if err != nil { panic(err) } fmt.Println(item.Foo) // Output: bar } ``` -------------------------------- ### Start Time Management Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/ApplianceRestore.md Methods for setting, getting, and checking the start time for appliance restore. ```APIDOC ## SetStartTime ### Description Sets the StartTime field for the appliance restore operation. ### Method `SetStartTime(v time.Time)` ### Parameters - **v** (time.Time) - The start time value to set. ``` ```APIDOC ## GetStartTime ### Description Retrieves the StartTime field for the appliance restore operation. ### Method `GetStartTime() time.Time` ### Returns - **time.Time** - The start time of the restore operation. Returns the zero value if not set. ``` ```APIDOC ## GetStartTimeOk ### Description Retrieves the StartTime field and a boolean indicating if it has been set. ### Method `GetStartTimeOk() (*time.Time, bool)` ### Returns - **(*time.Time, bool)** - A tuple containing a pointer to the start time and a boolean. The boolean is true if the field is set, false otherwise. ``` ```APIDOC ## HasStartTime ### Description Checks if the StartTime field has been set for the appliance restore operation. ### Method `HasStartTime() bool` ### Returns - **bool** - True if the start time has been set, false otherwise. ``` -------------------------------- ### Get Boot HDD Device List with Query Parameters Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/BootApi.md Demonstrates how to retrieve a list of Boot HDD devices using the `GetBootHddDeviceList` function. This example shows how to apply various query parameters such as filter, orderby, top, skip, select, expand, apply, count, inlinecount, and tags. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/CiscoDevNet/intersight-go" ) func main() { filter := "$filter=CreateTime gt 2012-08-29T21:58:33Z" // string | Filter criteria for the resources to return. A URI with a $filter query option identifies a subset of the entries from the Collection of Entries. The subset is determined by selecting only the Entries that satisfy the predicate expression specified by the $filter option. The expression language that is used in $filter queries supports references to properties and literals. The literal values can be strings enclosed in single quotes, numbers and boolean values (true or false). (optional) (default to "") orderby := "$orderby=CreationTime" // string | Determines what properties are used to sort the collection of resources. (optional) top := int32($top=10) // int32 | Specifies the maximum number of resources to return in the response. (optional) (default to 100) skip := int32($skip=100) // int32 | Specifies the number of resources to skip in the response. (optional) (default to 0) select_ := "$select=CreateTime,ModTime" // string | Specifies a subset of properties to return. (optional) (default to "") expand := "$expand=DisplayNames" // string | Specify additional attributes or related resources to return in addition to the primary resources. (optional) apply := "apply_example" // string | Specify one or more transformation operations to perform aggregation on the resources. The transformations are processed in order with the output from a transformation being used as input for the subsequent transformation. The \"$apply\" query takes a sequence of set transformations, separated by forward slashes to express that they are consecutively applied, i.e., the result of each transformation is the input to the next transformation. Supported aggregation methods are \"aggregate\" and \"groupby\". The **aggregate** transformation takes a comma-separated list of one or more aggregate expressions as parameters and returns a result set with a single instance, representing the aggregated value for all instances in the input set. The **groupby** transformation takes one or two parameters and 1. Splits the initial set into subsets where all instances in a subset have the same values for the grouping properties specified in the first parameter, 2. Applies set transformations to each subset according to the second parameter, resulting in a new set of potentially different structure and cardinality, 3. Ensures that the instances in the result set contain all grouping properties with the correct values for the group, 4. Concatenates the intermediate result sets into one result set. A groupby transformation affects the structure of the result set. (optional) count := false // bool | The $count query specifies the service should return the count of the matching resources, instead of returning the resources. (optional) inlinecount := "$inlinecount=true" // string | The $inlinecount query option allows clients to request an inline count of the matching resources included with the resources in the response. (optional) (default to "allpages") at := "at=VersionType eq 'Configured'" // string | Similar to \"$filter\", but \"at\" is specifically used to filter versioning information properties for resources to return. A URI with an \"at\" Query Option identifies a subset of the Entries from the Collection of Entries identified by the Resource Path section of the URI. The subset is determined by selecting only the Entries that satisfy the predicate expression specified by the query option. The expression language that is used in at operators supports references to properties and literals. The literal values can be strings enclosed in single quotes, numbers and boolean values (true or false) or any of the additional literal representations shown in the Abstract Type System section. (optional) tags := "tags_example" // string | The 'tags' parameter is used to request a summary of the Tag utilization for this resource. When the 'tags' parameter is specified, the response provides a list of tag keys, the number of times the key has been used across all documents, and the tag values that have been assigned to the tag key. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.BootApi.GetBootHddDeviceList(context.Background()).Filter(filter).Orderby(orderby).Top(top).Skip(skip).Select_(select_).Expand(expand).Apply(apply).Count(count).Inlinecount(inlinecount).At(at).Tags(tags).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `BootApi.GetBootHddDeviceList``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetBootHddDeviceList`: BootHddDeviceResponse fmt.Fprintf(os.Stdout, "Response from `BootApi.GetBootHddDeviceList`: %v\n", resp) } ``` -------------------------------- ### Get Storage Controller Drives with Query Parameters Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/StorageApi.md Retrieves a list of storage controller drives using various query parameters for filtering, sorting, and selecting specific fields. This example demonstrates how to set up the API client and make a request with multiple options. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/CiscoDevNet/intersight-go" ) func main() { filter := "$filter=CreateTime gt 2012-08-29T21:58:33Z" orderby := "$orderby=CreationTime" top := int32($top=10) skip := int32($skip=100) select_ := "$select=CreateTime,ModTime" expand := "$expand=DisplayNames" apply := "apply_example" count := false inlinecount := "$inlinecount=true" at := "at=VersionType eq 'Configured'" tags := "tags_example" configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.StorageApi.GetStorageControllerDriveList(context.Background()).Filter(filter).Orderby(orderby).Top(top).Skip(skip).Select_(select_).Expand(expand).Apply(apply).Count(count).Inlinecount(inlinecount).At(at).Tags(tags).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `StorageApi.GetStorageControllerDriveList``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetStorageControllerDriveList`: StorageControllerDriveResponse fmt.Fprintf(os.Stdout, "Response from `StorageApi.GetStorageControllerDriveList`: %v\n", resp) } ``` -------------------------------- ### Get Storage NetApp Disk Event List with Filters Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/intersight_gosdk/docs/StorageApi.md Retrieves a list of Storage NetApp Disk Events with various query parameters for filtering, sorting, and pagination. This example demonstrates how to use the `GetStorageNetAppDiskEventList` method with options like `$filter`, `$orderby`, `$top`, `$skip`, `$select`, `$expand`, `$apply`, `$count`, `$inlinecount`, and `tags`. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/CiscoDevNet/intersight-go" ) func main() { filter := "$filter=CreateTime gt 2012-08-29T21:58:33Z" orderby := "$orderby=CreationTime" top := int32($top=10) skip := int32($skip=100) select_ := "$select=CreateTime,ModTime" expand := "$expand=DisplayNames" apply := "apply_example" count := false inlinecount := "$inlinecount=true" at := "at=VersionType eq 'Configured'" tags := "tags_example" configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.StorageApi.GetStorageNetAppDiskEventList(context.Background()).Filter(filter).Orderby(orderby).Top(top).Skip(skip).Select_(select_).Expand(expand).Apply(apply).Count(count).Inlinecount(inlinecount).At(at).Tags(tags).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `StorageApi.GetStorageNetAppDiskEventList``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetStorageNetAppDiskEventList`: StorageNetAppDiskEventResponse fmt.Fprintf(os.Stdout, "Response from `StorageApi.GetStorageNetAppDiskEventList`: %v\n", resp) } ``` -------------------------------- ### Install copystructure Go Library Source: https://github.com/ciscodevnet/terraform-provider-intersight/blob/main/vendor/github.com/mitchellh/copystructure/README.md Install the copystructure library using the standard Go get command. ```bash go get github.com/mitchellh/copystructure ```