Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pkg/apic/apiserver/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ func TestAPIServiceMarshal(t *testing.T) {
Type: v1.TeamOwner,
ID: "233",
},
Samplestate: m.ApiServiceSamplestate{
DisabledUntil: getTimestamp(),
},
Spec: m.ApiServiceSpec{
Description: "desc",
Icon: m.ApiServiceSpecIcon{
Expand Down Expand Up @@ -104,6 +107,9 @@ func TestAPIServiceMarshalNoOwner(t *testing.T) {
},
},
},
Samplestate: m.ApiServiceSamplestate{
DisabledUntil: getTimestamp(),
},
Spec: m.ApiServiceSpec{
Description: "desc",
},
Expand Down Expand Up @@ -174,12 +180,19 @@ func TestAPIServiceAsInstance(t *testing.T) {
},
},
"references": map[string]interface{}{},
"samplestate": map[string]interface{}{
"disabledUntil": time.Time(newTime).Format(v1.APIServerTimeFormat),
},
"sampletrigger": map[string]interface{}{},
},
},
Owner: &v1.Owner{
Type: v1.TeamOwner,
ID: "233",
},
Samplestate: m.ApiServiceSamplestate{
DisabledUntil: newTime,
},
Spec: m.ApiServiceSpec{
Description: "desc",
Icon: m.ApiServiceSpecIcon{
Expand Down Expand Up @@ -259,6 +272,9 @@ func TestAPIServiceFromInstance(t *testing.T) {
Type: v1.TeamOwner,
ID: "233",
},
Samplestate: m.ApiServiceSamplestate{
DisabledUntil: getTimestamp(),
},
Spec: m.ApiServiceSpec{
Description: "desc",
Icon: m.ApiServiceSpecIcon{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ type AssetRequestMarketplaceResourceOwner struct {
// Id of the owner of the resource.
Id string `json:"id,omitempty"`
Organization AssetRequestMarketplaceResourceOwnerOrganization `json:"organization"`
User AssetRequestMarketplaceResourceOwnerUser `json:"user,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* API Server specification.
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: SNAPSHOT
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

package catalog

// AssetRequestMarketplaceResourceOwnerUser User Id. (catalog.v1alpha1.AssetRequest)
type AssetRequestMarketplaceResourceOwnerUser struct {
// Id of the user as an owner.
Id string `json:"id,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ type SubscriptionMarketplaceResourceOwner struct {
// Id of the owner of the resource.
Id string `json:"id,omitempty"`
Organization SubscriptionMarketplaceResourceOwnerOrganization `json:"organization"`
User SubscriptionMarketplaceResourceOwnerUser `json:"user,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* API Server specification.
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: SNAPSHOT
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

package catalog

// SubscriptionMarketplaceResourceOwnerUser Id of the user. If field is populated, owner is an user. (catalog.v1alpha1.Subscription)
type SubscriptionMarketplaceResourceOwnerUser struct {
// Id of the user.
Id string `json:"id,omitempty"`
}
44 changes: 39 additions & 5 deletions pkg/apic/apiserver/models/management/v1alpha1/APIService.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const (
ApiServiceDetailsSubResourceName = "details"
ApiServiceProfileSubResourceName = "profile"
ApiServiceReferencesSubResourceName = "references"
ApiServiceSamplestateSubResourceName = "samplestate"
ApiServiceSampletriggerSubResourceName = "sampletrigger"
ApiServiceSourceSubResourceName = "source"
ApiServiceStatusSubResourceName = "status"
)
Expand All @@ -61,19 +63,21 @@ type APIService struct {
Appinfo *ApiServiceAppinfo `json:"appinfo,omitempty"`
// GENERATE: The following code has been modified after code generation
//
// Compliance ApiServiceCompliance `json:"compliance"`
// Compliance ApiServiceCompliance `json:"compliance"`
Compliance *ApiServiceCompliance `json:"compliance,omitempty"`
Complianceruntimeresult interface{} `json:"complianceruntimeresult"`
Details ApiServiceDetails `json:"details"`
Owner *apiv1.Owner `json:"owner"`
// GENERATE: The following code has been modified after code generation
//
// Profile ApiServiceProfile `json:"profile"`
Profile *ApiServiceProfile `json:"profile,omitempty"`
References ApiServiceReferences `json:"references"`
// Profile ApiServiceProfile `json:"profile"`
Profile *ApiServiceProfile `json:"profile,omitempty"`
References ApiServiceReferences `json:"references"`
Samplestate ApiServiceSamplestate `json:"samplestate"`
Sampletrigger ApiServiceSampletrigger `json:"sampletrigger"`
// GENERATE: The following code has been modified after code generation
//
// Source ApiServiceSource `json:"source"`
// Source ApiServiceSource `json:"source"`
Source *ApiServiceSource `json:"source,omitempty"`
Spec ApiServiceSpec `json:"spec"`
// Status ApiServiceStatus `json:"status"`
Expand Down Expand Up @@ -188,6 +192,8 @@ func (res *APIService) MarshalJSON() ([]byte, error) {
out["owner"] = res.Owner
out["profile"] = res.Profile
out["references"] = res.References
out["samplestate"] = res.Samplestate
out["sampletrigger"] = res.Sampletrigger
out["source"] = res.Source
out["spec"] = res.Spec
out["status"] = res.Status
Expand Down Expand Up @@ -318,6 +324,34 @@ func (res *APIService) UnmarshalJSON(data []byte) error {
}
}

// marshalling subresource Samplestate
if v, ok := aux.SubResources["samplestate"]; ok {
sr, err = json.Marshal(v)
if err != nil {
return err
}

delete(aux.SubResources, "samplestate")
err = json.Unmarshal(sr, &res.Samplestate)
if err != nil {
return err
}
}

// marshalling subresource Sampletrigger
if v, ok := aux.SubResources["sampletrigger"]; ok {
sr, err = json.Marshal(v)
if err != nil {
return err
}

delete(aux.SubResources, "sampletrigger")
err = json.Unmarshal(sr, &res.Sampletrigger)
if err != nil {
return err
}
}

// marshalling subresource Source
if v, ok := aux.SubResources["source"]; ok {
sr, err = json.Marshal(v)
Expand Down
17 changes: 17 additions & 0 deletions pkg/apic/apiserver/models/management/v1alpha1/Environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (
EnvironmentCompliancetasksSubResourceName = "compliancetasks"
EnvironmentPoliciesSubResourceName = "policies"
EnvironmentReferencesSubResourceName = "references"
EnvironmentSampletriggerSubResourceName = "sampletrigger"
EnvironmentStagesSubResourceName = "stages"
EnvironmentTraceableSubResourceName = "traceable"
)
Expand All @@ -53,6 +54,7 @@ type Environment struct {
Owner *apiv1.Owner `json:"owner"`
Policies EnvironmentPolicies `json:"policies"`
References EnvironmentReferences `json:"references"`
Sampletrigger EnvironmentSampletrigger `json:"sampletrigger"`
Spec EnvironmentSpec `json:"spec"`
Stages EnvironmentStages `json:"stages"`
// GENERATE: The following code has been modified after code generation
Expand Down Expand Up @@ -160,6 +162,7 @@ func (res *Environment) MarshalJSON() ([]byte, error) {
out["owner"] = res.Owner
out["policies"] = res.Policies
out["references"] = res.References
out["sampletrigger"] = res.Sampletrigger
out["spec"] = res.Spec
out["stages"] = res.Stages
out["traceable"] = res.Traceable
Expand Down Expand Up @@ -248,6 +251,20 @@ func (res *Environment) UnmarshalJSON(data []byte) error {
}
}

// marshalling subresource Sampletrigger
if v, ok := aux.SubResources["sampletrigger"]; ok {
sr, err = json.Marshal(v)
if err != nil {
return err
}

delete(aux.SubResources, "sampletrigger")
err = json.Unmarshal(sr, &res.Sampletrigger)
if err != nil {
return err
}
}

// marshalling subresource Stages
if v, ok := aux.SubResources["stages"]; ok {
sr, err = json.Marshal(v)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* API Server specification.
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: SNAPSHOT
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

package management

import (
// GENERATE: The following code has been modified after code generation
//
// "time"
time "github.com/Axway/agent-sdk/pkg/apic/apiserver/models/api/v1"
)

// ApiServiceSamplestate (management.v1alpha1.APIService)
type ApiServiceSamplestate struct {
// The time in which sampling may be requested for this api service again in ISO 8601 format with numeric timezone offset
DisabledUntil time.Time `json:"disabledUntil,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* API Server specification.
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: SNAPSHOT
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

package management

// ApiServiceSampletrigger (management.v1alpha1.APIService)
type ApiServiceSampletrigger struct {
// Set to true if sampling is requested
Requested bool `json:"requested,omitempty"`
// Set to true to request sampling only errors
OnlyErrors bool `json:"onlyErrors,omitempty"`
// The duration in seconds for which sampling is requested.
Duration int32 `json:"duration,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* API Server specification.
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: SNAPSHOT
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

package management

import (
// GENERATE: The following code has been modified after code generation
//
// "time"
time "github.com/Axway/agent-sdk/pkg/apic/apiserver/models/api/v1"
)

// EnvironmentSampletrigger (management.v1alpha1.Environment)
type EnvironmentSampletrigger struct {
// Set to true to request that sampling for this environment is started for the duration selected
Requested bool `json:"requested,omitempty"`
// The duration, in seconds, for which the agents in the environment will sample if the request is approved
Duration int32 `json:"duration,omitempty"`
// The time after which the sampling can be triggered again in ISO 8601 format with numeric timezone offset
DisabledUntil time.Time `json:"disabledUntil,omitempty"`
}