diff --git a/.gitattributes b/.gitattributes index d8a8798d..f93bb19c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ pkg/config-api-client/** linguist-generated=true +docs/** linguist-generated=true pkg/config-api-client/test/** linguist-generated=false diff --git a/.github/workflows/lint-test-code.yaml b/.github/workflows/lint-test-code.yaml index 59f98f6e..922ea611 100644 --- a/.github/workflows/lint-test-code.yaml +++ b/.github/workflows/lint-test-code.yaml @@ -51,7 +51,8 @@ jobs: - name: Check Provider docs up to date run: | just generate-provider-docs - git diff --exit-code -- docs + git add --all docs + git diff --cached --exit-code -- docs || exit 1 - name: Check Provider docs valid run: just validate-provider-docs diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..c400cf09 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Hewlett Packard Enterprise Development LP + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 0aa58393..9fe3d7c3 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ go_path = $(go env GOPATH)/bin ``` dev_overrides { - "registry.terraform.io/arubauxi/configuration" = "" + "registry.terraform.io/arubauxi/hpeuxi" = "" } ``` @@ -17,7 +17,7 @@ Example `~/.terraformrc` file ``` provider_installation { dev_overrides { - "registry.terraform.io/arubauxi/configuration" = "/Users//go/bin" + "registry.terraform.io/arubauxi/hpeuxi" = "/Users//go/bin" } direct {} } diff --git a/docs/data-sources/agent.md b/docs/data-sources/agent.md index 0191f678..1ce0a536 100644 --- a/docs/data-sources/agent.md +++ b/docs/data-sources/agent.md @@ -21,11 +21,8 @@ description: |- ### Read-Only -- `address_note` (String) - `ethernet_mac_address` (String) - `id` (String) The ID of this resource. -- `latitude` (Number) -- `longitude` (Number) - `model_number` (String) - `name` (String) - `notes` (String) diff --git a/docs/data-sources/agent_group_assignment.md b/docs/data-sources/agent_group_assignment.md new file mode 100644 index 00000000..eaf03bf7 --- /dev/null +++ b/docs/data-sources/agent_group_assignment.md @@ -0,0 +1,33 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "uxi_agent_group_assignment Data Source - uxi" +subcategory: "" +description: |- + +--- + +# uxi_agent_group_assignment (Data Source) + + + + + + +## Schema + +### Required + +- `filter` (Attributes) (see [below for nested schema](#nestedatt--filter)) + +### Read-Only + +- `agent_id` (String) +- `group_id` (String) +- `id` (String) The ID of this resource. + + +### Nested Schema for `filter` + +Required: + +- `agent_group_assignment_id` (String) diff --git a/docs/data-sources/service_test.md b/docs/data-sources/service_test.md new file mode 100644 index 00000000..70d64f9e --- /dev/null +++ b/docs/data-sources/service_test.md @@ -0,0 +1,36 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "uxi_service_test Data Source - uxi" +subcategory: "" +description: |- + +--- + +# uxi_service_test (Data Source) + + + + + + +## Schema + +### Required + +- `filter` (Attributes) (see [below for nested schema](#nestedatt--filter)) + +### Read-Only + +- `category` (String) +- `id` (String) The ID of this resource. +- `is_enabled` (String) +- `name` (String) +- `target` (String) +- `template` (String) + + +### Nested Schema for `filter` + +Required: + +- `service_test_id` (String) diff --git a/docs/data-sources/service_test_group_assignment.md b/docs/data-sources/service_test_group_assignment.md new file mode 100644 index 00000000..644aac60 --- /dev/null +++ b/docs/data-sources/service_test_group_assignment.md @@ -0,0 +1,33 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "uxi_service_test_group_assignment Data Source - uxi" +subcategory: "" +description: |- + +--- + +# uxi_service_test_group_assignment (Data Source) + + + + + + +## Schema + +### Required + +- `filter` (Attributes) (see [below for nested schema](#nestedatt--filter)) + +### Read-Only + +- `group_id` (String) +- `id` (String) The ID of this resource. +- `service_test_id` (String) + + +### Nested Schema for `filter` + +Required: + +- `service_test_group_assignment_id` (String) diff --git a/examples/full-demo/main.tf b/examples/full-demo/main.tf index 565da15c..cb16a366 100644 --- a/examples/full-demo/main.tf +++ b/examples/full-demo/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { uxi = { - source = "registry.terraform.io/arubauxi/configuration" + source = "registry.terraform.io/arubauxi/hpeuxi" } } } diff --git a/go.mod b/go.mod index 56484332..c739f809 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ -module github.com/aruba-uxi/terraform-provider-configuration +module github.com/aruba-uxi/terraform-provider-hpeuxi go 1.21 toolchain go1.22.5 require ( - github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client v0.0.0-00010101000000-000000000000 + github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client v0.0.0-00010101000000-000000000000 github.com/h2non/gock v1.2.0 github.com/hashicorp/terraform-plugin-framework v1.10.0 github.com/hashicorp/terraform-plugin-go v0.23.0 @@ -68,4 +68,4 @@ require ( google.golang.org/protobuf v1.34.0 // indirect ) -replace github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client => ./pkg/config-api-client +replace github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client => ./pkg/config-api-client diff --git a/internal/provider/datasources/agent.go b/internal/provider/datasources/agent.go index 04784ba0..dacabd01 100644 --- a/internal/provider/datasources/agent.go +++ b/internal/provider/datasources/agent.go @@ -3,8 +3,8 @@ package datasources import ( "context" - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" @@ -24,17 +24,14 @@ type agentDataSource struct { } type agentDataSourceModel struct { - Id types.String `tfsdk:"id"` - Serial types.String `tfsdk:"serial"` - Name types.String `tfsdk:"name"` - ModelNumber types.String `tfsdk:"model_number"` - WifiMacAddress types.String `tfsdk:"wifi_mac_address"` - EthernetMacAddress types.String `tfsdk:"ethernet_mac_address"` - AddressNote types.String `tfsdk:"address_note"` - Longitude types.Float32 `tfsdk:"longitude"` - Latitude types.Float32 `tfsdk:"latitude"` - Notes types.String `tfsdk:"notes"` - PcapMode types.String `tfsdk:"pcap_mode"` + Id types.String `tfsdk:"id"` + Serial types.String `tfsdk:"serial"` + Name types.String `tfsdk:"name"` + ModelNumber types.String `tfsdk:"model_number"` + WifiMacAddress types.String `tfsdk:"wifi_mac_address"` + EthernetMacAddress types.String `tfsdk:"ethernet_mac_address"` + Notes types.String `tfsdk:"notes"` + PcapMode types.String `tfsdk:"pcap_mode"` Filter struct { AgentID types.String `tfsdk:"agent_id"` } `tfsdk:"filter"` @@ -73,15 +70,6 @@ func (d *agentDataSource) Schema( "ethernet_mac_address": schema.StringAttribute{ Computed: true, }, - "address_note": schema.StringAttribute{ - Computed: true, - }, - "longitude": schema.Float32Attribute{ - Computed: true, - }, - "latitude": schema.Float32Attribute{ - Computed: true, - }, "notes": schema.StringAttribute{ Computed: true, }, @@ -137,6 +125,7 @@ func (d *agentDataSource) Read( state.Id = types.StringValue(agent.Id) state.Name = types.StringValue(agent.Name) + state.Serial = types.StringValue(agent.Serial) state.ModelNumber = types.StringPointerValue(agent.ModelNumber.Get()) state.WifiMacAddress = types.StringPointerValue(agent.WifiMacAddress.Get()) state.EthernetMacAddress = types.StringPointerValue(agent.EthernetMacAddress.Get()) diff --git a/internal/provider/datasources/agent_group_assignment.go b/internal/provider/datasources/agent_group_assignment.go index 32f7de49..ba21443a 100644 --- a/internal/provider/datasources/agent_group_assignment.go +++ b/internal/provider/datasources/agent_group_assignment.go @@ -3,8 +3,8 @@ package datasources import ( "context" - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" diff --git a/internal/provider/datasources/group.go b/internal/provider/datasources/group.go index 5030d44f..2d5e34b1 100644 --- a/internal/provider/datasources/group.go +++ b/internal/provider/datasources/group.go @@ -3,8 +3,8 @@ package datasources import ( "context" - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" diff --git a/internal/provider/datasources/network_group_assignment.go b/internal/provider/datasources/network_group_assignment.go index 3ed0fdf3..5f83547a 100644 --- a/internal/provider/datasources/network_group_assignment.go +++ b/internal/provider/datasources/network_group_assignment.go @@ -3,8 +3,8 @@ package datasources import ( "context" - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" diff --git a/internal/provider/datasources/sensor.go b/internal/provider/datasources/sensor.go index b1437fa4..9f691617 100644 --- a/internal/provider/datasources/sensor.go +++ b/internal/provider/datasources/sensor.go @@ -3,8 +3,8 @@ package datasources import ( "context" - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" @@ -137,6 +137,7 @@ func (d *sensorDataSource) Read( state.Id = types.StringValue(sensor.Id) state.Name = types.StringValue(sensor.Name) + state.Serial = types.StringValue(sensor.Serial) state.ModelNumber = types.StringValue(sensor.ModelNumber) state.WifiMacAddress = types.StringPointerValue(sensor.WifiMacAddress.Get()) state.EthernetMacAddress = types.StringPointerValue(sensor.EthernetMacAddress.Get()) diff --git a/internal/provider/datasources/sensor_group_assignment.go b/internal/provider/datasources/sensor_group_assignment.go index 493f3acd..97815de4 100644 --- a/internal/provider/datasources/sensor_group_assignment.go +++ b/internal/provider/datasources/sensor_group_assignment.go @@ -3,8 +3,8 @@ package datasources import ( "context" - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" diff --git a/internal/provider/datasources/service.go b/internal/provider/datasources/service.go index 14a9afa8..05a01bff 100644 --- a/internal/provider/datasources/service.go +++ b/internal/provider/datasources/service.go @@ -3,8 +3,8 @@ package datasources import ( "context" - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" diff --git a/internal/provider/datasources/service_test_group_assignment.go b/internal/provider/datasources/service_test_group_assignment.go new file mode 100644 index 00000000..87be6475 --- /dev/null +++ b/internal/provider/datasources/service_test_group_assignment.go @@ -0,0 +1,134 @@ +package datasources + +import ( + "context" + + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" +) + +var ( + _ datasource.DataSource = &serviceTestGroupAssignmentDataSource{} + _ datasource.DataSourceWithConfigure = &serviceTestGroupAssignmentDataSource{} +) + +func NewServiceTestGroupAssignmentDataSource() datasource.DataSource { + return &serviceTestGroupAssignmentDataSource{} +} + +type serviceTestGroupAssignmentDataSource struct { + client *config_api_client.APIClient +} + +type serviceTestGroupAssignmentDataSourceModel struct { + ID types.String `tfsdk:"id"` + ServiceTestID types.String `tfsdk:"service_test_id"` + GroupID types.String `tfsdk:"group_id"` + Filter struct { + ServiceTestGroupAssignmentID string `tfsdk:"service_test_group_assignment_id"` + } `tfsdk:"filter"` +} + +func (d *serviceTestGroupAssignmentDataSource) Metadata( + _ context.Context, + req datasource.MetadataRequest, + resp *datasource.MetadataResponse, +) { + resp.TypeName = req.ProviderTypeName + "_service_test_group_assignment" +} + +func (d *serviceTestGroupAssignmentDataSource) Schema( + _ context.Context, + _ datasource.SchemaRequest, + resp *datasource.SchemaResponse, +) { + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + }, + "service_test_id": schema.StringAttribute{ + Computed: true, + }, + "group_id": schema.StringAttribute{ + Computed: true, + }, + "filter": schema.SingleNestedAttribute{ + Required: true, + Attributes: map[string]schema.Attribute{ + "service_test_group_assignment_id": schema.StringAttribute{ + Required: true, + }, + }, + }, + }, + } +} + +func (d *serviceTestGroupAssignmentDataSource) Read( + ctx context.Context, + req datasource.ReadRequest, + resp *datasource.ReadResponse, +) { + var state serviceTestGroupAssignmentDataSourceModel + + diags := req.Config.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + request := d.client.ConfigurationAPI. + ServiceTestGroupAssignmentsGet(ctx). + Id(state.Filter.ServiceTestGroupAssignmentID) + serviceTestGroupAssignmentResponse, response, err := util.RetryFor429(request.Execute) + errorPresent, errorDetail := util.RaiseForStatus(response, err) + + errorSummary := util.GenerateErrorSummary("read", "uxi_service_test_group_assignment") + + if errorPresent { + resp.Diagnostics.AddError(errorSummary, errorDetail) + return + } + + if len(serviceTestGroupAssignmentResponse.Items) != 1 { + resp.Diagnostics.AddError(errorSummary, "Could not find specified data source") + return + } + + serviceTestGroupAssignment := serviceTestGroupAssignmentResponse.Items[0] + state.ID = types.StringValue(serviceTestGroupAssignment.Id) + state.ServiceTestID = types.StringValue(serviceTestGroupAssignment.ServiceTest.Id) + state.GroupID = types.StringValue(serviceTestGroupAssignment.Group.Id) + + diags = resp.State.Set(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } +} + +func (d *serviceTestGroupAssignmentDataSource) Configure( + _ context.Context, + req datasource.ConfigureRequest, + resp *datasource.ConfigureResponse, +) { + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*config_api_client.APIClient) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + "Data Source type: ServiceTest Group Assignment. Please report this issue to the provider developers.", + ) + return + } + + d.client = client +} diff --git a/internal/provider/datasources/wired_network.go b/internal/provider/datasources/wired_network.go index 94dd3a1a..deef592c 100644 --- a/internal/provider/datasources/wired_network.go +++ b/internal/provider/datasources/wired_network.go @@ -3,8 +3,8 @@ package datasources import ( "context" - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" diff --git a/internal/provider/datasources/wireless_network.go b/internal/provider/datasources/wireless_network.go index d8f03c32..6ae39e2e 100644 --- a/internal/provider/datasources/wireless_network.go +++ b/internal/provider/datasources/wireless_network.go @@ -3,8 +3,8 @@ package datasources import ( "context" - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 74942c8b..0e3419aa 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -4,15 +4,15 @@ import ( "context" "os" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/datasources" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/resources" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/datasources" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/resources" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/provider/schema" "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/types" "net/http" @@ -174,6 +174,7 @@ func (p *uxiConfigurationProvider) DataSources(_ context.Context) []func() datas datasources.NewSensorDataSource, datasources.NewSensorGroupAssignmentDataSource, datasources.NewServiceTestDataSource, + datasources.NewServiceTestGroupAssignmentDataSource, datasources.NewWiredNetworkDataSource, datasources.NewWirelessNetworkDataSource, } diff --git a/internal/provider/resources/agent.go b/internal/provider/resources/agent.go index fb7284fd..4be102d7 100644 --- a/internal/provider/resources/agent.go +++ b/internal/provider/resources/agent.go @@ -3,8 +3,8 @@ package resources import ( "context" - "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" diff --git a/internal/provider/resources/agent_group_assignment.go b/internal/provider/resources/agent_group_assignment.go index 8930b286..1d8563ef 100644 --- a/internal/provider/resources/agent_group_assignment.go +++ b/internal/provider/resources/agent_group_assignment.go @@ -2,8 +2,8 @@ package resources import ( "context" - "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -31,11 +31,6 @@ type AgentGroupAssignmentResponseModel struct { AgentUID string // } -type AgentGroupAssignmentRequestModel struct { - GroupUID string // , - AgentUID string // -} - func NewAgentGroupAssignmentResource() resource.Resource { return &agentGroupAssignmentResource{} } @@ -116,16 +111,28 @@ func (r *agentGroupAssignmentResource) Create( return } - // TODO: Call client createAgentGroupAssignment method - agentGroupAssignment := CreateAgentGroupAssignment(AgentGroupAssignmentRequestModel{ - GroupUID: plan.GroupID.ValueString(), - AgentUID: plan.AgentID.ValueString(), - }) + postRequest := config_api_client.NewAgentGroupAssignmentsPostRequest( + plan.GroupID.ValueString(), + plan.AgentID.ValueString(), + ) + request := r.client.ConfigurationAPI. + AgentGroupAssignmentsPost(ctx). + AgentGroupAssignmentsPostRequest(*postRequest) + agentGroupAssignment, response, err := util.RetryFor429(request.Execute) + errorPresent, errorDetail := util.RaiseForStatus(response, err) + + if errorPresent { + resp.Diagnostics.AddError( + util.GenerateErrorSummary("create", "uxi_agent_group_assignment"), + errorDetail, + ) + return + } // Update the state to match the plan - plan.ID = types.StringValue(agentGroupAssignment.UID) - plan.GroupID = types.StringValue(agentGroupAssignment.GroupUID) - plan.AgentID = types.StringValue(agentGroupAssignment.AgentUID) + plan.ID = types.StringValue(agentGroupAssignment.Id) + plan.GroupID = types.StringValue(agentGroupAssignment.Group.Id) + plan.AgentID = types.StringValue(agentGroupAssignment.Agent.Id) // Set state to fully populated data diags = resp.State.Set(ctx, plan) @@ -218,13 +225,3 @@ func (r *agentGroupAssignmentResource) ImportState( ) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } - -var CreateAgentGroupAssignment = func(request AgentGroupAssignmentRequestModel) AgentGroupAssignmentResponseModel { - // TODO: Query the agentGroupAssignment using the client - - return AgentGroupAssignmentResponseModel{ - UID: "mock_uid", - GroupUID: "mock_group_uid", - AgentUID: "mock_agent_uid", - } -} diff --git a/internal/provider/resources/group.go b/internal/provider/resources/group.go index 2f931992..68c99019 100644 --- a/internal/provider/resources/group.go +++ b/internal/provider/resources/group.go @@ -3,8 +3,8 @@ package resources import ( "context" - "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" diff --git a/internal/provider/resources/network_group_assignment.go b/internal/provider/resources/network_group_assignment.go index 5b35c0cb..3212fefe 100644 --- a/internal/provider/resources/network_group_assignment.go +++ b/internal/provider/resources/network_group_assignment.go @@ -2,8 +2,8 @@ package resources import ( "context" - "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" diff --git a/internal/provider/resources/sensor.go b/internal/provider/resources/sensor.go index 0a912e30..a821ae8c 100644 --- a/internal/provider/resources/sensor.go +++ b/internal/provider/resources/sensor.go @@ -2,8 +2,8 @@ package resources import ( "context" - "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" diff --git a/internal/provider/resources/sensor_group_assignment.go b/internal/provider/resources/sensor_group_assignment.go index 3db69c71..c8677363 100644 --- a/internal/provider/resources/sensor_group_assignment.go +++ b/internal/provider/resources/sensor_group_assignment.go @@ -3,8 +3,8 @@ package resources import ( "context" - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" diff --git a/internal/provider/resources/service.go b/internal/provider/resources/service.go index 7da01377..f33474ab 100644 --- a/internal/provider/resources/service.go +++ b/internal/provider/resources/service.go @@ -2,9 +2,9 @@ package resources import ( "context" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" - "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" diff --git a/internal/provider/resources/service_group_assignment.go b/internal/provider/resources/service_group_assignment.go index cde0af43..62443f83 100644 --- a/internal/provider/resources/service_group_assignment.go +++ b/internal/provider/resources/service_group_assignment.go @@ -2,8 +2,8 @@ package resources import ( "context" - "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -149,8 +149,24 @@ func (r *serviceTestGroupAssignmentResource) Read( return } - // TODO: Call client getServiceTestGroupAssignment method - serviceTestGroupAssignment := GetServiceTestGroupAssignment(state.ID.ValueString()) + request := r.client.ConfigurationAPI. + ServiceTestGroupAssignmentsGet(ctx). + Id(state.ID.ValueString()) + serviceTestGroupAssignmentResponse, response, err := util.RetryFor429(request.Execute) + errorPresent, errorDetail := util.RaiseForStatus(response, err) + + errorSummary := util.GenerateErrorSummary("read", "uxi_service_test_group_assignment") + + if errorPresent { + resp.Diagnostics.AddError(errorSummary, errorDetail) + return + } + + if len(serviceTestGroupAssignmentResponse.Items) != 1 { + resp.State.RemoveResource(ctx) + return + } + serviceTestGroupAssignment := serviceTestGroupAssignmentResponse.Items[0] // Update state from client response state.ID = types.StringValue(serviceTestGroupAssignment.Id) @@ -218,13 +234,3 @@ func (r *serviceTestGroupAssignmentResource) ImportState( ) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } - -var GetServiceTestGroupAssignment = func(uid string) config_api_client.ServiceTestGroupAssignmentsPostResponse { - // TODO: Query the serviceTestGroupAssignment using the client - return config_api_client.ServiceTestGroupAssignmentsPostResponse{ - Id: uid, - Group: *config_api_client.NewGroup("mock_group_uid"), - ServiceTest: *config_api_client.NewServiceTest("mock_serviceTest_uid"), - Type: "networking-uxi/service-test-group-assignment", - } -} diff --git a/internal/provider/resources/wired_network.go b/internal/provider/resources/wired_network.go index ab43df3b..60bf4b4b 100644 --- a/internal/provider/resources/wired_network.go +++ b/internal/provider/resources/wired_network.go @@ -3,8 +3,8 @@ package resources import ( "context" - "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" diff --git a/internal/provider/resources/wireless_network.go b/internal/provider/resources/wireless_network.go index 572c0b49..1c4d9f99 100644 --- a/internal/provider/resources/wireless_network.go +++ b/internal/provider/resources/wireless_network.go @@ -3,8 +3,8 @@ package resources import ( "context" - "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" diff --git a/internal/provider/util/error_handling.go b/internal/provider/util/error_handling.go index 543e8af0..85d84986 100644 --- a/internal/provider/util/error_handling.go +++ b/internal/provider/util/error_handling.go @@ -6,7 +6,7 @@ import ( "net/http" "net/url" - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func GenerateErrorSummary(actionName string, entityName string) string { diff --git a/internal/provider/util/group.go b/internal/provider/util/group.go index ecb38e58..2d0a43f3 100644 --- a/internal/provider/util/group.go +++ b/internal/provider/util/group.go @@ -1,7 +1,7 @@ package util import ( - "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func IsRoot(group config_api_client.GroupsGetItem) bool { diff --git a/internal/provider/util/retry.go b/internal/provider/util/retry.go index 215a105f..75e7628e 100644 --- a/internal/provider/util/retry.go +++ b/internal/provider/util/retry.go @@ -6,7 +6,7 @@ import ( "strconv" "time" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/config" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/config" ) func RetryFor429[T any](f func() (T, *http.Response, error)) (T, *http.Response, error) { diff --git a/main.go b/main.go index 31678c28..88369bf1 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( "flag" "log" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider" "github.com/hashicorp/terraform-plugin-framework/providerserver" ) @@ -28,7 +28,7 @@ func main() { flag.Parse() opts := providerserver.ServeOpts{ - Address: "registry.terraform.io/arubauxi/configuration", + Address: "registry.terraform.io/arubauxi/hpeuxi", Debug: debug, } diff --git a/pkg/config-api-client/.openapi-generator/FILES b/pkg/config-api-client/.openapi-generator/FILES index 66c3309e..53edefd3 100644 --- a/pkg/config-api-client/.openapi-generator/FILES +++ b/pkg/config-api-client/.openapi-generator/FILES @@ -4,7 +4,9 @@ api_configuration.go client.go configuration.go docs/Agent.md +docs/AgentGroupAssignmentResponse.md docs/AgentGroupAssignmentsItem.md +docs/AgentGroupAssignmentsPostRequest.md docs/AgentGroupAssignmentsResponse.md docs/AgentItem.md docs/AgentsResponse.md @@ -36,8 +38,10 @@ docs/SensorsPatchRequest.md docs/SensorsPatchResponse.md docs/SensorsResponse.md docs/ServiceTest.md +docs/ServiceTestGroupAssignmentsItem.md docs/ServiceTestGroupAssignmentsPostRequest.md docs/ServiceTestGroupAssignmentsPostResponse.md +docs/ServiceTestGroupAssignmentsResponse.md docs/ServiceTestsListItem.md docs/ServiceTestsListResponse.md docs/WiredNetworksItem.md @@ -47,7 +51,9 @@ docs/WirelessNetworksResponse.md go.mod go.sum model_agent.go +model_agent_group_assignment_response.go model_agent_group_assignments_item.go +model_agent_group_assignments_post_request.go model_agent_group_assignments_response.go model_agent_item.go model_agents_response.go @@ -78,8 +84,10 @@ model_sensors_patch_request.go model_sensors_patch_response.go model_sensors_response.go model_service_test_.go +model_service_test_group_assignments_item.go model_service_test_group_assignments_post_request.go model_service_test_group_assignments_post_response.go +model_service_test_group_assignments_response.go model_service_tests_list_item.go model_service_tests_list_response.go model_wired_networks_item.go diff --git a/pkg/config-api-client/README.md b/pkg/config-api-client/README.md index f4bfa79a..b7ca6b67 100644 --- a/pkg/config-api-client/README.md +++ b/pkg/config-api-client/README.md @@ -5,7 +5,7 @@ Nice description goes here ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 5.4.0 +- API version: 5.6.0 - Package version: 1.0.0 - Generator version: 7.9.0-SNAPSHOT - Build package: org.openapitools.codegen.languages.GoClientCodegen @@ -23,7 +23,7 @@ go get golang.org/x/net/context Put the package under your project folder and add the following in import: ```go -import config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" +import config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ``` To use a proxy, set the environment variable `HTTP_PROXY`: @@ -80,6 +80,7 @@ All URIs are relative to *https://api.capenetworks.com* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *ConfigurationAPI* | [**AgentGroupAssignmentsGet**](docs/ConfigurationAPI.md#agentgroupassignmentsget) | **Get** /networking-uxi/v1alpha1/agent-group-assignments | Agent Group Assignments Get +*ConfigurationAPI* | [**AgentGroupAssignmentsPost**](docs/ConfigurationAPI.md#agentgroupassignmentspost) | **Post** /networking-uxi/v1alpha1/agent-group-assignments | Agent Group Assignments Post *ConfigurationAPI* | [**AgentsDelete**](docs/ConfigurationAPI.md#agentsdelete) | **Delete** /networking-uxi/v1alpha1/agents/{agent_uid} | Agents Delete *ConfigurationAPI* | [**AgentsGet**](docs/ConfigurationAPI.md#agentsget) | **Get** /networking-uxi/v1alpha1/agents | Agents Get *ConfigurationAPI* | [**GroupsDelete**](docs/ConfigurationAPI.md#groupsdelete) | **Delete** /networking-uxi/v1alpha1/groups/{group_uid} | Groups Delete @@ -95,6 +96,7 @@ Class | Method | HTTP request | Description *ConfigurationAPI* | [**SensorsGet**](docs/ConfigurationAPI.md#sensorsget) | **Get** /networking-uxi/v1alpha1/sensors | Sensors Get *ConfigurationAPI* | [**SensorsPatch**](docs/ConfigurationAPI.md#sensorspatch) | **Patch** /networking-uxi/v1alpha1/sensors/{sensor_uid} | Sensors Patch *ConfigurationAPI* | [**ServiceTestGroupAssignmentsDelete**](docs/ConfigurationAPI.md#servicetestgroupassignmentsdelete) | **Delete** /networking-uxi/v1alpha1/service-test-group-assignments/{id} | Service Test Group Assignments Delete +*ConfigurationAPI* | [**ServiceTestGroupAssignmentsGet**](docs/ConfigurationAPI.md#servicetestgroupassignmentsget) | **Get** /networking-uxi/v1alpha1/service-test-group-assignments | Service Test Group Assignments Get *ConfigurationAPI* | [**ServiceTestGroupAssignmentsPost**](docs/ConfigurationAPI.md#servicetestgroupassignmentspost) | **Post** /networking-uxi/v1alpha1/service-test-group-assignments | Service Test Group Assignments Post *ConfigurationAPI* | [**ServiceTestsGet**](docs/ConfigurationAPI.md#servicetestsget) | **Get** /networking-uxi/v1alpha1/service-tests | Service Tests Get *ConfigurationAPI* | [**WiredNetworksGet**](docs/ConfigurationAPI.md#wirednetworksget) | **Get** /networking-uxi/v1alpha1/wired-networks | Wired Networks Get @@ -104,7 +106,9 @@ Class | Method | HTTP request | Description ## Documentation For Models - [Agent](docs/Agent.md) + - [AgentGroupAssignmentResponse](docs/AgentGroupAssignmentResponse.md) - [AgentGroupAssignmentsItem](docs/AgentGroupAssignmentsItem.md) + - [AgentGroupAssignmentsPostRequest](docs/AgentGroupAssignmentsPostRequest.md) - [AgentGroupAssignmentsResponse](docs/AgentGroupAssignmentsResponse.md) - [AgentItem](docs/AgentItem.md) - [AgentsResponse](docs/AgentsResponse.md) @@ -135,8 +139,10 @@ Class | Method | HTTP request | Description - [SensorsPatchResponse](docs/SensorsPatchResponse.md) - [SensorsResponse](docs/SensorsResponse.md) - [ServiceTest](docs/ServiceTest.md) + - [ServiceTestGroupAssignmentsItem](docs/ServiceTestGroupAssignmentsItem.md) - [ServiceTestGroupAssignmentsPostRequest](docs/ServiceTestGroupAssignmentsPostRequest.md) - [ServiceTestGroupAssignmentsPostResponse](docs/ServiceTestGroupAssignmentsPostResponse.md) + - [ServiceTestGroupAssignmentsResponse](docs/ServiceTestGroupAssignmentsResponse.md) - [ServiceTestsListItem](docs/ServiceTestsListItem.md) - [ServiceTestsListResponse](docs/ServiceTestsListResponse.md) - [WiredNetworksItem](docs/WiredNetworksItem.md) @@ -180,4 +186,3 @@ Each of these functions takes a value of the given basic type and returns a poin ## Author support@capenetworks.com - diff --git a/pkg/config-api-client/api/.openapi.source.yaml b/pkg/config-api-client/api/.openapi.source.yaml index 78d8a639..0bd9391b 100644 --- a/pkg/config-api-client/api/.openapi.source.yaml +++ b/pkg/config-api-client/api/.openapi.source.yaml @@ -9,12 +9,49 @@ info: email: support@capenetworks.com license: name: No idea, but we need something - version: 5.4.0 + version: 5.6.0 servers: - url: https://api.capenetworks.com - url: https://api.staging.capedev.io paths: /networking-uxi/v1alpha1/agent-group-assignments: + post: + operationId: agent_group_assignments_post + summary: Agent Group Assignments Post + description: Create agent group assignment + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AgentGroupAssignmentsPostRequest' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/AgentGroupAssignmentResponse' + 4XX: + description: Client Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + 5XX: + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + security: + - HTTPBearer: [] + tags: + - api + - configuration + - v1alpha1 + - agent-group-assignments + x-stability-level: alpha get: operationId: agent_group_assignments_get summary: Agent Group Assignments Get @@ -798,6 +835,63 @@ paths: - v1alpha1 - service-test-group-assignments x-stability-level: alpha + get: + operationId: service_test_group_assignments_get + summary: Service Test Group Assignments Get + description: Get a list of service test group assignments + parameters: + - name: id + in: query + required: false + schema: + anyOf: + - type: string + nullable: true + title: Id + - name: next + in: query + required: false + schema: + anyOf: + - type: string + nullable: true + title: Next + - name: limit + in: query + required: false + schema: + type: integer + default: 50 + maximum: 100 + minimum: 0 + title: Limit + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceTestGroupAssignmentsResponse' + 4XX: + description: Client Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + 5XX: + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + security: + - HTTPBearer: [] + tags: + - api + - configuration + - v1alpha1 + - service-test-group-assignments + x-stability-level: alpha /networking-uxi/v1alpha1/service-tests: get: operationId: service_tests_get @@ -979,6 +1073,27 @@ components: required: - id title: Agent + AgentGroupAssignmentResponse: + type: object + properties: + id: + type: string + title: Id + group: + $ref: '#/components/schemas/Group' + agent: + $ref: '#/components/schemas/Agent' + type: + type: string + enum: + - networking-uxi/agent-group-assignment + title: Type + required: + - id + - group + - agent + - type + title: AgentGroupAssignmentResponse AgentGroupAssignmentsItem: type: object properties: @@ -1000,6 +1115,19 @@ components: - agent - type title: AgentGroupAssignmentsItem + AgentGroupAssignmentsPostRequest: + type: object + properties: + groupId: + type: string + title: Groupid + agentId: + type: string + title: Agentid + required: + - groupId + - agentId + title: AgentGroupAssignmentsPostRequest AgentGroupAssignmentsResponse: type: object properties: @@ -1655,6 +1783,27 @@ components: required: - id title: ServiceTest + ServiceTestGroupAssignmentsItem: + type: object + properties: + id: + type: string + title: Id + group: + $ref: '#/components/schemas/Group' + serviceTest: + $ref: '#/components/schemas/ServiceTest' + type: + type: string + enum: + - networking-uxi/service-test-group-assignment + title: Type + required: + - id + - group + - serviceTest + - type + title: ServiceTestGroupAssignmentsItem ServiceTestGroupAssignmentsPostRequest: type: object properties: @@ -1690,6 +1839,27 @@ components: - serviceTest - type title: ServiceTestGroupAssignmentsPostResponse + ServiceTestGroupAssignmentsResponse: + type: object + properties: + items: + type: array + items: + $ref: '#/components/schemas/ServiceTestGroupAssignmentsItem' + title: Items + count: + type: integer + title: Count + next: + anyOf: + - type: string + nullable: true + title: Next + required: + - items + - count + - next + title: ServiceTestGroupAssignmentsResponse ServiceTestsListItem: type: object properties: diff --git a/pkg/config-api-client/api/openapi.yaml b/pkg/config-api-client/api/openapi.yaml index 5c334fde..5d30059a 100644 --- a/pkg/config-api-client/api/openapi.yaml +++ b/pkg/config-api-client/api/openapi.yaml @@ -9,7 +9,7 @@ info: name: "No idea, but we need something" termsOfService: http://we.dont.care.yet.com/term-of-service title: Configuration Api - version: 5.4.0 + version: 5.6.0 servers: - url: https://api.capenetworks.com - url: https://api.staging.capedev.io @@ -87,6 +87,40 @@ paths: tags: - configuration x-stability-level: alpha + post: + description: Create agent group assignment + operationId: agent_group_assignments_post + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AgentGroupAssignmentsPostRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AgentGroupAssignmentResponse' + description: Successful Response + "4XX": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Client Error + "5XX": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Server Error + security: + - HTTPBearer: [] + summary: Agent Group Assignments Post + tags: + - configuration + x-stability-level: alpha /networking-uxi/v1alpha1/agents/{agent_uid}: delete: description: Delete an existing agent. @@ -749,6 +783,62 @@ paths: - configuration x-stability-level: alpha /networking-uxi/v1alpha1/service-test-group-assignments: + get: + description: Get a list of service test group assignments + operationId: service_test_group_assignments_get + parameters: + - explode: true + in: query + name: id + required: false + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: next + required: false + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: limit + required: false + schema: + default: 50 + maximum: 100 + minimum: 0 + title: Limit + type: integer + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceTestGroupAssignmentsResponse' + description: Successful Response + "4XX": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Client Error + "5XX": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Server Error + security: + - HTTPBearer: [] + summary: Service Test Group Assignments Get + tags: + - configuration + x-stability-level: alpha post: description: Create a service-test group assignment operationId: service_test_group_assignments_post @@ -963,6 +1053,34 @@ components: - id title: Agent type: object + AgentGroupAssignmentResponse: + example: + agent: + id: id + id: id + type: networking-uxi/agent-group-assignment + group: + id: id + properties: + id: + title: Id + type: string + group: + $ref: '#/components/schemas/Group' + agent: + $ref: '#/components/schemas/Agent' + type: + enum: + - networking-uxi/agent-group-assignment + title: Type + type: string + required: + - agent + - group + - id + - type + title: AgentGroupAssignmentResponse + type: object AgentGroupAssignmentsItem: example: agent: @@ -991,6 +1109,22 @@ components: - type title: AgentGroupAssignmentsItem type: object + AgentGroupAssignmentsPostRequest: + example: + agentId: agentId + groupId: groupId + properties: + groupId: + title: Groupid + type: string + agentId: + title: Agentid + type: string + required: + - agentId + - groupId + title: AgentGroupAssignmentsPostRequest + type: object AgentGroupAssignmentsResponse: example: next: next @@ -1844,6 +1978,34 @@ components: - id title: ServiceTest type: object + ServiceTestGroupAssignmentsItem: + example: + serviceTest: + id: id + id: id + type: networking-uxi/service-test-group-assignment + group: + id: id + properties: + id: + title: Id + type: string + group: + $ref: '#/components/schemas/Group' + serviceTest: + $ref: '#/components/schemas/ServiceTest' + type: + enum: + - networking-uxi/service-test-group-assignment + title: Type + type: string + required: + - group + - id + - serviceTest + - type + title: ServiceTestGroupAssignmentsItem + type: object ServiceTestGroupAssignmentsPostRequest: example: groupId: groupId @@ -1889,6 +2051,41 @@ components: - type title: ServiceTestGroupAssignmentsPostResponse type: object + ServiceTestGroupAssignmentsResponse: + example: + next: next + count: 0 + items: + - serviceTest: + id: id + id: id + type: networking-uxi/service-test-group-assignment + group: + id: id + - serviceTest: + id: id + id: id + type: networking-uxi/service-test-group-assignment + group: + id: id + properties: + items: + items: + $ref: '#/components/schemas/ServiceTestGroupAssignmentsItem' + title: Items + type: array + count: + title: Count + type: integer + next: + nullable: true + type: string + required: + - count + - items + - next + title: ServiceTestGroupAssignmentsResponse + type: object ServiceTestsListItem: example: template: template diff --git a/pkg/config-api-client/api_configuration.go b/pkg/config-api-client/api_configuration.go index 489f395b..1d50dfa1 100644 --- a/pkg/config-api-client/api_configuration.go +++ b/pkg/config-api-client/api_configuration.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ @@ -194,6 +194,162 @@ func (a *ConfigurationAPIService) AgentGroupAssignmentsGetExecute( return localVarReturnValue, localVarHTTPResponse, nil } +type ApiAgentGroupAssignmentsPostRequest struct { + ctx context.Context + ApiService *ConfigurationAPIService + agentGroupAssignmentsPostRequest *AgentGroupAssignmentsPostRequest +} + +func (r ApiAgentGroupAssignmentsPostRequest) AgentGroupAssignmentsPostRequest( + agentGroupAssignmentsPostRequest AgentGroupAssignmentsPostRequest, +) ApiAgentGroupAssignmentsPostRequest { + r.agentGroupAssignmentsPostRequest = &agentGroupAssignmentsPostRequest + return r +} + +func (r ApiAgentGroupAssignmentsPostRequest) Execute() (*AgentGroupAssignmentResponse, *http.Response, error) { + return r.ApiService.AgentGroupAssignmentsPostExecute(r) +} + +/* +AgentGroupAssignmentsPost Agent Group Assignments Post + +# Create agent group assignment + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiAgentGroupAssignmentsPostRequest +*/ +func (a *ConfigurationAPIService) AgentGroupAssignmentsPost( + ctx context.Context, +) ApiAgentGroupAssignmentsPostRequest { + return ApiAgentGroupAssignmentsPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return AgentGroupAssignmentResponse +func (a *ConfigurationAPIService) AgentGroupAssignmentsPostExecute( + r ApiAgentGroupAssignmentsPostRequest, +) (*AgentGroupAssignmentResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AgentGroupAssignmentResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.AgentGroupAssignmentsPost", + ) + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/networking-uxi/v1alpha1/agent-group-assignments" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.agentGroupAssignmentsPostRequest == nil { + return localVarReturnValue, nil, reportError( + "agentGroupAssignmentsPostRequest is required and must be specified", + ) + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.agentGroupAssignmentsPostRequest + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type ApiAgentsDeleteRequest struct { ctx context.Context ApiService *ConfigurationAPIService @@ -2597,6 +2753,183 @@ func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsDeleteExecute( return localVarReturnValue, localVarHTTPResponse, nil } +type ApiServiceTestGroupAssignmentsGetRequest struct { + ctx context.Context + ApiService *ConfigurationAPIService + id *string + next *string + limit *int32 +} + +func (r ApiServiceTestGroupAssignmentsGetRequest) Id( + id string, +) ApiServiceTestGroupAssignmentsGetRequest { + r.id = &id + return r +} + +func (r ApiServiceTestGroupAssignmentsGetRequest) Next( + next string, +) ApiServiceTestGroupAssignmentsGetRequest { + r.next = &next + return r +} + +func (r ApiServiceTestGroupAssignmentsGetRequest) Limit( + limit int32, +) ApiServiceTestGroupAssignmentsGetRequest { + r.limit = &limit + return r +} + +func (r ApiServiceTestGroupAssignmentsGetRequest) Execute() (*ServiceTestGroupAssignmentsResponse, *http.Response, error) { + return r.ApiService.ServiceTestGroupAssignmentsGetExecute(r) +} + +/* +ServiceTestGroupAssignmentsGet Service Test Group Assignments Get + +# Get a list of service test group assignments + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiServiceTestGroupAssignmentsGetRequest +*/ +func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsGet( + ctx context.Context, +) ApiServiceTestGroupAssignmentsGetRequest { + return ApiServiceTestGroupAssignmentsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return ServiceTestGroupAssignmentsResponse +func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsGetExecute( + r ApiServiceTestGroupAssignmentsGetRequest, +) (*ServiceTestGroupAssignmentsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServiceTestGroupAssignmentsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.ServiceTestGroupAssignmentsGet", + ) + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/networking-uxi/v1alpha1/service-test-group-assignments" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.id != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "id", r.id, "form", "") + } + if r.next != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "next", r.next, "form", "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } else { + var defaultValue int32 = 50 + r.limit = &defaultValue + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type ApiServiceTestGroupAssignmentsPostRequest struct { ctx context.Context ApiService *ConfigurationAPIService diff --git a/pkg/config-api-client/client.go b/pkg/config-api-client/client.go index 2cbcadd4..debdc55f 100644 --- a/pkg/config-api-client/client.go +++ b/pkg/config-api-client/client.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ @@ -41,7 +41,7 @@ var ( queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") ) -// APIClient manages communication with the Configuration Api API v5.4.0 +// APIClient manages communication with the Configuration Api API v5.6.0 // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration diff --git a/pkg/config-api-client/configuration.go b/pkg/config-api-client/configuration.go index 7540c6aa..1738e669 100644 --- a/pkg/config-api-client/configuration.go +++ b/pkg/config-api-client/configuration.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/docs/AgentGroupAssignmentResponse.md b/pkg/config-api-client/docs/AgentGroupAssignmentResponse.md new file mode 100644 index 00000000..50b9794d --- /dev/null +++ b/pkg/config-api-client/docs/AgentGroupAssignmentResponse.md @@ -0,0 +1,114 @@ +# AgentGroupAssignmentResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | | +**Group** | [**Group**](Group.md) | | +**Agent** | [**Agent**](Agent.md) | | +**Type** | **string** | | + +## Methods + +### NewAgentGroupAssignmentResponse + +`func NewAgentGroupAssignmentResponse(id string, group Group, agent Agent, type_ string, ) *AgentGroupAssignmentResponse` + +NewAgentGroupAssignmentResponse instantiates a new AgentGroupAssignmentResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAgentGroupAssignmentResponseWithDefaults + +`func NewAgentGroupAssignmentResponseWithDefaults() *AgentGroupAssignmentResponse` + +NewAgentGroupAssignmentResponseWithDefaults instantiates a new AgentGroupAssignmentResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *AgentGroupAssignmentResponse) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *AgentGroupAssignmentResponse) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *AgentGroupAssignmentResponse) SetId(v string)` + +SetId sets Id field to given value. + + +### GetGroup + +`func (o *AgentGroupAssignmentResponse) GetGroup() Group` + +GetGroup returns the Group field if non-nil, zero value otherwise. + +### GetGroupOk + +`func (o *AgentGroupAssignmentResponse) GetGroupOk() (*Group, bool)` + +GetGroupOk returns a tuple with the Group field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGroup + +`func (o *AgentGroupAssignmentResponse) SetGroup(v Group)` + +SetGroup sets Group field to given value. + + +### GetAgent + +`func (o *AgentGroupAssignmentResponse) GetAgent() Agent` + +GetAgent returns the Agent field if non-nil, zero value otherwise. + +### GetAgentOk + +`func (o *AgentGroupAssignmentResponse) GetAgentOk() (*Agent, bool)` + +GetAgentOk returns a tuple with the Agent field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAgent + +`func (o *AgentGroupAssignmentResponse) SetAgent(v Agent)` + +SetAgent sets Agent field to given value. + + +### GetType + +`func (o *AgentGroupAssignmentResponse) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *AgentGroupAssignmentResponse) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *AgentGroupAssignmentResponse) SetType(v string)` + +SetType sets Type field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/config-api-client/docs/AgentGroupAssignmentsPostRequest.md b/pkg/config-api-client/docs/AgentGroupAssignmentsPostRequest.md new file mode 100644 index 00000000..ac4fe0c0 --- /dev/null +++ b/pkg/config-api-client/docs/AgentGroupAssignmentsPostRequest.md @@ -0,0 +1,72 @@ +# AgentGroupAssignmentsPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**GroupId** | **string** | | +**AgentId** | **string** | | + +## Methods + +### NewAgentGroupAssignmentsPostRequest + +`func NewAgentGroupAssignmentsPostRequest(groupId string, agentId string, ) *AgentGroupAssignmentsPostRequest` + +NewAgentGroupAssignmentsPostRequest instantiates a new AgentGroupAssignmentsPostRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAgentGroupAssignmentsPostRequestWithDefaults + +`func NewAgentGroupAssignmentsPostRequestWithDefaults() *AgentGroupAssignmentsPostRequest` + +NewAgentGroupAssignmentsPostRequestWithDefaults instantiates a new AgentGroupAssignmentsPostRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetGroupId + +`func (o *AgentGroupAssignmentsPostRequest) GetGroupId() string` + +GetGroupId returns the GroupId field if non-nil, zero value otherwise. + +### GetGroupIdOk + +`func (o *AgentGroupAssignmentsPostRequest) GetGroupIdOk() (*string, bool)` + +GetGroupIdOk returns a tuple with the GroupId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGroupId + +`func (o *AgentGroupAssignmentsPostRequest) SetGroupId(v string)` + +SetGroupId sets GroupId field to given value. + + +### GetAgentId + +`func (o *AgentGroupAssignmentsPostRequest) GetAgentId() string` + +GetAgentId returns the AgentId field if non-nil, zero value otherwise. + +### GetAgentIdOk + +`func (o *AgentGroupAssignmentsPostRequest) GetAgentIdOk() (*string, bool)` + +GetAgentIdOk returns a tuple with the AgentId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAgentId + +`func (o *AgentGroupAssignmentsPostRequest) SetAgentId(v string)` + +SetAgentId sets AgentId field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/config-api-client/docs/ConfigurationAPI.md b/pkg/config-api-client/docs/ConfigurationAPI.md index 12186df3..522c2d39 100644 --- a/pkg/config-api-client/docs/ConfigurationAPI.md +++ b/pkg/config-api-client/docs/ConfigurationAPI.md @@ -5,6 +5,7 @@ All URIs are relative to *https://api.capenetworks.com* Method | HTTP request | Description ------------- | ------------- | ------------- [**AgentGroupAssignmentsGet**](ConfigurationAPI.md#AgentGroupAssignmentsGet) | **Get** /networking-uxi/v1alpha1/agent-group-assignments | Agent Group Assignments Get +[**AgentGroupAssignmentsPost**](ConfigurationAPI.md#AgentGroupAssignmentsPost) | **Post** /networking-uxi/v1alpha1/agent-group-assignments | Agent Group Assignments Post [**AgentsDelete**](ConfigurationAPI.md#AgentsDelete) | **Delete** /networking-uxi/v1alpha1/agents/{agent_uid} | Agents Delete [**AgentsGet**](ConfigurationAPI.md#AgentsGet) | **Get** /networking-uxi/v1alpha1/agents | Agents Get [**GroupsDelete**](ConfigurationAPI.md#GroupsDelete) | **Delete** /networking-uxi/v1alpha1/groups/{group_uid} | Groups Delete @@ -20,6 +21,7 @@ Method | HTTP request | Description [**SensorsGet**](ConfigurationAPI.md#SensorsGet) | **Get** /networking-uxi/v1alpha1/sensors | Sensors Get [**SensorsPatch**](ConfigurationAPI.md#SensorsPatch) | **Patch** /networking-uxi/v1alpha1/sensors/{sensor_uid} | Sensors Patch [**ServiceTestGroupAssignmentsDelete**](ConfigurationAPI.md#ServiceTestGroupAssignmentsDelete) | **Delete** /networking-uxi/v1alpha1/service-test-group-assignments/{id} | Service Test Group Assignments Delete +[**ServiceTestGroupAssignmentsGet**](ConfigurationAPI.md#ServiceTestGroupAssignmentsGet) | **Get** /networking-uxi/v1alpha1/service-test-group-assignments | Service Test Group Assignments Get [**ServiceTestGroupAssignmentsPost**](ConfigurationAPI.md#ServiceTestGroupAssignmentsPost) | **Post** /networking-uxi/v1alpha1/service-test-group-assignments | Service Test Group Assignments Post [**ServiceTestsGet**](ConfigurationAPI.md#ServiceTestsGet) | **Get** /networking-uxi/v1alpha1/service-tests | Service Tests Get [**WiredNetworksGet**](ConfigurationAPI.md#WiredNetworksGet) | **Get** /networking-uxi/v1alpha1/wired-networks | Wired Networks Get @@ -44,7 +46,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { @@ -75,8 +77,8 @@ Other parameters are passed through a pointer to a apiAgentGroupAssignmentsGetRe Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **string** | | - **next** | **string** | | + **id** | **string** | | + **next** | **string** | | **limit** | **int32** | | [default to 50] ### Return type @@ -97,6 +99,72 @@ Name | Type | Description | Notes [[Back to README]](../README.md) +## AgentGroupAssignmentsPost + +> AgentGroupAssignmentResponse AgentGroupAssignmentsPost(ctx).AgentGroupAssignmentsPostRequest(agentGroupAssignmentsPostRequest).Execute() + +Agent Group Assignments Post + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" +) + +func main() { + agentGroupAssignmentsPostRequest := *openapiclient.NewAgentGroupAssignmentsPostRequest("GroupId_example", "AgentId_example") // AgentGroupAssignmentsPostRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ConfigurationAPI.AgentGroupAssignmentsPost(context.Background()).AgentGroupAssignmentsPostRequest(agentGroupAssignmentsPostRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ConfigurationAPI.AgentGroupAssignmentsPost``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AgentGroupAssignmentsPost`: AgentGroupAssignmentResponse + fmt.Fprintf(os.Stdout, "Response from `ConfigurationAPI.AgentGroupAssignmentsPost`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiAgentGroupAssignmentsPostRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **agentGroupAssignmentsPostRequest** | [**AgentGroupAssignmentsPostRequest**](AgentGroupAssignmentsPostRequest.md) | | + +### Return type + +[**AgentGroupAssignmentResponse**](AgentGroupAssignmentResponse.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## AgentsDelete > interface{} AgentsDelete(ctx, agentUid).Execute() @@ -114,11 +182,11 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { - agentUid := "agentUid_example" // string | + agentUid := "agentUid_example" // string | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -138,7 +206,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**agentUid** | **string** | | +**agentUid** | **string** | | ### Other Parameters @@ -184,7 +252,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { @@ -215,8 +283,8 @@ Other parameters are passed through a pointer to a apiAgentsGetRequest struct vi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **string** | | - **next** | **string** | | + **id** | **string** | | + **next** | **string** | | **limit** | **int32** | | [default to 50] ### Return type @@ -254,11 +322,11 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { - groupUid := "groupUid_example" // string | + groupUid := "groupUid_example" // string | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -278,7 +346,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**groupUid** | **string** | | +**groupUid** | **string** | | ### Other Parameters @@ -324,7 +392,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { @@ -355,8 +423,8 @@ Other parameters are passed through a pointer to a apiGroupsGetRequest struct vi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **string** | | - **next** | **string** | | + **id** | **string** | | + **next** | **string** | | **limit** | **int32** | | [default to 50] ### Return type @@ -394,11 +462,11 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { - groupUid := "groupUid_example" // string | + groupUid := "groupUid_example" // string | groupsPatchRequest := *openapiclient.NewGroupsPatchRequest("Name_example") // GroupsPatchRequest | (optional) configuration := openapiclient.NewConfiguration() @@ -419,7 +487,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**groupUid** | **string** | | +**groupUid** | **string** | | ### Other Parameters @@ -429,7 +497,7 @@ Other parameters are passed through a pointer to a apiGroupsPatchRequest struct Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **groupsPatchRequest** | [**GroupsPatchRequest**](GroupsPatchRequest.md) | | + **groupsPatchRequest** | [**GroupsPatchRequest**](GroupsPatchRequest.md) | | ### Return type @@ -466,11 +534,11 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { - groupsPostRequest := *openapiclient.NewGroupsPostRequest("Name_example") // GroupsPostRequest | + groupsPostRequest := *openapiclient.NewGroupsPostRequest("Name_example") // GroupsPostRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -495,7 +563,7 @@ Other parameters are passed through a pointer to a apiGroupsPostRequest struct v Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **groupsPostRequest** | [**GroupsPostRequest**](GroupsPostRequest.md) | | + **groupsPostRequest** | [**GroupsPostRequest**](GroupsPostRequest.md) | | ### Return type @@ -532,11 +600,11 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { - id := "id_example" // string | + id := "id_example" // string | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -556,7 +624,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**id** | **string** | | +**id** | **string** | | ### Other Parameters @@ -602,7 +670,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { @@ -633,8 +701,8 @@ Other parameters are passed through a pointer to a apiNetworkGroupAssignmentsGet Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **string** | | - **next** | **string** | | + **id** | **string** | | + **next** | **string** | | **limit** | **int32** | | [default to 50] ### Return type @@ -672,11 +740,11 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { - networkGroupAssignmentsPostRequest := *openapiclient.NewNetworkGroupAssignmentsPostRequest("GroupId_example", "NetworkId_example") // NetworkGroupAssignmentsPostRequest | + networkGroupAssignmentsPostRequest := *openapiclient.NewNetworkGroupAssignmentsPostRequest("GroupId_example", "NetworkId_example") // NetworkGroupAssignmentsPostRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -701,7 +769,7 @@ Other parameters are passed through a pointer to a apiNetworkGroupAssignmentsPos Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **networkGroupAssignmentsPostRequest** | [**NetworkGroupAssignmentsPostRequest**](NetworkGroupAssignmentsPostRequest.md) | | + **networkGroupAssignmentsPostRequest** | [**NetworkGroupAssignmentsPostRequest**](NetworkGroupAssignmentsPostRequest.md) | | ### Return type @@ -738,11 +806,11 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { - id := "id_example" // string | + id := "id_example" // string | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -762,7 +830,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**id** | **string** | | +**id** | **string** | | ### Other Parameters @@ -808,7 +876,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { @@ -839,8 +907,8 @@ Other parameters are passed through a pointer to a apiSensorGroupAssignmentsGetR Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **string** | | - **next** | **string** | | + **id** | **string** | | + **next** | **string** | | **limit** | **int32** | | [default to 50] ### Return type @@ -878,11 +946,11 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { - sensorGroupAssignmentsPostRequest := *openapiclient.NewSensorGroupAssignmentsPostRequest("GroupId_example", "SensorId_example") // SensorGroupAssignmentsPostRequest | + sensorGroupAssignmentsPostRequest := *openapiclient.NewSensorGroupAssignmentsPostRequest("GroupId_example", "SensorId_example") // SensorGroupAssignmentsPostRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -907,7 +975,7 @@ Other parameters are passed through a pointer to a apiSensorGroupAssignmentsPost Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **sensorGroupAssignmentsPostRequest** | [**SensorGroupAssignmentsPostRequest**](SensorGroupAssignmentsPostRequest.md) | | + **sensorGroupAssignmentsPostRequest** | [**SensorGroupAssignmentsPostRequest**](SensorGroupAssignmentsPostRequest.md) | | ### Return type @@ -944,7 +1012,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { @@ -975,8 +1043,8 @@ Other parameters are passed through a pointer to a apiSensorsGetRequest struct v Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **string** | | - **next** | **string** | | + **id** | **string** | | + **next** | **string** | | **limit** | **int32** | | [default to 50] ### Return type @@ -1014,12 +1082,12 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { - sensorUid := "sensorUid_example" // string | - sensorsPatchRequest := *openapiclient.NewSensorsPatchRequest() // SensorsPatchRequest | + sensorUid := "sensorUid_example" // string | + sensorsPatchRequest := *openapiclient.NewSensorsPatchRequest() // SensorsPatchRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1039,7 +1107,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**sensorUid** | **string** | | +**sensorUid** | **string** | | ### Other Parameters @@ -1049,7 +1117,7 @@ Other parameters are passed through a pointer to a apiSensorsPatchRequest struct Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **sensorsPatchRequest** | [**SensorsPatchRequest**](SensorsPatchRequest.md) | | + **sensorsPatchRequest** | [**SensorsPatchRequest**](SensorsPatchRequest.md) | | ### Return type @@ -1086,11 +1154,11 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { - id := "id_example" // string | + id := "id_example" // string | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1110,7 +1178,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**id** | **string** | | +**id** | **string** | | ### Other Parameters @@ -1139,6 +1207,76 @@ Name | Type | Description | Notes [[Back to README]](../README.md) +## ServiceTestGroupAssignmentsGet + +> ServiceTestGroupAssignmentsResponse ServiceTestGroupAssignmentsGet(ctx).Id(id).Next(next).Limit(limit).Execute() + +Service Test Group Assignments Get + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" +) + +func main() { + id := "id_example" // string | (optional) + next := "next_example" // string | (optional) + limit := int32(56) // int32 | (optional) (default to 50) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ConfigurationAPI.ServiceTestGroupAssignmentsGet(context.Background()).Id(id).Next(next).Limit(limit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ConfigurationAPI.ServiceTestGroupAssignmentsGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ServiceTestGroupAssignmentsGet`: ServiceTestGroupAssignmentsResponse + fmt.Fprintf(os.Stdout, "Response from `ConfigurationAPI.ServiceTestGroupAssignmentsGet`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiServiceTestGroupAssignmentsGetRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **string** | | + **next** | **string** | | + **limit** | **int32** | | [default to 50] + +### Return type + +[**ServiceTestGroupAssignmentsResponse**](ServiceTestGroupAssignmentsResponse.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## ServiceTestGroupAssignmentsPost > ServiceTestGroupAssignmentsPostResponse ServiceTestGroupAssignmentsPost(ctx).ServiceTestGroupAssignmentsPostRequest(serviceTestGroupAssignmentsPostRequest).Execute() @@ -1156,11 +1294,11 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { - serviceTestGroupAssignmentsPostRequest := *openapiclient.NewServiceTestGroupAssignmentsPostRequest("GroupId_example", "ServiceTestId_example") // ServiceTestGroupAssignmentsPostRequest | + serviceTestGroupAssignmentsPostRequest := *openapiclient.NewServiceTestGroupAssignmentsPostRequest("GroupId_example", "ServiceTestId_example") // ServiceTestGroupAssignmentsPostRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1185,7 +1323,7 @@ Other parameters are passed through a pointer to a apiServiceTestGroupAssignment Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **serviceTestGroupAssignmentsPostRequest** | [**ServiceTestGroupAssignmentsPostRequest**](ServiceTestGroupAssignmentsPostRequest.md) | | + **serviceTestGroupAssignmentsPostRequest** | [**ServiceTestGroupAssignmentsPostRequest**](ServiceTestGroupAssignmentsPostRequest.md) | | ### Return type @@ -1222,7 +1360,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { @@ -1253,8 +1391,8 @@ Other parameters are passed through a pointer to a apiServiceTestsGetRequest str Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **string** | | - **next** | **string** | | + **id** | **string** | | + **next** | **string** | | **limit** | **int32** | | [default to 50] ### Return type @@ -1292,7 +1430,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { @@ -1323,8 +1461,8 @@ Other parameters are passed through a pointer to a apiWiredNetworksGetRequest st Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **string** | | - **next** | **string** | | + **id** | **string** | | + **next** | **string** | | **limit** | **int32** | | [default to 50] ### Return type @@ -1362,7 +1500,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + openapiclient "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" ) func main() { @@ -1393,8 +1531,8 @@ Other parameters are passed through a pointer to a apiWirelessNetworksGetRequest Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **string** | | - **next** | **string** | | + **id** | **string** | | + **next** | **string** | | **limit** | **int32** | | [default to 50] ### Return type @@ -1413,4 +1551,3 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/pkg/config-api-client/docs/ServiceTestGroupAssignmentsItem.md b/pkg/config-api-client/docs/ServiceTestGroupAssignmentsItem.md new file mode 100644 index 00000000..9c0ca1a3 --- /dev/null +++ b/pkg/config-api-client/docs/ServiceTestGroupAssignmentsItem.md @@ -0,0 +1,114 @@ +# ServiceTestGroupAssignmentsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | | +**Group** | [**Group**](Group.md) | | +**ServiceTest** | [**ServiceTest**](ServiceTest.md) | | +**Type** | **string** | | + +## Methods + +### NewServiceTestGroupAssignmentsItem + +`func NewServiceTestGroupAssignmentsItem(id string, group Group, serviceTest ServiceTest, type_ string, ) *ServiceTestGroupAssignmentsItem` + +NewServiceTestGroupAssignmentsItem instantiates a new ServiceTestGroupAssignmentsItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewServiceTestGroupAssignmentsItemWithDefaults + +`func NewServiceTestGroupAssignmentsItemWithDefaults() *ServiceTestGroupAssignmentsItem` + +NewServiceTestGroupAssignmentsItemWithDefaults instantiates a new ServiceTestGroupAssignmentsItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *ServiceTestGroupAssignmentsItem) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *ServiceTestGroupAssignmentsItem) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *ServiceTestGroupAssignmentsItem) SetId(v string)` + +SetId sets Id field to given value. + + +### GetGroup + +`func (o *ServiceTestGroupAssignmentsItem) GetGroup() Group` + +GetGroup returns the Group field if non-nil, zero value otherwise. + +### GetGroupOk + +`func (o *ServiceTestGroupAssignmentsItem) GetGroupOk() (*Group, bool)` + +GetGroupOk returns a tuple with the Group field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGroup + +`func (o *ServiceTestGroupAssignmentsItem) SetGroup(v Group)` + +SetGroup sets Group field to given value. + + +### GetServiceTest + +`func (o *ServiceTestGroupAssignmentsItem) GetServiceTest() ServiceTest` + +GetServiceTest returns the ServiceTest field if non-nil, zero value otherwise. + +### GetServiceTestOk + +`func (o *ServiceTestGroupAssignmentsItem) GetServiceTestOk() (*ServiceTest, bool)` + +GetServiceTestOk returns a tuple with the ServiceTest field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetServiceTest + +`func (o *ServiceTestGroupAssignmentsItem) SetServiceTest(v ServiceTest)` + +SetServiceTest sets ServiceTest field to given value. + + +### GetType + +`func (o *ServiceTestGroupAssignmentsItem) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *ServiceTestGroupAssignmentsItem) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *ServiceTestGroupAssignmentsItem) SetType(v string)` + +SetType sets Type field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/config-api-client/docs/ServiceTestGroupAssignmentsResponse.md b/pkg/config-api-client/docs/ServiceTestGroupAssignmentsResponse.md new file mode 100644 index 00000000..f288e998 --- /dev/null +++ b/pkg/config-api-client/docs/ServiceTestGroupAssignmentsResponse.md @@ -0,0 +1,103 @@ +# ServiceTestGroupAssignmentsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Items** | [**[]ServiceTestGroupAssignmentsItem**](ServiceTestGroupAssignmentsItem.md) | | +**Count** | **int32** | | +**Next** | **NullableString** | | + +## Methods + +### NewServiceTestGroupAssignmentsResponse + +`func NewServiceTestGroupAssignmentsResponse(items []ServiceTestGroupAssignmentsItem, count int32, next NullableString, ) *ServiceTestGroupAssignmentsResponse` + +NewServiceTestGroupAssignmentsResponse instantiates a new ServiceTestGroupAssignmentsResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewServiceTestGroupAssignmentsResponseWithDefaults + +`func NewServiceTestGroupAssignmentsResponseWithDefaults() *ServiceTestGroupAssignmentsResponse` + +NewServiceTestGroupAssignmentsResponseWithDefaults instantiates a new ServiceTestGroupAssignmentsResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetItems + +`func (o *ServiceTestGroupAssignmentsResponse) GetItems() []ServiceTestGroupAssignmentsItem` + +GetItems returns the Items field if non-nil, zero value otherwise. + +### GetItemsOk + +`func (o *ServiceTestGroupAssignmentsResponse) GetItemsOk() (*[]ServiceTestGroupAssignmentsItem, bool)` + +GetItemsOk returns a tuple with the Items field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetItems + +`func (o *ServiceTestGroupAssignmentsResponse) SetItems(v []ServiceTestGroupAssignmentsItem)` + +SetItems sets Items field to given value. + + +### GetCount + +`func (o *ServiceTestGroupAssignmentsResponse) GetCount() int32` + +GetCount returns the Count field if non-nil, zero value otherwise. + +### GetCountOk + +`func (o *ServiceTestGroupAssignmentsResponse) GetCountOk() (*int32, bool)` + +GetCountOk returns a tuple with the Count field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCount + +`func (o *ServiceTestGroupAssignmentsResponse) SetCount(v int32)` + +SetCount sets Count field to given value. + + +### GetNext + +`func (o *ServiceTestGroupAssignmentsResponse) GetNext() string` + +GetNext returns the Next field if non-nil, zero value otherwise. + +### GetNextOk + +`func (o *ServiceTestGroupAssignmentsResponse) GetNextOk() (*string, bool)` + +GetNextOk returns a tuple with the Next field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNext + +`func (o *ServiceTestGroupAssignmentsResponse) SetNext(v string)` + +SetNext sets Next field to given value. + + +### SetNextNil + +`func (o *ServiceTestGroupAssignmentsResponse) SetNextNil(b bool)` + + SetNextNil sets the value for Next to be an explicit nil + +### UnsetNext +`func (o *ServiceTestGroupAssignmentsResponse) UnsetNext()` + +UnsetNext ensures that no value is present for Next, not even an explicit nil + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/config-api-client/go.mod b/pkg/config-api-client/go.mod index 6c5bcb61..c4418b8d 100644 --- a/pkg/config-api-client/go.mod +++ b/pkg/config-api-client/go.mod @@ -1,4 +1,4 @@ -module github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client +module github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client go 1.18 diff --git a/pkg/config-api-client/model_agent.go b/pkg/config-api-client/model_agent.go index b9d7e64c..090015f4 100644 --- a/pkg/config-api-client/model_agent.go +++ b/pkg/config-api-client/model_agent.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_agent_group_assignment_response.go b/pkg/config-api-client/model_agent_group_assignment_response.go new file mode 100644 index 00000000..4ade33cf --- /dev/null +++ b/pkg/config-api-client/model_agent_group_assignment_response.go @@ -0,0 +1,248 @@ +/* +Configuration Api + +Nice description goes here + +API version: 5.6.0 +Contact: support@capenetworks.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package config_api_client + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the AgentGroupAssignmentResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AgentGroupAssignmentResponse{} + +// AgentGroupAssignmentResponse struct for AgentGroupAssignmentResponse +type AgentGroupAssignmentResponse struct { + Id string `json:"id"` + Group Group `json:"group"` + Agent Agent `json:"agent"` + Type string `json:"type"` +} + +type _AgentGroupAssignmentResponse AgentGroupAssignmentResponse + +// NewAgentGroupAssignmentResponse instantiates a new AgentGroupAssignmentResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAgentGroupAssignmentResponse( + id string, + group Group, + agent Agent, + type_ string, +) *AgentGroupAssignmentResponse { + this := AgentGroupAssignmentResponse{} + this.Id = id + this.Group = group + this.Agent = agent + this.Type = type_ + return &this +} + +// NewAgentGroupAssignmentResponseWithDefaults instantiates a new AgentGroupAssignmentResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAgentGroupAssignmentResponseWithDefaults() *AgentGroupAssignmentResponse { + this := AgentGroupAssignmentResponse{} + return &this +} + +// GetId returns the Id field value +func (o *AgentGroupAssignmentResponse) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AgentGroupAssignmentResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *AgentGroupAssignmentResponse) SetId(v string) { + o.Id = v +} + +// GetGroup returns the Group field value +func (o *AgentGroupAssignmentResponse) GetGroup() Group { + if o == nil { + var ret Group + return ret + } + + return o.Group +} + +// GetGroupOk returns a tuple with the Group field value +// and a boolean to check if the value has been set. +func (o *AgentGroupAssignmentResponse) GetGroupOk() (*Group, bool) { + if o == nil { + return nil, false + } + return &o.Group, true +} + +// SetGroup sets field value +func (o *AgentGroupAssignmentResponse) SetGroup(v Group) { + o.Group = v +} + +// GetAgent returns the Agent field value +func (o *AgentGroupAssignmentResponse) GetAgent() Agent { + if o == nil { + var ret Agent + return ret + } + + return o.Agent +} + +// GetAgentOk returns a tuple with the Agent field value +// and a boolean to check if the value has been set. +func (o *AgentGroupAssignmentResponse) GetAgentOk() (*Agent, bool) { + if o == nil { + return nil, false + } + return &o.Agent, true +} + +// SetAgent sets field value +func (o *AgentGroupAssignmentResponse) SetAgent(v Agent) { + o.Agent = v +} + +// GetType returns the Type field value +func (o *AgentGroupAssignmentResponse) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AgentGroupAssignmentResponse) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *AgentGroupAssignmentResponse) SetType(v string) { + o.Type = v +} + +func (o AgentGroupAssignmentResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AgentGroupAssignmentResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["group"] = o.Group + toSerialize["agent"] = o.Agent + toSerialize["type"] = o.Type + return toSerialize, nil +} + +func (o *AgentGroupAssignmentResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "group", + "agent", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAgentGroupAssignmentResponse := _AgentGroupAssignmentResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAgentGroupAssignmentResponse) + + if err != nil { + return err + } + + *o = AgentGroupAssignmentResponse(varAgentGroupAssignmentResponse) + + return err +} + +type NullableAgentGroupAssignmentResponse struct { + value *AgentGroupAssignmentResponse + isSet bool +} + +func (v NullableAgentGroupAssignmentResponse) Get() *AgentGroupAssignmentResponse { + return v.value +} + +func (v *NullableAgentGroupAssignmentResponse) Set(val *AgentGroupAssignmentResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAgentGroupAssignmentResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAgentGroupAssignmentResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAgentGroupAssignmentResponse( + val *AgentGroupAssignmentResponse, +) *NullableAgentGroupAssignmentResponse { + return &NullableAgentGroupAssignmentResponse{value: val, isSet: true} +} + +func (v NullableAgentGroupAssignmentResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAgentGroupAssignmentResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/config-api-client/model_agent_group_assignments_item.go b/pkg/config-api-client/model_agent_group_assignments_item.go index 5eb673cc..ae898888 100644 --- a/pkg/config-api-client/model_agent_group_assignments_item.go +++ b/pkg/config-api-client/model_agent_group_assignments_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_agent_group_assignments_post_request.go b/pkg/config-api-client/model_agent_group_assignments_post_request.go new file mode 100644 index 00000000..d214f689 --- /dev/null +++ b/pkg/config-api-client/model_agent_group_assignments_post_request.go @@ -0,0 +1,190 @@ +/* +Configuration Api + +Nice description goes here + +API version: 5.6.0 +Contact: support@capenetworks.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package config_api_client + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the AgentGroupAssignmentsPostRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AgentGroupAssignmentsPostRequest{} + +// AgentGroupAssignmentsPostRequest struct for AgentGroupAssignmentsPostRequest +type AgentGroupAssignmentsPostRequest struct { + GroupId string `json:"groupId"` + AgentId string `json:"agentId"` +} + +type _AgentGroupAssignmentsPostRequest AgentGroupAssignmentsPostRequest + +// NewAgentGroupAssignmentsPostRequest instantiates a new AgentGroupAssignmentsPostRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAgentGroupAssignmentsPostRequest( + groupId string, + agentId string, +) *AgentGroupAssignmentsPostRequest { + this := AgentGroupAssignmentsPostRequest{} + this.GroupId = groupId + this.AgentId = agentId + return &this +} + +// NewAgentGroupAssignmentsPostRequestWithDefaults instantiates a new AgentGroupAssignmentsPostRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAgentGroupAssignmentsPostRequestWithDefaults() *AgentGroupAssignmentsPostRequest { + this := AgentGroupAssignmentsPostRequest{} + return &this +} + +// GetGroupId returns the GroupId field value +func (o *AgentGroupAssignmentsPostRequest) GetGroupId() string { + if o == nil { + var ret string + return ret + } + + return o.GroupId +} + +// GetGroupIdOk returns a tuple with the GroupId field value +// and a boolean to check if the value has been set. +func (o *AgentGroupAssignmentsPostRequest) GetGroupIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GroupId, true +} + +// SetGroupId sets field value +func (o *AgentGroupAssignmentsPostRequest) SetGroupId(v string) { + o.GroupId = v +} + +// GetAgentId returns the AgentId field value +func (o *AgentGroupAssignmentsPostRequest) GetAgentId() string { + if o == nil { + var ret string + return ret + } + + return o.AgentId +} + +// GetAgentIdOk returns a tuple with the AgentId field value +// and a boolean to check if the value has been set. +func (o *AgentGroupAssignmentsPostRequest) GetAgentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AgentId, true +} + +// SetAgentId sets field value +func (o *AgentGroupAssignmentsPostRequest) SetAgentId(v string) { + o.AgentId = v +} + +func (o AgentGroupAssignmentsPostRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AgentGroupAssignmentsPostRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["groupId"] = o.GroupId + toSerialize["agentId"] = o.AgentId + return toSerialize, nil +} + +func (o *AgentGroupAssignmentsPostRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "groupId", + "agentId", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAgentGroupAssignmentsPostRequest := _AgentGroupAssignmentsPostRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAgentGroupAssignmentsPostRequest) + + if err != nil { + return err + } + + *o = AgentGroupAssignmentsPostRequest(varAgentGroupAssignmentsPostRequest) + + return err +} + +type NullableAgentGroupAssignmentsPostRequest struct { + value *AgentGroupAssignmentsPostRequest + isSet bool +} + +func (v NullableAgentGroupAssignmentsPostRequest) Get() *AgentGroupAssignmentsPostRequest { + return v.value +} + +func (v *NullableAgentGroupAssignmentsPostRequest) Set(val *AgentGroupAssignmentsPostRequest) { + v.value = val + v.isSet = true +} + +func (v NullableAgentGroupAssignmentsPostRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableAgentGroupAssignmentsPostRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAgentGroupAssignmentsPostRequest( + val *AgentGroupAssignmentsPostRequest, +) *NullableAgentGroupAssignmentsPostRequest { + return &NullableAgentGroupAssignmentsPostRequest{value: val, isSet: true} +} + +func (v NullableAgentGroupAssignmentsPostRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAgentGroupAssignmentsPostRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/config-api-client/model_agent_group_assignments_response.go b/pkg/config-api-client/model_agent_group_assignments_response.go index 8ff372cb..667579c2 100644 --- a/pkg/config-api-client/model_agent_group_assignments_response.go +++ b/pkg/config-api-client/model_agent_group_assignments_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_agent_item.go b/pkg/config-api-client/model_agent_item.go index eca17f4b..9760a724 100644 --- a/pkg/config-api-client/model_agent_item.go +++ b/pkg/config-api-client/model_agent_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_agents_response.go b/pkg/config-api-client/model_agents_response.go index c751b76f..93083659 100644 --- a/pkg/config-api-client/model_agents_response.go +++ b/pkg/config-api-client/model_agents_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_error_detail.go b/pkg/config-api-client/model_error_detail.go index 2b201310..3f8140ae 100644 --- a/pkg/config-api-client/model_error_detail.go +++ b/pkg/config-api-client/model_error_detail.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_error_response.go b/pkg/config-api-client/model_error_response.go index badb9e57..1eccd445 100644 --- a/pkg/config-api-client/model_error_response.go +++ b/pkg/config-api-client/model_error_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_group.go b/pkg/config-api-client/model_group.go index 7328df49..54f3e204 100644 --- a/pkg/config-api-client/model_group.go +++ b/pkg/config-api-client/model_group.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_groups_get_item.go b/pkg/config-api-client/model_groups_get_item.go index bd386746..ad6832cd 100644 --- a/pkg/config-api-client/model_groups_get_item.go +++ b/pkg/config-api-client/model_groups_get_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_groups_get_response.go b/pkg/config-api-client/model_groups_get_response.go index 4637bcc3..81671ea7 100644 --- a/pkg/config-api-client/model_groups_get_response.go +++ b/pkg/config-api-client/model_groups_get_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_groups_patch_request.go b/pkg/config-api-client/model_groups_patch_request.go index 7cf61b43..40fd1116 100644 --- a/pkg/config-api-client/model_groups_patch_request.go +++ b/pkg/config-api-client/model_groups_patch_request.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_groups_patch_response.go b/pkg/config-api-client/model_groups_patch_response.go index 128545d1..bd96a50b 100644 --- a/pkg/config-api-client/model_groups_patch_response.go +++ b/pkg/config-api-client/model_groups_patch_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_groups_post_request.go b/pkg/config-api-client/model_groups_post_request.go index 04139d99..3af1abf8 100644 --- a/pkg/config-api-client/model_groups_post_request.go +++ b/pkg/config-api-client/model_groups_post_request.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_groups_post_response.go b/pkg/config-api-client/model_groups_post_response.go index 860b33c2..588e5f3c 100644 --- a/pkg/config-api-client/model_groups_post_response.go +++ b/pkg/config-api-client/model_groups_post_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_issue.go b/pkg/config-api-client/model_issue.go index f8e77050..4f888270 100644 --- a/pkg/config-api-client/model_issue.go +++ b/pkg/config-api-client/model_issue.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_issue_subject.go b/pkg/config-api-client/model_issue_subject.go index 7b799f59..433cede2 100644 --- a/pkg/config-api-client/model_issue_subject.go +++ b/pkg/config-api-client/model_issue_subject.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_network.go b/pkg/config-api-client/model_network.go index 11ec39b9..0c547c05 100644 --- a/pkg/config-api-client/model_network.go +++ b/pkg/config-api-client/model_network.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_network_group_assignments_item.go b/pkg/config-api-client/model_network_group_assignments_item.go index ae01a174..4896b913 100644 --- a/pkg/config-api-client/model_network_group_assignments_item.go +++ b/pkg/config-api-client/model_network_group_assignments_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_network_group_assignments_post_request.go b/pkg/config-api-client/model_network_group_assignments_post_request.go index d38ab453..9ac4e8be 100644 --- a/pkg/config-api-client/model_network_group_assignments_post_request.go +++ b/pkg/config-api-client/model_network_group_assignments_post_request.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_network_group_assignments_post_response.go b/pkg/config-api-client/model_network_group_assignments_post_response.go index 8583dcf4..e0e538a1 100644 --- a/pkg/config-api-client/model_network_group_assignments_post_response.go +++ b/pkg/config-api-client/model_network_group_assignments_post_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_network_group_assignments_response.go b/pkg/config-api-client/model_network_group_assignments_response.go index a290d298..770560a4 100644 --- a/pkg/config-api-client/model_network_group_assignments_response.go +++ b/pkg/config-api-client/model_network_group_assignments_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_parent.go b/pkg/config-api-client/model_parent.go index 1a187b22..10c204f0 100644 --- a/pkg/config-api-client/model_parent.go +++ b/pkg/config-api-client/model_parent.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensor.go b/pkg/config-api-client/model_sensor.go index 2a5f2809..7ff54384 100644 --- a/pkg/config-api-client/model_sensor.go +++ b/pkg/config-api-client/model_sensor.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensor_group_assignment_response.go b/pkg/config-api-client/model_sensor_group_assignment_response.go index cb48206c..92db9fff 100644 --- a/pkg/config-api-client/model_sensor_group_assignment_response.go +++ b/pkg/config-api-client/model_sensor_group_assignment_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensor_group_assignments_item.go b/pkg/config-api-client/model_sensor_group_assignments_item.go index c90b3898..f21eb164 100644 --- a/pkg/config-api-client/model_sensor_group_assignments_item.go +++ b/pkg/config-api-client/model_sensor_group_assignments_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensor_group_assignments_post_request.go b/pkg/config-api-client/model_sensor_group_assignments_post_request.go index b1b56396..ea9ee527 100644 --- a/pkg/config-api-client/model_sensor_group_assignments_post_request.go +++ b/pkg/config-api-client/model_sensor_group_assignments_post_request.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensor_group_assignments_response.go b/pkg/config-api-client/model_sensor_group_assignments_response.go index 8330c287..5fc9276a 100644 --- a/pkg/config-api-client/model_sensor_group_assignments_response.go +++ b/pkg/config-api-client/model_sensor_group_assignments_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensor_item.go b/pkg/config-api-client/model_sensor_item.go index 533f9fe5..8b34ebf9 100644 --- a/pkg/config-api-client/model_sensor_item.go +++ b/pkg/config-api-client/model_sensor_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensors_patch_request.go b/pkg/config-api-client/model_sensors_patch_request.go index 488b9ce6..4449ce6e 100644 --- a/pkg/config-api-client/model_sensors_patch_request.go +++ b/pkg/config-api-client/model_sensors_patch_request.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensors_patch_response.go b/pkg/config-api-client/model_sensors_patch_response.go index 30c16872..a8f9c518 100644 --- a/pkg/config-api-client/model_sensors_patch_response.go +++ b/pkg/config-api-client/model_sensors_patch_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensors_response.go b/pkg/config-api-client/model_sensors_response.go index 97956185..d51e51bc 100644 --- a/pkg/config-api-client/model_sensors_response.go +++ b/pkg/config-api-client/model_sensors_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_service_test_.go b/pkg/config-api-client/model_service_test_.go index 75b91084..2db7a91a 100644 --- a/pkg/config-api-client/model_service_test_.go +++ b/pkg/config-api-client/model_service_test_.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_service_test_group_assignments_item.go b/pkg/config-api-client/model_service_test_group_assignments_item.go new file mode 100644 index 00000000..8f51b348 --- /dev/null +++ b/pkg/config-api-client/model_service_test_group_assignments_item.go @@ -0,0 +1,248 @@ +/* +Configuration Api + +Nice description goes here + +API version: 5.6.0 +Contact: support@capenetworks.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package config_api_client + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the ServiceTestGroupAssignmentsItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServiceTestGroupAssignmentsItem{} + +// ServiceTestGroupAssignmentsItem struct for ServiceTestGroupAssignmentsItem +type ServiceTestGroupAssignmentsItem struct { + Id string `json:"id"` + Group Group `json:"group"` + ServiceTest ServiceTest `json:"serviceTest"` + Type string `json:"type"` +} + +type _ServiceTestGroupAssignmentsItem ServiceTestGroupAssignmentsItem + +// NewServiceTestGroupAssignmentsItem instantiates a new ServiceTestGroupAssignmentsItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServiceTestGroupAssignmentsItem( + id string, + group Group, + serviceTest ServiceTest, + type_ string, +) *ServiceTestGroupAssignmentsItem { + this := ServiceTestGroupAssignmentsItem{} + this.Id = id + this.Group = group + this.ServiceTest = serviceTest + this.Type = type_ + return &this +} + +// NewServiceTestGroupAssignmentsItemWithDefaults instantiates a new ServiceTestGroupAssignmentsItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServiceTestGroupAssignmentsItemWithDefaults() *ServiceTestGroupAssignmentsItem { + this := ServiceTestGroupAssignmentsItem{} + return &this +} + +// GetId returns the Id field value +func (o *ServiceTestGroupAssignmentsItem) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ServiceTestGroupAssignmentsItem) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ServiceTestGroupAssignmentsItem) SetId(v string) { + o.Id = v +} + +// GetGroup returns the Group field value +func (o *ServiceTestGroupAssignmentsItem) GetGroup() Group { + if o == nil { + var ret Group + return ret + } + + return o.Group +} + +// GetGroupOk returns a tuple with the Group field value +// and a boolean to check if the value has been set. +func (o *ServiceTestGroupAssignmentsItem) GetGroupOk() (*Group, bool) { + if o == nil { + return nil, false + } + return &o.Group, true +} + +// SetGroup sets field value +func (o *ServiceTestGroupAssignmentsItem) SetGroup(v Group) { + o.Group = v +} + +// GetServiceTest returns the ServiceTest field value +func (o *ServiceTestGroupAssignmentsItem) GetServiceTest() ServiceTest { + if o == nil { + var ret ServiceTest + return ret + } + + return o.ServiceTest +} + +// GetServiceTestOk returns a tuple with the ServiceTest field value +// and a boolean to check if the value has been set. +func (o *ServiceTestGroupAssignmentsItem) GetServiceTestOk() (*ServiceTest, bool) { + if o == nil { + return nil, false + } + return &o.ServiceTest, true +} + +// SetServiceTest sets field value +func (o *ServiceTestGroupAssignmentsItem) SetServiceTest(v ServiceTest) { + o.ServiceTest = v +} + +// GetType returns the Type field value +func (o *ServiceTestGroupAssignmentsItem) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ServiceTestGroupAssignmentsItem) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *ServiceTestGroupAssignmentsItem) SetType(v string) { + o.Type = v +} + +func (o ServiceTestGroupAssignmentsItem) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ServiceTestGroupAssignmentsItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["group"] = o.Group + toSerialize["serviceTest"] = o.ServiceTest + toSerialize["type"] = o.Type + return toSerialize, nil +} + +func (o *ServiceTestGroupAssignmentsItem) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "group", + "serviceTest", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varServiceTestGroupAssignmentsItem := _ServiceTestGroupAssignmentsItem{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varServiceTestGroupAssignmentsItem) + + if err != nil { + return err + } + + *o = ServiceTestGroupAssignmentsItem(varServiceTestGroupAssignmentsItem) + + return err +} + +type NullableServiceTestGroupAssignmentsItem struct { + value *ServiceTestGroupAssignmentsItem + isSet bool +} + +func (v NullableServiceTestGroupAssignmentsItem) Get() *ServiceTestGroupAssignmentsItem { + return v.value +} + +func (v *NullableServiceTestGroupAssignmentsItem) Set(val *ServiceTestGroupAssignmentsItem) { + v.value = val + v.isSet = true +} + +func (v NullableServiceTestGroupAssignmentsItem) IsSet() bool { + return v.isSet +} + +func (v *NullableServiceTestGroupAssignmentsItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServiceTestGroupAssignmentsItem( + val *ServiceTestGroupAssignmentsItem, +) *NullableServiceTestGroupAssignmentsItem { + return &NullableServiceTestGroupAssignmentsItem{value: val, isSet: true} +} + +func (v NullableServiceTestGroupAssignmentsItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServiceTestGroupAssignmentsItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/config-api-client/model_service_test_group_assignments_post_request.go b/pkg/config-api-client/model_service_test_group_assignments_post_request.go index ad366a6c..7028a49c 100644 --- a/pkg/config-api-client/model_service_test_group_assignments_post_request.go +++ b/pkg/config-api-client/model_service_test_group_assignments_post_request.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_service_test_group_assignments_post_response.go b/pkg/config-api-client/model_service_test_group_assignments_post_response.go index 25fa3298..15841622 100644 --- a/pkg/config-api-client/model_service_test_group_assignments_post_response.go +++ b/pkg/config-api-client/model_service_test_group_assignments_post_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_service_test_group_assignments_response.go b/pkg/config-api-client/model_service_test_group_assignments_response.go new file mode 100644 index 00000000..ed55669f --- /dev/null +++ b/pkg/config-api-client/model_service_test_group_assignments_response.go @@ -0,0 +1,223 @@ +/* +Configuration Api + +Nice description goes here + +API version: 5.6.0 +Contact: support@capenetworks.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package config_api_client + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the ServiceTestGroupAssignmentsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServiceTestGroupAssignmentsResponse{} + +// ServiceTestGroupAssignmentsResponse struct for ServiceTestGroupAssignmentsResponse +type ServiceTestGroupAssignmentsResponse struct { + Items []ServiceTestGroupAssignmentsItem `json:"items"` + Count int32 `json:"count"` + Next NullableString `json:"next"` +} + +type _ServiceTestGroupAssignmentsResponse ServiceTestGroupAssignmentsResponse + +// NewServiceTestGroupAssignmentsResponse instantiates a new ServiceTestGroupAssignmentsResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServiceTestGroupAssignmentsResponse( + items []ServiceTestGroupAssignmentsItem, + count int32, + next NullableString, +) *ServiceTestGroupAssignmentsResponse { + this := ServiceTestGroupAssignmentsResponse{} + this.Items = items + this.Count = count + this.Next = next + return &this +} + +// NewServiceTestGroupAssignmentsResponseWithDefaults instantiates a new ServiceTestGroupAssignmentsResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServiceTestGroupAssignmentsResponseWithDefaults() *ServiceTestGroupAssignmentsResponse { + this := ServiceTestGroupAssignmentsResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ServiceTestGroupAssignmentsResponse) GetItems() []ServiceTestGroupAssignmentsItem { + if o == nil { + var ret []ServiceTestGroupAssignmentsItem + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ServiceTestGroupAssignmentsResponse) GetItemsOk() ([]ServiceTestGroupAssignmentsItem, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ServiceTestGroupAssignmentsResponse) SetItems(v []ServiceTestGroupAssignmentsItem) { + o.Items = v +} + +// GetCount returns the Count field value +func (o *ServiceTestGroupAssignmentsResponse) GetCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Count +} + +// GetCountOk returns a tuple with the Count field value +// and a boolean to check if the value has been set. +func (o *ServiceTestGroupAssignmentsResponse) GetCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Count, true +} + +// SetCount sets field value +func (o *ServiceTestGroupAssignmentsResponse) SetCount(v int32) { + o.Count = v +} + +// GetNext returns the Next field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ServiceTestGroupAssignmentsResponse) GetNext() string { + if o == nil || o.Next.Get() == nil { + var ret string + return ret + } + + return *o.Next.Get() +} + +// GetNextOk returns a tuple with the Next field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ServiceTestGroupAssignmentsResponse) GetNextOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Next.Get(), o.Next.IsSet() +} + +// SetNext sets field value +func (o *ServiceTestGroupAssignmentsResponse) SetNext(v string) { + o.Next.Set(&v) +} + +func (o ServiceTestGroupAssignmentsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ServiceTestGroupAssignmentsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + toSerialize["count"] = o.Count + toSerialize["next"] = o.Next.Get() + return toSerialize, nil +} + +func (o *ServiceTestGroupAssignmentsResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "items", + "count", + "next", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varServiceTestGroupAssignmentsResponse := _ServiceTestGroupAssignmentsResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varServiceTestGroupAssignmentsResponse) + + if err != nil { + return err + } + + *o = ServiceTestGroupAssignmentsResponse(varServiceTestGroupAssignmentsResponse) + + return err +} + +type NullableServiceTestGroupAssignmentsResponse struct { + value *ServiceTestGroupAssignmentsResponse + isSet bool +} + +func (v NullableServiceTestGroupAssignmentsResponse) Get() *ServiceTestGroupAssignmentsResponse { + return v.value +} + +func (v *NullableServiceTestGroupAssignmentsResponse) Set( + val *ServiceTestGroupAssignmentsResponse, +) { + v.value = val + v.isSet = true +} + +func (v NullableServiceTestGroupAssignmentsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableServiceTestGroupAssignmentsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServiceTestGroupAssignmentsResponse( + val *ServiceTestGroupAssignmentsResponse, +) *NullableServiceTestGroupAssignmentsResponse { + return &NullableServiceTestGroupAssignmentsResponse{value: val, isSet: true} +} + +func (v NullableServiceTestGroupAssignmentsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServiceTestGroupAssignmentsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/config-api-client/model_service_tests_list_item.go b/pkg/config-api-client/model_service_tests_list_item.go index 0afec495..29e0c943 100644 --- a/pkg/config-api-client/model_service_tests_list_item.go +++ b/pkg/config-api-client/model_service_tests_list_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_service_tests_list_response.go b/pkg/config-api-client/model_service_tests_list_response.go index 1ad592f2..a00afb11 100644 --- a/pkg/config-api-client/model_service_tests_list_response.go +++ b/pkg/config-api-client/model_service_tests_list_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_wired_networks_item.go b/pkg/config-api-client/model_wired_networks_item.go index 44fd7666..6832b942 100644 --- a/pkg/config-api-client/model_wired_networks_item.go +++ b/pkg/config-api-client/model_wired_networks_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_wired_networks_response.go b/pkg/config-api-client/model_wired_networks_response.go index df673ec2..e1f26bd9 100644 --- a/pkg/config-api-client/model_wired_networks_response.go +++ b/pkg/config-api-client/model_wired_networks_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_wireless_networks_item.go b/pkg/config-api-client/model_wireless_networks_item.go index c98ba895..3b581929 100644 --- a/pkg/config-api-client/model_wireless_networks_item.go +++ b/pkg/config-api-client/model_wireless_networks_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_wireless_networks_response.go b/pkg/config-api-client/model_wireless_networks_response.go index c33f102c..194f210b 100644 --- a/pkg/config-api-client/model_wireless_networks_response.go +++ b/pkg/config-api-client/model_wireless_networks_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/response.go b/pkg/config-api-client/response.go index cc425cde..3239c83b 100644 --- a/pkg/config-api-client/response.go +++ b/pkg/config-api-client/response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/test/api_configuration_test.go b/pkg/config-api-client/test/api_configuration_test.go index 7112f64c..079443a2 100644 --- a/pkg/config-api-client/test/api_configuration_test.go +++ b/pkg/config-api-client/test/api_configuration_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - openapiclient "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "github.com/h2non/gock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -13,10 +13,10 @@ import ( func TestConfigurationAPI(t *testing.T) { - configuration := openapiclient.NewConfiguration() + configuration := config_api_client.NewConfiguration() configuration.Host = "localhost:80" configuration.Scheme = "http" - apiClient := openapiclient.NewAPIClient(configuration) + apiClient := config_api_client.NewAPIClient(configuration) defer gock.Off() @@ -57,21 +57,21 @@ func TestConfigurationAPI(t *testing.T) { require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.AgentsResponse{ - Items: []openapiclient.AgentItem{ + assert.Equal(t, resp, &config_api_client.AgentsResponse{ + Items: []config_api_client.AgentItem{ { Id: "uid", Serial: "serial", Name: "name", - ModelNumber: *openapiclient.NewNullableString(&modelNumber), - WifiMacAddress: *openapiclient.NewNullableString(&wifiMacAddress), - EthernetMacAddress: *openapiclient.NewNullableString(ðernetMacAddress), - Notes: *openapiclient.NewNullableString(¬es), - PcapMode: *openapiclient.NewNullableString(&pcapMode), + ModelNumber: *config_api_client.NewNullableString(&modelNumber), + WifiMacAddress: *config_api_client.NewNullableString(&wifiMacAddress), + EthernetMacAddress: *config_api_client.NewNullableString(ðernetMacAddress), + Notes: *config_api_client.NewNullableString(¬es), + PcapMode: *config_api_client.NewNullableString(&pcapMode), Type: "networking-uxi/sensor", }, }, - Next: *openapiclient.NewNullableString(nil), + Next: *config_api_client.NewNullableString(nil), Count: 1, }) }) @@ -117,17 +117,17 @@ func TestConfigurationAPI(t *testing.T) { require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.GroupsGetResponse{ - Items: []openapiclient.GroupsGetItem{ + assert.Equal(t, resp, &config_api_client.GroupsGetResponse{ + Items: []config_api_client.GroupsGetItem{ { Id: "uid", Name: "name", - Parent: *openapiclient.NewNullableParent(openapiclient.NewParent("parent_uid")), + Parent: *config_api_client.NewNullableParent(config_api_client.NewParent("parent_uid")), Path: "root_uid.parent_uid.uid", Type: "networking-uxi/group", }, }, - Next: *openapiclient.NewNullableString(nil), + Next: *config_api_client.NewNullableString(nil), Count: 1, }) }) @@ -148,7 +148,7 @@ func TestConfigurationAPI(t *testing.T) { "path": "parent.uid.node", "type": "networking-uxi/group", }) - groupsPostRequest := openapiclient.NewGroupsPostRequest("name") + groupsPostRequest := config_api_client.NewGroupsPostRequest("name") groupsPostRequest.SetParentId("parent.uid") resp, httpRes, err := apiClient.ConfigurationAPI. GroupsPost(context.Background()). @@ -156,10 +156,10 @@ func TestConfigurationAPI(t *testing.T) { require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.GroupsPostResponse{ + assert.Equal(t, resp, &config_api_client.GroupsPostResponse{ Id: "node", Name: "name", - Parent: *openapiclient.NewParent("parent.uid"), + Parent: *config_api_client.NewParent("parent.uid"), Path: "parent.uid.node", Type: "networking-uxi/group", }) @@ -177,17 +177,17 @@ func TestConfigurationAPI(t *testing.T) { "path": "parent.uid.node", "type": "networking-uxi/group", }) - groupsPatchRequest := openapiclient.NewGroupsPatchRequest("new_name") + groupsPatchRequest := config_api_client.NewGroupsPatchRequest("new_name") resp, httpRes, err := apiClient.ConfigurationAPI. GroupsPatch(context.Background(), "node"). GroupsPatchRequest(*groupsPatchRequest).Execute() require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.GroupsPatchResponse{ + assert.Equal(t, resp, &config_api_client.GroupsPatchResponse{ Id: "node", Name: "new_name", - Parent: *openapiclient.NewParent("parent.uid"), + Parent: *config_api_client.NewParent("parent.uid"), Path: "parent.uid.node", Type: "networking-uxi/group", }) @@ -249,24 +249,24 @@ func TestConfigurationAPI(t *testing.T) { require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.SensorsResponse{ - Items: []openapiclient.SensorItem{ + assert.Equal(t, resp, &config_api_client.SensorsResponse{ + Items: []config_api_client.SensorItem{ { Id: "uid", Serial: "serial", Name: "name", ModelNumber: "model_number", - WifiMacAddress: *openapiclient.NewNullableString(&WifiMacAddress), - EthernetMacAddress: *openapiclient.NewNullableString(&EthernetMacAddress), - AddressNote: *openapiclient.NewNullableString(&AddressNote), - Longitude: *openapiclient.NewNullableFloat32(&Longitude), - Latitude: *openapiclient.NewNullableFloat32(&Latitude), - Notes: *openapiclient.NewNullableString(&Notes), - PcapMode: *openapiclient.NewNullableString(&PcapMode), + WifiMacAddress: *config_api_client.NewNullableString(&WifiMacAddress), + EthernetMacAddress: *config_api_client.NewNullableString(&EthernetMacAddress), + AddressNote: *config_api_client.NewNullableString(&AddressNote), + Longitude: *config_api_client.NewNullableFloat32(&Longitude), + Latitude: *config_api_client.NewNullableFloat32(&Latitude), + Notes: *config_api_client.NewNullableString(&Notes), + PcapMode: *config_api_client.NewNullableString(&PcapMode), Type: "networking-uxi/sensor", }, }, - Next: *openapiclient.NewNullableString(nil), + Next: *config_api_client.NewNullableString(nil), Count: 1, }) }) @@ -298,10 +298,10 @@ func TestConfigurationAPI(t *testing.T) { addressNote := "new_address_note" notes := "new_notes" pcapMode := "off" - sensorsPatchRequest := openapiclient.SensorsPatchRequest{ + sensorsPatchRequest := config_api_client.SensorsPatchRequest{ Name: &name, - AddressNote: *openapiclient.NewNullableString(&addressNote), - Notes: *openapiclient.NewNullableString(¬es), + AddressNote: *config_api_client.NewNullableString(&addressNote), + Notes: *config_api_client.NewNullableString(¬es), PcapMode: &pcapMode, } resp, httpRes, err := apiClient.ConfigurationAPI. @@ -316,18 +316,18 @@ func TestConfigurationAPI(t *testing.T) { require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.SensorsPatchResponse{ + assert.Equal(t, resp, &config_api_client.SensorsPatchResponse{ Id: "uid", Serial: "serial", Name: "new_name", ModelNumber: "model_number", - WifiMacAddress: *openapiclient.NewNullableString(&wifiMacAddress), - EthernetMacAddress: *openapiclient.NewNullableString(ðernetMacAddress), - AddressNote: *openapiclient.NewNullableString(&addressNote), - Longitude: *openapiclient.NewNullableFloat32(&longitude), - Latitude: *openapiclient.NewNullableFloat32(&latitude), - Notes: *openapiclient.NewNullableString(¬es), - PcapMode: *openapiclient.NewNullableString(&pcapMode), + WifiMacAddress: *config_api_client.NewNullableString(&wifiMacAddress), + EthernetMacAddress: *config_api_client.NewNullableString(ðernetMacAddress), + AddressNote: *config_api_client.NewNullableString(&addressNote), + Longitude: *config_api_client.NewNullableFloat32(&longitude), + Latitude: *config_api_client.NewNullableFloat32(&latitude), + Notes: *config_api_client.NewNullableString(¬es), + PcapMode: *config_api_client.NewNullableString(&pcapMode), Type: "networking-uxi/sensor", }) }) @@ -359,19 +359,55 @@ func TestConfigurationAPI(t *testing.T) { require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.AgentGroupAssignmentsResponse{ - Items: []openapiclient.AgentGroupAssignmentsItem{ + assert.Equal(t, resp, &config_api_client.AgentGroupAssignmentsResponse{ + Items: []config_api_client.AgentGroupAssignmentsItem{ { Id: "uid", - Group: *openapiclient.NewGroup("group_uid"), - Agent: *openapiclient.NewAgent("agent_uid"), + Group: *config_api_client.NewGroup("group_uid"), + Agent: *config_api_client.NewAgent("agent_uid"), Type: "networking-uxi/agent-group-assignment", }, }, Count: 1, - Next: *openapiclient.NewNullableString(nil), + Next: *config_api_client.NewNullableString(nil), }) }) + + t.Run("Test ConfigurationAPI AgentGroupAssignmentsPost", func(t *testing.T) { + + gock.New(configuration.Scheme + "://" + configuration.Host). + Post("/networking-uxi/v1alpha1/agent-group-assignments"). + JSON(map[string]interface{}{ + "groupId": "group_uid", + "agentId": "agent_uid", + }). + Reply(200). + JSON(map[string]interface{}{ + "id": "uid", + "group": map[string]string{"id": "group_uid"}, + "agent": map[string]string{"id": "agent_uid"}, + "type": "networking-uxi/agent-group-assignment", + }) + + postRequest := config_api_client.NewAgentGroupAssignmentsPostRequest( + "group_uid", + "agent_uid", + ) + resp, httpRes, err := apiClient.ConfigurationAPI. + AgentGroupAssignmentsPost(context.Background()). + AgentGroupAssignmentsPostRequest(*postRequest). + Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + assert.Equal(t, resp, &config_api_client.AgentGroupAssignmentResponse{ + Id: "uid", + Group: *config_api_client.NewGroup("group_uid"), + Agent: *config_api_client.NewAgent("agent_uid"), + Type: "networking-uxi/agent-group-assignment", + }) + }) + t.Run("Test ConfigurationAPI SensorGroupAssignmentsGet", func(t *testing.T) { gock.New(configuration.Scheme + "://" + configuration.Host). @@ -399,17 +435,17 @@ func TestConfigurationAPI(t *testing.T) { require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.SensorGroupAssignmentsResponse{ - Items: []openapiclient.SensorGroupAssignmentsItem{ + assert.Equal(t, resp, &config_api_client.SensorGroupAssignmentsResponse{ + Items: []config_api_client.SensorGroupAssignmentsItem{ { Id: "uid", - Group: *openapiclient.NewGroup("group_uid"), - Sensor: *openapiclient.NewSensor("sensor_uid"), + Group: *config_api_client.NewGroup("group_uid"), + Sensor: *config_api_client.NewSensor("sensor_uid"), Type: "networking-uxi/sensor-group-assignment", }, }, Count: 1, - Next: *openapiclient.NewNullableString(nil), + Next: *config_api_client.NewNullableString(nil), }) }) @@ -429,7 +465,10 @@ func TestConfigurationAPI(t *testing.T) { "type": "networking-uxi/sensor-group-assignment", }) - postRequest := openapiclient.NewSensorGroupAssignmentsPostRequest("group_uid", "sensor_uid") + postRequest := config_api_client.NewSensorGroupAssignmentsPostRequest( + "group_uid", + "sensor_uid", + ) resp, httpRes, err := apiClient.ConfigurationAPI. SensorGroupAssignmentsPost(context.Background()). SensorGroupAssignmentsPostRequest(*postRequest). @@ -437,10 +476,10 @@ func TestConfigurationAPI(t *testing.T) { require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.SensorGroupAssignmentResponse{ + assert.Equal(t, resp, &config_api_client.SensorGroupAssignmentResponse{ Id: "uid", - Group: *openapiclient.NewGroup("group_uid"), - Sensor: *openapiclient.NewSensor("sensor_uid"), + Group: *config_api_client.NewGroup("group_uid"), + Sensor: *config_api_client.NewSensor("sensor_uid"), Type: "networking-uxi/sensor-group-assignment", }) }) @@ -497,25 +536,25 @@ func TestConfigurationAPI(t *testing.T) { require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.WiredNetworksResponse{ - Items: []openapiclient.WiredNetworksItem{ + assert.Equal(t, resp, &config_api_client.WiredNetworksResponse{ + Items: []config_api_client.WiredNetworksItem{ { Id: "uid", Name: "alias", IpVersion: "ip_version", UpdatedAt: time.Date(2024, 9, 11, 12, 0, 0, 0, time.UTC), CreatedAt: time.Date(2024, 9, 11, 12, 0, 0, 0, time.UTC), - Security: *openapiclient.NewNullableString(&security), - DnsLookupDomain: *openapiclient.NewNullableString(&dnsLookupDomain), + Security: *config_api_client.NewNullableString(&security), + DnsLookupDomain: *config_api_client.NewNullableString(&dnsLookupDomain), DisableEdns: true, UseDns64: false, ExternalConnectivity: true, - VLanId: *openapiclient.NewNullableInt32(&vlanId), + VLanId: *config_api_client.NewNullableInt32(&vlanId), Type: "networking-uxi/wired-network", }, }, Count: 1, - Next: *openapiclient.NewNullableString(nil), + Next: *config_api_client.NewNullableString(nil), }) }) @@ -559,19 +598,19 @@ func TestConfigurationAPI(t *testing.T) { require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.WirelessNetworksResponse{ - Items: []openapiclient.WirelessNetworksItem{ + assert.Equal(t, resp, &config_api_client.WirelessNetworksResponse{ + Items: []config_api_client.WirelessNetworksItem{ { Id: "uid", Name: "alias", Ssid: "ssid", - Security: *openapiclient.NewNullableString(&security), + Security: *config_api_client.NewNullableString(&security), IpVersion: "ip_version", CreatedAt: time.Date(2024, 9, 11, 12, 0, 0, 0, time.UTC), UpdatedAt: time.Date(2024, 9, 11, 12, 0, 0, 0, time.UTC), Hidden: false, BandLocking: "band_locking", - DnsLookupDomain: *openapiclient.NewNullableString(&dnsLookupDomain), + DnsLookupDomain: *config_api_client.NewNullableString(&dnsLookupDomain), DisableEdns: true, UseDns64: false, ExternalConnectivity: true, @@ -579,7 +618,7 @@ func TestConfigurationAPI(t *testing.T) { }, }, Count: 1, - Next: *openapiclient.NewNullableString(nil), + Next: *config_api_client.NewNullableString(nil), }) }) @@ -610,17 +649,17 @@ func TestConfigurationAPI(t *testing.T) { require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.NetworkGroupAssignmentsResponse{ - Items: []openapiclient.NetworkGroupAssignmentsItem{ + assert.Equal(t, resp, &config_api_client.NetworkGroupAssignmentsResponse{ + Items: []config_api_client.NetworkGroupAssignmentsItem{ { Id: "uid", - Group: *openapiclient.NewGroup("group_uid"), - Network: *openapiclient.NewNetwork("network_uid"), + Group: *config_api_client.NewGroup("group_uid"), + Network: *config_api_client.NewNetwork("network_uid"), Type: "networking-uxi/network-group-assignment", }, }, Count: 1, - Next: *openapiclient.NewNullableString(nil), + Next: *config_api_client.NewNullableString(nil), }) }) @@ -640,7 +679,7 @@ func TestConfigurationAPI(t *testing.T) { "type": "networking-uxi/network-group-assignment", }) - postRequest := openapiclient.NewNetworkGroupAssignmentsPostRequest( + postRequest := config_api_client.NewNetworkGroupAssignmentsPostRequest( "group_uid", "network_uid", ) @@ -651,10 +690,10 @@ func TestConfigurationAPI(t *testing.T) { require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.NetworkGroupAssignmentsPostResponse{ + assert.Equal(t, resp, &config_api_client.NetworkGroupAssignmentsPostResponse{ Id: "uid", - Group: *openapiclient.NewGroup("group_uid"), - Network: *openapiclient.NewNetwork("network_uid"), + Group: *config_api_client.NewGroup("group_uid"), + Network: *config_api_client.NewNetwork("network_uid"), Type: "networking-uxi/network-group-assignment", }) }) @@ -672,6 +711,47 @@ func TestConfigurationAPI(t *testing.T) { assert.Equal(t, 204, httpRes.StatusCode) }) + t.Run("Test ConfigurationAPI ServiceTestGroupAssignmentsGet", func(t *testing.T) { + + gock.New(configuration.Scheme + "://" + configuration.Host). + Get("/networking-uxi/v1alpha1/service-test-group-assignments"). + MatchParams(map[string]string{"id": "uid", "limit": "10", "next": "some-cursor"}). + Reply(200). + JSON(map[string]interface{}{ + "items": []map[string]interface{}{ + { + "id": "uid", + "group": map[string]string{"id": "group_uid"}, + "serviceTest": map[string]string{"id": "service_test_uid"}, + "type": "networking-uxi/service-test-group-assignment", + }, + }, + "count": 1, + "next": nil, + }) + resp, httpRes, err := apiClient.ConfigurationAPI. + ServiceTestGroupAssignmentsGet(context.Background()). + Id("uid"). + Limit(10). + Next("some-cursor"). + Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + assert.Equal(t, resp, &config_api_client.ServiceTestGroupAssignmentsResponse{ + Items: []config_api_client.ServiceTestGroupAssignmentsItem{ + { + Id: "uid", + Group: *config_api_client.NewGroup("group_uid"), + ServiceTest: *config_api_client.NewServiceTest("service_test_uid"), + Type: "networking-uxi/service-test-group-assignment", + }, + }, + Count: 1, + Next: *config_api_client.NewNullableString(nil), + }) + }) + t.Run("Test ConfigurationAPI ServiceTestGroupAssignmentsPost", func(t *testing.T) { gock.New(configuration.Scheme + "://" + configuration.Host). @@ -688,7 +768,7 @@ func TestConfigurationAPI(t *testing.T) { "type": "networking-uxi/service-test-group-assignment", }) - postRequest := openapiclient.NewServiceTestGroupAssignmentsPostRequest( + postRequest := config_api_client.NewServiceTestGroupAssignmentsPostRequest( "group_uid", "service_test_uid", ) @@ -699,10 +779,10 @@ func TestConfigurationAPI(t *testing.T) { require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.ServiceTestGroupAssignmentsPostResponse{ + assert.Equal(t, resp, &config_api_client.ServiceTestGroupAssignmentsPostResponse{ Id: "uid", - Group: *openapiclient.NewGroup("group_uid"), - ServiceTest: *openapiclient.NewServiceTest("service_test_uid"), + Group: *config_api_client.NewGroup("group_uid"), + ServiceTest: *config_api_client.NewServiceTest("service_test_uid"), Type: "networking-uxi/service-test-group-assignment", }) }) diff --git a/pkg/config-api-client/utils.go b/pkg/config-api-client/utils.go index 9f8fbefa..47f82b36 100644 --- a/pkg/config-api-client/utils.go +++ b/pkg/config-api-client/utils.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 5.4.0 +API version: 5.6.0 Contact: support@capenetworks.com */ diff --git a/test/live/config/config.go b/test/live/config/config.go index fcf326a5..cb42ce84 100644 --- a/test/live/config/config.go +++ b/test/live/config/config.go @@ -4,6 +4,7 @@ package config // Configuration-API Acceptance Testing (844457745a1111ef880836000a52e73e) // And therefore the client_id and client_secret used for the acceptance tests must match this // customer. +const AgentUid = "8260f349-5c73-394a-b786-57985d001763" const WiredNetworkUid = "ethernet-0ee5b46c2ef0" const WiredNetworkName = "tf-provider-acceptance-tests-ethernet-0" const WirelessNetworkUid = "ssid-bf704ff37dc0" diff --git a/test/live/data-sources/agent_test.go b/test/live/data-sources/agent_test.go new file mode 100644 index 00000000..3ea52a34 --- /dev/null +++ b/test/live/data-sources/agent_test.go @@ -0,0 +1,168 @@ +package data_source_test + +import ( + "context" + "testing" + + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/config" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/util" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/nbio/st" +) + +type agentProperties struct { + id string + serial string + name string + model_number *string + wifi_mac_address *string + ethernet_mac_address *string + notes *string + pcapMode *string +} + +func TestAgentDataSource(t *testing.T) { + agent := getAgentProperties(config.AgentUid) + resource.Test(t, resource.TestCase{ + ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: provider.ProviderConfig + ` + data "uxi_agent" "my_agent" { + filter = { + agent_id = "` + config.AgentUid + `" + } + } + `, + Check: checkStateAgainstAgent(t, agent), + }, + }, + }) +} + +func checkStateAgainstAgent(t st.Fatalf, agent agentProperties) resource.TestCheckFunc { + return resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.uxi_agent.my_agent", "id", config.AgentUid), + resource.TestCheckResourceAttr("data.uxi_agent.my_agent", "serial", agent.serial), + func() resource.TestCheckFunc { + if agent.wifi_mac_address == nil { + return resource.TestCheckNoResourceAttr( + "data.uxi_agent.my_agent", + "model_number", + ) + } else { + return resource.TestCheckResourceAttrWith( + "data.uxi_agent.my_agent", + "model_number", + func(value string) error { + st.Assert(t, value, agent.model_number) + return nil + }, + ) + } + }(), + resource.TestCheckResourceAttrWith( + "data.uxi_agent.my_agent", + "name", + func(value string) error { + st.Assert(t, value, agent.name) + return nil + }, + ), + func() resource.TestCheckFunc { + if agent.wifi_mac_address == nil { + return resource.TestCheckNoResourceAttr( + "data.uxi_agent.my_agent", + "wifi_mac_address", + ) + } else { + return resource.TestCheckResourceAttrWith( + "data.uxi_agent.my_agent", + "wifi_mac_address", + func(value string) error { + st.Assert(t, value, agent.wifi_mac_address) + return nil + }, + ) + } + }(), + func() resource.TestCheckFunc { + if agent.wifi_mac_address == nil { + return resource.TestCheckNoResourceAttr( + "data.uxi_agent.my_agent", + "ethernet_mac_address", + ) + } else { + return resource.TestCheckResourceAttrWith( + "data.uxi_agent.my_agent", + "ethernet_mac_address", + func(value string) error { + st.Assert(t, value, agent.ethernet_mac_address) + return nil + }, + ) + } + }(), + func() resource.TestCheckFunc { + if agent.wifi_mac_address == nil { + return resource.TestCheckNoResourceAttr( + "data.uxi_agent.my_agent", + "notes", + ) + } else { + return resource.TestCheckResourceAttrWith( + "data.uxi_agent.my_agent", + "notes", + func(value string) error { + st.Assert(t, value, agent.notes) + return nil + }, + ) + } + }(), + func() resource.TestCheckFunc { + if agent.pcapMode == nil { + return resource.TestCheckNoResourceAttr( + "data.uxi_agent.my_agent", + "pcap_mode", + ) + } else { + return resource.TestCheckResourceAttrWith( + "data.uxi_agent.my_agent", + "pcap_mode", + func(value string) error { + st.Assert(t, value, agent.pcapMode) + return nil + }, + ) + } + }(), + ) +} + +func getAgentProperties(id string) agentProperties { + result, _, err := util.Client.ConfigurationAPI. + AgentsGet(context.Background()). + Id(id). + Execute() + if err != nil { + panic(err) + } + if len(result.Items) != 1 { + panic("agent with id `" + id + "` could not be found") + } + agent := result.Items[0] + // Read these in, as they may not be always constant with the acceptance test customer + return agentProperties{ + id: agent.Id, + serial: agent.Serial, + name: agent.Name, + model_number: agent.ModelNumber.Get(), + wifi_mac_address: agent.WifiMacAddress.Get(), + ethernet_mac_address: agent.EthernetMacAddress.Get(), + notes: agent.Notes.Get(), + pcapMode: agent.PcapMode.Get(), + } +} diff --git a/test/live/provider/provider.go b/test/live/provider/provider.go index 4f824e29..acfa1cfc 100644 --- a/test/live/provider/provider.go +++ b/test/live/provider/provider.go @@ -1,8 +1,8 @@ package provider import ( - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/live/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/util" "github.com/hashicorp/terraform-plugin-framework/providerserver" "github.com/hashicorp/terraform-plugin-go/tfprotov6" ) diff --git a/test/live/resources/group_test.go b/test/live/resources/group_test.go index 4fe28540..182e5083 100644 --- a/test/live/resources/group_test.go +++ b/test/live/resources/group_test.go @@ -5,8 +5,8 @@ import ( "regexp" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/test/live/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/live/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/util" "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) diff --git a/test/live/resources/network_group_assignment_test.go b/test/live/resources/network_group_assignment_test.go index b57988b6..d1628c65 100644 --- a/test/live/resources/network_group_assignment_test.go +++ b/test/live/resources/network_group_assignment_test.go @@ -3,9 +3,9 @@ package resource_test import ( "testing" - "github.com/aruba-uxi/terraform-provider-configuration/test/live/config" - "github.com/aruba-uxi/terraform-provider-configuration/test/live/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/live/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/config" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/util" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/nbio/st" ) diff --git a/test/live/resources/service_test.go b/test/live/resources/service_test.go index d737ced1..39c50aa4 100644 --- a/test/live/resources/service_test.go +++ b/test/live/resources/service_test.go @@ -1,8 +1,8 @@ package resource_test import ( - "github.com/aruba-uxi/terraform-provider-configuration/test/live/config" - "github.com/aruba-uxi/terraform-provider-configuration/test/live/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/config" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/provider" "regexp" "testing" diff --git a/test/live/resources/service_test_group_assignment_test.go b/test/live/resources/service_test_group_assignment_test.go new file mode 100644 index 00000000..2fdd1ebb --- /dev/null +++ b/test/live/resources/service_test_group_assignment_test.go @@ -0,0 +1,113 @@ +package resource_test + +import ( + "testing" + + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/config" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/util" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/nbio/st" +) + +func TestServiceTestGroupAssignmentResource(t *testing.T) { + const groupName = "tf_acceptance_test_service_test_group_assignment" + const group2Name = "tf_acceptance_test_service_test_group_assignment_two" + + resource.Test(t, resource.TestCase{ + ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Creating a serviceTest group assignment + { + Config: provider.ProviderConfig + ` + resource "uxi_group" "my_group" { + name = "` + groupName + `" + } + + resource "uxi_service_test" "my_service_test" { + name = "` + config.ServiceTestName + `" + } + + import { + to = uxi_service_test.my_service_test + id = "` + config.ServiceTestUid + `" + } + + resource "uxi_service_test_group_assignment" "my_service_test_group_assignment" { + service_test_id = uxi_service_test.my_service_test.id + group_id = uxi_group.my_group.id + }`, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr( + "uxi_service_test_group_assignment.my_service_test_group_assignment", + "service_test_id", + config.ServiceTestUid, + ), + resource.TestCheckResourceAttrWith( + "uxi_service_test_group_assignment.my_service_test_group_assignment", + "group_id", + func(value string) error { + st.Assert(t, value, util.GetGroupByName(groupName).Id) + return nil + }, + ), + ), + }, + // ImportState testing + { + ResourceName: "uxi_service_test_group_assignment.my_service_test_group_assignment", + ImportState: true, + ImportStateVerify: true, + }, + // Update and Read testing + { + Config: provider.ProviderConfig + ` + // the original resources + resource "uxi_group" "my_group" { + name = "` + groupName + `" + } + + resource "uxi_service_test" "my_service_test" { + name = "` + config.ServiceTestName + `" + } + + // the new resources we wanna update the assignment to + resource "uxi_group" "my_group_2" { + name = "` + group2Name + `" + } + + // the assignment update, updated from service_test/group to service_test/group_2 + resource "uxi_service_test_group_assignment" "my_service_test_group_assignment" { + service_test_id = uxi_service_test.my_service_test.id + group_id = uxi_group.my_group_2.id + }`, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr( + "uxi_service_test_group_assignment.my_service_test_group_assignment", + "service_test_id", + config.ServiceTestUid, + ), + resource.TestCheckResourceAttrWith( + "uxi_service_test_group_assignment.my_service_test_group_assignment", + "group_id", + func(value string) error { + st.Assert(t, value, util.GetGroupByName(group2Name).Id) + return nil + }, + ), + ), + }, + // Remove serviceTests from state + { + Config: provider.ProviderConfig + ` + removed { + from = uxi_service_test.my_service_test + + lifecycle { + destroy = false + } + }`, + }, + }, + }) +} diff --git a/test/live/resources/wired_network_test.go b/test/live/resources/wired_network_test.go index db148dd8..f2dc750c 100644 --- a/test/live/resources/wired_network_test.go +++ b/test/live/resources/wired_network_test.go @@ -1,8 +1,8 @@ package resource_test import ( - "github.com/aruba-uxi/terraform-provider-configuration/test/live/config" - "github.com/aruba-uxi/terraform-provider-configuration/test/live/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/config" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/provider" "regexp" "testing" diff --git a/test/live/resources/wireless_network_test.go b/test/live/resources/wireless_network_test.go index 7470d01c..064977d2 100644 --- a/test/live/resources/wireless_network_test.go +++ b/test/live/resources/wireless_network_test.go @@ -1,8 +1,8 @@ package resource_test import ( - "github.com/aruba-uxi/terraform-provider-configuration/test/live/config" - "github.com/aruba-uxi/terraform-provider-configuration/test/live/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/config" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/live/provider" "regexp" "testing" diff --git a/test/live/util/util.go b/test/live/util/util.go index e866b77a..a406b981 100644 --- a/test/live/util/util.go +++ b/test/live/util/util.go @@ -4,8 +4,8 @@ import ( "context" "os" - "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - resources_util "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/util" + resources_util "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "golang.org/x/oauth2" "golang.org/x/oauth2/clientcredentials" ) diff --git a/test/mocked/data-sources/agent_group_assignment_test.go b/test/mocked/data-sources/agent_group_assignment_test.go index 3f686523..70af710c 100644 --- a/test/mocked/data-sources/agent_group_assignment_test.go +++ b/test/mocked/data-sources/agent_group_assignment_test.go @@ -4,8 +4,8 @@ import ( "regexp" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "github.com/h2non/gock" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" diff --git a/test/mocked/data-sources/agent_test.go b/test/mocked/data-sources/agent_test.go index 062cd6b0..4a0b7e6c 100644 --- a/test/mocked/data-sources/agent_test.go +++ b/test/mocked/data-sources/agent_test.go @@ -4,8 +4,8 @@ import ( "regexp" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "github.com/h2non/gock" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -39,6 +39,25 @@ func TestAgentDataSource(t *testing.T) { `, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("data.uxi_agent.my_agent", "id", "uid"), + resource.TestCheckResourceAttr("data.uxi_agent.my_agent", "name", "name"), + resource.TestCheckResourceAttr("data.uxi_agent.my_agent", "serial", "serial"), + resource.TestCheckResourceAttr( + "data.uxi_agent.my_agent", + "model_number", + "model_number", + ), + resource.TestCheckResourceAttr( + "data.uxi_agent.my_agent", + "wifi_mac_address", + "wifi_mac_address", + ), + resource.TestCheckResourceAttr( + "data.uxi_agent.my_agent", + "ethernet_mac_address", + "ethernet_mac_address", + ), + resource.TestCheckResourceAttr("data.uxi_agent.my_agent", "notes", "notes"), + resource.TestCheckResourceAttr("data.uxi_agent.my_agent", "pcap_mode", "light"), ), }, }, diff --git a/test/mocked/data-sources/group_test.go b/test/mocked/data-sources/group_test.go index 650c0a8b..65e2bd19 100644 --- a/test/mocked/data-sources/group_test.go +++ b/test/mocked/data-sources/group_test.go @@ -1,12 +1,12 @@ package data_source_test import ( - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" "regexp" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "github.com/h2non/gock" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" diff --git a/test/mocked/data-sources/network_group_assignment_test.go b/test/mocked/data-sources/network_group_assignment_test.go index 9cfe3f17..967e4471 100644 --- a/test/mocked/data-sources/network_group_assignment_test.go +++ b/test/mocked/data-sources/network_group_assignment_test.go @@ -4,8 +4,8 @@ import ( "regexp" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "github.com/h2non/gock" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" diff --git a/test/mocked/data-sources/sensor_group_assignment_test.go b/test/mocked/data-sources/sensor_group_assignment_test.go index b3a5212b..677b01e9 100644 --- a/test/mocked/data-sources/sensor_group_assignment_test.go +++ b/test/mocked/data-sources/sensor_group_assignment_test.go @@ -4,8 +4,8 @@ import ( "regexp" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "github.com/h2non/gock" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" diff --git a/test/mocked/data-sources/sensor_test.go b/test/mocked/data-sources/sensor_test.go index 4c2e0f0c..ac6dd0c9 100644 --- a/test/mocked/data-sources/sensor_test.go +++ b/test/mocked/data-sources/sensor_test.go @@ -4,8 +4,8 @@ import ( "regexp" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "github.com/h2non/gock" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -39,6 +39,36 @@ func TestSensorDataSource(t *testing.T) { `, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("data.uxi_sensor.my_sensor", "id", "uid"), + resource.TestCheckResourceAttr("data.uxi_sensor.my_sensor", "name", "name"), + resource.TestCheckResourceAttr("data.uxi_sensor.my_sensor", "serial", "serial"), + resource.TestCheckResourceAttr( + "data.uxi_sensor.my_sensor", + "model_number", + "model_number", + ), + resource.TestCheckResourceAttr( + "data.uxi_sensor.my_sensor", + "wifi_mac_address", + "wifi_mac_address", + ), + resource.TestCheckResourceAttr( + "data.uxi_sensor.my_sensor", + "ethernet_mac_address", + "ethernet_mac_address", + ), + resource.TestCheckResourceAttr( + "data.uxi_sensor.my_sensor", + "address_note", + "address_note", + ), + resource.TestCheckResourceAttr("data.uxi_sensor.my_sensor", "latitude", "0"), + resource.TestCheckResourceAttr("data.uxi_sensor.my_sensor", "longitude", "0"), + resource.TestCheckResourceAttr("data.uxi_sensor.my_sensor", "notes", "notes"), + resource.TestCheckResourceAttr( + "data.uxi_sensor.my_sensor", + "pcap_mode", + "light", + ), ), }, }, diff --git a/test/mocked/data-sources/service_test.go b/test/mocked/data-sources/service_test.go index 8af308ba..e42551e8 100644 --- a/test/mocked/data-sources/service_test.go +++ b/test/mocked/data-sources/service_test.go @@ -4,8 +4,8 @@ import ( "regexp" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "github.com/h2non/gock" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" diff --git a/test/mocked/data-sources/service_test_group_assignment_test.go b/test/mocked/data-sources/service_test_group_assignment_test.go new file mode 100644 index 00000000..6c1b59da --- /dev/null +++ b/test/mocked/data-sources/service_test_group_assignment_test.go @@ -0,0 +1,165 @@ +package data_source_test + +import ( + "regexp" + "testing" + + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" + "github.com/h2non/gock" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/nbio/st" +) + +func TestServiceTestGroupAssignmentDataSource(t *testing.T) { + defer gock.Off() + mockOAuth := util.MockOAuth() + + resource.Test(t, resource.TestCase{ + ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Read testing + { + PreConfig: func() { + util.MockGetServiceTestGroupAssignment( + "uid", + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateServiceTestGroupAssignmentResponse("uid", ""), + }, + ), + 3, + ) + }, + Config: provider.ProviderConfig + ` + data "uxi_service_test_group_assignment" "my_service_test_group_assignment" { + filter = { + service_test_group_assignment_id = "uid" + } + } + `, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr( + "data.uxi_service_test_group_assignment.my_service_test_group_assignment", + "id", + "uid", + ), + resource.TestCheckResourceAttr( + "data.uxi_service_test_group_assignment.my_service_test_group_assignment", + "group_id", + "group_uid", + ), + resource.TestCheckResourceAttr( + "data.uxi_service_test_group_assignment.my_service_test_group_assignment", + "service_test_id", + "service_test_uid", + ), + ), + }, + }, + }) + + mockOAuth.Mock.Disable() +} + +func TestServiceTestGroupAssignmentDataSource429Handling(t *testing.T) { + defer gock.Off() + mockOAuth := util.MockOAuth() + var mock429 *gock.Response + + resource.Test(t, resource.TestCase{ + ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Read testing + { + PreConfig: func() { + mock429 = gock.New("https://test.api.capenetworks.com"). + Get("/networking-uxi/v1alpha1/service-test-group-assignments"). + Reply(429). + SetHeaders(util.RateLimitingHeaders) + util.MockGetServiceTestGroupAssignment( + "uid", + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateServiceTestGroupAssignmentResponse("uid", ""), + }, + ), + 3, + ) + }, + Config: provider.ProviderConfig + ` + data "uxi_service_test_group_assignment" "my_service_test_group_assignment" { + filter = { + service_test_group_assignment_id = "uid" + } + } + `, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr( + "data.uxi_service_test_group_assignment.my_service_test_group_assignment", + "id", + "uid", + ), + func(s *terraform.State) error { + st.Assert(t, mock429.Mock.Request().Counter, 0) + return nil + }, + ), + }, + }, + }) + + mockOAuth.Mock.Disable() +} +func TestServiceTestGroupAssignmentDataSourceHttpErrorHandling(t *testing.T) { + defer gock.Off() + mockOAuth := util.MockOAuth() + resource.Test(t, resource.TestCase{ + ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + PreConfig: func() { + gock.New("https://test.api.capenetworks.com"). + Get("/networking-uxi/v1alpha1/service-test-group-assignments"). + Reply(500). + JSON(map[string]interface{}{ + "httpStatusCode": 500, + "errorCode": "HPE_GL_ERROR_INTERNAL_SERVER_ERROR", + "message": "Current request cannot be processed due to unknown issue", + "debugId": "12312-123123-123123-1231212", + }) + }, + Config: provider.ProviderConfig + ` + data "uxi_service_test_group_assignment" "my_service_test_group_assignment" { + filter = { + service_test_group_assignment_id = "uid" + } + } + `, + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), + }, + { + PreConfig: func() { + util.MockGetServiceTestGroupAssignment( + "uid", + util.GeneratePaginatedResponse([]map[string]interface{}{}), + 1, + ) + }, + Config: provider.ProviderConfig + ` + data "uxi_service_test_group_assignment" "my_service_test_group_assignment" { + filter = { + service_test_group_assignment_id = "uid" + } + } + `, + ExpectError: regexp.MustCompile(`Could not find specified data source`), + }, + }, + }) + + mockOAuth.Mock.Disable() +} diff --git a/test/mocked/data-sources/wired_network_test.go b/test/mocked/data-sources/wired_network_test.go index 8b7c7661..f8d29a29 100644 --- a/test/mocked/data-sources/wired_network_test.go +++ b/test/mocked/data-sources/wired_network_test.go @@ -4,8 +4,8 @@ import ( "regexp" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "github.com/nbio/st" "github.com/h2non/gock" diff --git a/test/mocked/data-sources/wireless_network_test.go b/test/mocked/data-sources/wireless_network_test.go index e89e3f7d..8c652888 100644 --- a/test/mocked/data-sources/wireless_network_test.go +++ b/test/mocked/data-sources/wireless_network_test.go @@ -4,8 +4,8 @@ import ( "regexp" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "github.com/nbio/st" "github.com/h2non/gock" diff --git a/test/mocked/provider/provider.go b/test/mocked/provider/provider.go index b8c5cd1b..deacb4bb 100644 --- a/test/mocked/provider/provider.go +++ b/test/mocked/provider/provider.go @@ -1,7 +1,7 @@ package provider import ( - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider" "github.com/hashicorp/terraform-plugin-framework/providerserver" "github.com/hashicorp/terraform-plugin-go/tfprotov6" ) diff --git a/test/mocked/resources/agent_group_assignment_test.go b/test/mocked/resources/agent_group_assignment_test.go index 9438f272..bba5316f 100644 --- a/test/mocked/resources/agent_group_assignment_test.go +++ b/test/mocked/resources/agent_group_assignment_test.go @@ -1,11 +1,10 @@ package resource_test import ( - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/resources" "github.com/h2non/gock" "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) @@ -50,13 +49,11 @@ func TestAgentGroupAssignmentResource(t *testing.T) { ) // required for agent group assignment create - agentGroupAssignmentResponse := util.GenerateAgentGroupAssignmentResponseMockedModel( - "agent_group_assignment_uid", - "", + util.MockPostAgentGroupAssignment( + util.GenerateAgentGroupAssignmentRequest("agent_group_assignment_uid", ""), + util.GenerateAgentGroupAssignmentResponse("agent_group_assignment_uid", ""), + 1, ) - resources.CreateAgentGroupAssignment = func(request resources.AgentGroupAssignmentRequestModel) resources.AgentGroupAssignmentResponseModel { - return agentGroupAssignmentResponse - } util.MockGetAgentGroupAssignment( "agent_group_assignment_uid", util.GeneratePaginatedResponse( @@ -204,12 +201,17 @@ func TestAgentGroupAssignmentResource(t *testing.T) { ), 1, ) - resources.CreateAgentGroupAssignment = func(request resources.AgentGroupAssignmentRequestModel) resources.AgentGroupAssignmentResponseModel { - return util.GenerateAgentGroupAssignmentResponseMockedModel( + util.MockPostAgentGroupAssignment( + util.GenerateAgentGroupAssignmentRequest( "agent_group_assignment_uid_2", "_2", - ) - } + ), + util.GenerateAgentGroupAssignmentResponse( + "agent_group_assignment_uid_2", + "_2", + ), + 1, + ) }, Config: provider.ProviderConfig + ` // the original resources diff --git a/test/mocked/resources/agent_test.go b/test/mocked/resources/agent_test.go index 83e1cb3e..9d8e8c6c 100644 --- a/test/mocked/resources/agent_test.go +++ b/test/mocked/resources/agent_test.go @@ -4,9 +4,9 @@ import ( "regexp" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/resources" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/resources" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "github.com/h2non/gock" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" diff --git a/test/mocked/resources/group_test.go b/test/mocked/resources/group_test.go index e2200451..b34aaa42 100644 --- a/test/mocked/resources/group_test.go +++ b/test/mocked/resources/group_test.go @@ -4,9 +4,9 @@ import ( "regexp" "testing" - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + config_api_client "github.com/aruba-uxi/terraform-provider-hpeuxi/pkg/config-api-client" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "github.com/h2non/gock" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" diff --git a/test/mocked/resources/network_group_assignment_test.go b/test/mocked/resources/network_group_assignment_test.go index b5aa2ef0..b02009a5 100644 --- a/test/mocked/resources/network_group_assignment_test.go +++ b/test/mocked/resources/network_group_assignment_test.go @@ -4,8 +4,8 @@ import ( "regexp" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "github.com/h2non/gock" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" diff --git a/test/mocked/resources/sensor_group_assignment_test.go b/test/mocked/resources/sensor_group_assignment_test.go index 216b5f04..5c68b48b 100644 --- a/test/mocked/resources/sensor_group_assignment_test.go +++ b/test/mocked/resources/sensor_group_assignment_test.go @@ -4,8 +4,8 @@ import ( "regexp" "testing" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "github.com/h2non/gock" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" diff --git a/test/mocked/resources/sensor_test.go b/test/mocked/resources/sensor_test.go index ba90ae16..be19671d 100644 --- a/test/mocked/resources/sensor_test.go +++ b/test/mocked/resources/sensor_test.go @@ -1,9 +1,9 @@ package resource_test import ( - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/resources" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/resources" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "regexp" "testing" diff --git a/test/mocked/resources/service_test.go b/test/mocked/resources/service_test.go index bc71b385..6dfea62e 100644 --- a/test/mocked/resources/service_test.go +++ b/test/mocked/resources/service_test.go @@ -1,8 +1,8 @@ package resource_test import ( - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "regexp" "testing" diff --git a/test/mocked/resources/service_test_group_assignment_test.go b/test/mocked/resources/service_test_group_assignment_test.go index 9db90da5..86706683 100644 --- a/test/mocked/resources/service_test_group_assignment_test.go +++ b/test/mocked/resources/service_test_group_assignment_test.go @@ -4,11 +4,9 @@ import ( "regexp" "testing" - config_api_client "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/resources" "github.com/h2non/gock" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -38,9 +36,7 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) { // required for group create util.MockPostGroup( util.GenerateGroupRequestModel("group_uid", "", ""), - util.StructToMap( - util.GenerateNonRootGroupResponseModel("group_uid", "", ""), - ), + util.GenerateNonRootGroupResponseModel("group_uid", "", ""), 1, ) util.MockGetGroup( @@ -58,20 +54,21 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) { "service_test_group_assignment_uid", "", ), - util.StructToMap( + util.GenerateServiceTestGroupAssignmentResponse( + "service_test_group_assignment_uid", + "", + ), + 1, + ) + util.MockGetServiceTestGroupAssignment( + "service_test_group_assignment_uid", + util.GeneratePaginatedResponse([]map[string]interface{}{ util.GenerateServiceTestGroupAssignmentResponse( - "service_test_group_assignment_uid", - "", - ), + "service_test_group_assignment_uid", "", + )}, ), 1, ) - resources.GetServiceTestGroupAssignment = func(uid string) config_api_client.ServiceTestGroupAssignmentsPostResponse { - return util.GenerateServiceTestGroupAssignmentResponse( - "service_test_group_assignment_uid", - "", - ) - } }, Config: provider.ProviderConfig + ` @@ -113,6 +110,17 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) { }, // ImportState testing { + PreConfig: func() { + util.MockGetServiceTestGroupAssignment( + "service_test_group_assignment_uid", + util.GeneratePaginatedResponse([]map[string]interface{}{ + util.GenerateServiceTestGroupAssignmentResponse( + "service_test_group_assignment_uid", "", + )}, + ), + 1, + ) + }, ResourceName: "uxi_service_test_group_assignment.my_service_test_group_assignment", ImportState: true, ImportStateVerify: true, @@ -163,33 +171,37 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) { // required for creating another group util.MockPostGroup( util.GenerateGroupRequestModel("group_uid_2", "_2", "_2"), - util.StructToMap( - util.GenerateNonRootGroupResponseModel("group_uid_2", "_2", "_2"), - ), + util.GenerateNonRootGroupResponseModel("group_uid_2", "_2", "_2"), 1, ) // required for serviceTest group assignment create - resources.GetServiceTestGroupAssignment = func(uid string) config_api_client.ServiceTestGroupAssignmentsPostResponse { - if uid == "service_test_group_assignment_uid" { - return util.GenerateServiceTestGroupAssignmentResponse( - "service_test_group_assignment_uid", - "", - ) - } else { - return util.GenerateServiceTestGroupAssignmentResponse("service_test_group_assignment_uid_2", "_2") - } - } + util.MockGetServiceTestGroupAssignment( + "service_test_group_assignment_uid_2", + util.GeneratePaginatedResponse([]map[string]interface{}{ + util.GenerateServiceTestGroupAssignmentResponse( + "service_test_group_assignment_uid_2", "_2", + )}, + ), + 2, + ) + util.MockGetServiceTestGroupAssignment( + "service_test_group_assignment_uid", + util.GeneratePaginatedResponse([]map[string]interface{}{ + util.GenerateServiceTestGroupAssignmentResponse( + "service_test_group_assignment_uid", "", + )}, + ), + 1, + ) util.MockPostServiceTestGroupAssignment( util.GenerateServiceTestGroupAssignmentRequest( "service_test_group_assignment_uid_2", "_2", ), - util.StructToMap( - util.GenerateServiceTestGroupAssignmentResponse( - "service_test_group_assignment_uid_2", - "_2", - ), + util.GenerateServiceTestGroupAssignmentResponse( + "service_test_group_assignment_uid_2", + "_2", ), 1, ) @@ -325,9 +337,7 @@ func TestServiceTestGroupAssignmentResource429Handling(t *testing.T) { // required for group create util.MockPostGroup( util.GenerateGroupRequestModel("group_uid", "", ""), - util.StructToMap( - util.GenerateNonRootGroupResponseModel("group_uid", "", ""), - ), + util.GenerateNonRootGroupResponseModel("group_uid", "", ""), 1, ) util.MockGetGroup( @@ -351,20 +361,21 @@ func TestServiceTestGroupAssignmentResource429Handling(t *testing.T) { "service_test_group_assignment_uid", "", ), - util.StructToMap( + util.GenerateServiceTestGroupAssignmentResponse( + "service_test_group_assignment_uid", + "", + ), + 1, + ) + util.MockGetServiceTestGroupAssignment( + "service_test_group_assignment_uid", + util.GeneratePaginatedResponse([]map[string]interface{}{ util.GenerateServiceTestGroupAssignmentResponse( - "service_test_group_assignment_uid", - "", - ), + "service_test_group_assignment_uid", "", + )}, ), 1, ) - resources.GetServiceTestGroupAssignment = func(uid string) config_api_client.ServiceTestGroupAssignmentsPostResponse { - return util.GenerateServiceTestGroupAssignmentResponse( - "service_test_group_assignment_uid", - "", - ) - } }, Config: provider.ProviderConfig + ` @@ -410,9 +421,21 @@ func TestServiceTestGroupAssignmentResource429Handling(t *testing.T) { ), 1, ) + util.MockGetServiceTestGroupAssignment( + "service_test_group_assignment_uid", + util.GeneratePaginatedResponse([]map[string]interface{}{ + util.GenerateServiceTestGroupAssignmentResponse( + "service_test_group_assignment_uid", "", + )}, + ), + 1, + ) util.MockDeleteGroup("group_uid", 1) - util.MockDeleteServiceTestGroupAssignment("service_test_group_assignment", 1) + util.MockDeleteServiceTestGroupAssignment( + "service_test_group_assignment_uid", + 1, + ) }, Config: provider.ProviderConfig + ` removed { @@ -453,9 +476,7 @@ func TestServiceTestGroupAssignmentResourceHttpErrorHandling(t *testing.T) { // required for group create util.MockPostGroup( util.GenerateGroupRequestModel("group_uid", "", ""), - util.StructToMap( - util.GenerateNonRootGroupResponseModel("group_uid", "", ""), - ), + util.GenerateNonRootGroupResponseModel("group_uid", "", ""), 1, ) util.MockGetGroup( diff --git a/test/mocked/resources/wired_network_test.go b/test/mocked/resources/wired_network_test.go index 35231125..5422f29f 100644 --- a/test/mocked/resources/wired_network_test.go +++ b/test/mocked/resources/wired_network_test.go @@ -1,8 +1,8 @@ package resource_test import ( - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "regexp" "testing" diff --git a/test/mocked/resources/wireless_network_test.go b/test/mocked/resources/wireless_network_test.go index a803aaf9..6b5e8cd5 100644 --- a/test/mocked/resources/wireless_network_test.go +++ b/test/mocked/resources/wireless_network_test.go @@ -1,8 +1,8 @@ package resource_test import ( - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/provider" - "github.com/aruba-uxi/terraform-provider-configuration/test/mocked/util" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/provider" + "github.com/aruba-uxi/terraform-provider-hpeuxi/test/mocked/util" "regexp" "testing" diff --git a/test/mocked/util/utils.go b/test/mocked/util/utils.go index 6bcb7a2e..5efb754b 100644 --- a/test/mocked/util/utils.go +++ b/test/mocked/util/utils.go @@ -2,9 +2,8 @@ package util import ( "encoding/json" - "github.com/aruba-uxi/terraform-provider-configuration-api/pkg/config-api-client" - "github.com/aruba-uxi/terraform-provider-configuration/internal/provider/resources" + "github.com/aruba-uxi/terraform-provider-hpeuxi/internal/provider/resources" "github.com/h2non/gock" ) @@ -170,6 +169,13 @@ func GenerateSensorGroupAssignmentRequest(uid string, postfix string) map[string } } +func GenerateAgentGroupAssignmentRequest(uid string, postfix string) map[string]interface{} { + return map[string]interface{}{ + "groupId": "group_uid" + postfix, + "agentId": "agent_uid" + postfix, + } +} + func GenerateAgentGroupAssignmentResponse(uid string, postfix string) map[string]interface{} { return map[string]interface{}{ "id": uid, @@ -206,15 +212,12 @@ func GenerateNetworkGroupAssignmentRequest(uid string, postfix string) map[strin } } -func GenerateServiceTestGroupAssignmentResponse( - uid string, - postfix string, -) config_api_client.ServiceTestGroupAssignmentsPostResponse { - return config_api_client.ServiceTestGroupAssignmentsPostResponse{ - Id: uid, - Group: *config_api_client.NewGroup("group_uid" + postfix), - ServiceTest: *config_api_client.NewServiceTest("service_test_uid" + postfix), - Type: "networking-uxi/service-test-group-assignment", +func GenerateServiceTestGroupAssignmentResponse(uid string, postfix string) map[string]interface{} { + return map[string]interface{}{ + "id": uid, + "group": map[string]string{"id": "group_uid" + postfix}, + "serviceTest": map[string]string{"id": "service_test_uid" + postfix}, + "type": "networking-uxi/service-test-group-assignment", } } @@ -363,6 +366,21 @@ func MockGetAgentGroupAssignment(uid string, response map[string]interface{}, ti JSON(response) } +func MockPostAgentGroupAssignment( + request map[string]interface{}, + response map[string]interface{}, + times int, +) { + gock.New("https://test.api.capenetworks.com"). + Post("/networking-uxi/v1alpha1/agent-group-assignments"). + MatchHeader("Content-Type", "application/json"). + MatchHeader("Authorization", "mock_token"). + Times(times). + JSON(request). + Reply(200). + JSON(response) +} + func MockGetSensorGroupAssignment(uid string, response map[string]interface{}, times int) { gock.New("https://test.api.capenetworks.com"). Get("/networking-uxi/v1alpha1/sensor-group-assignments"). @@ -429,6 +447,16 @@ func MockDeleteNetworkGroupAssignment(uid string, times int) { Reply(204) } +func MockGetServiceTestGroupAssignment(uid string, response map[string]interface{}, times int) { + gock.New("https://test.api.capenetworks.com"). + Get("/networking-uxi/v1alpha1/service-test-group-assignments"). + MatchHeader("Authorization", "mock_token"). + MatchParam("id", uid). + Times(times). + Reply(200). + JSON(response) +} + func MockPostServiceTestGroupAssignment( request map[string]interface{}, response map[string]interface{},