diff --git a/enterpriseusagereportsv1/enterprise_usage_reports_v1.go b/enterpriseusagereportsv1/enterprise_usage_reports_v1.go index 1e852f40..7cbfed67 100644 --- a/enterpriseusagereportsv1/enterprise_usage_reports_v1.go +++ b/enterpriseusagereportsv1/enterprise_usage_reports_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-8d569e8f-20201101-090040 + * IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-629bbb97-20201207-171303 */ @@ -108,6 +108,21 @@ func NewEnterpriseUsageReportsV1(options *EnterpriseUsageReportsV1Options) (serv return } +// GetServiceURLForRegion returns the service URL to be used for the specified region +func GetServiceURLForRegion(region string) (string, error) { + return "", fmt.Errorf("service does not support regional URLs") +} + +// Clone makes a copy of "enterpriseUsageReports" suitable for processing requests. +func (enterpriseUsageReports *EnterpriseUsageReportsV1) Clone() *EnterpriseUsageReportsV1 { + if core.IsNil(enterpriseUsageReports) { + return nil + } + clone := *enterpriseUsageReports + clone.Service = enterpriseUsageReports.Service.Clone() + return &clone +} + // SetServiceURL sets the service URL func (enterpriseUsageReports *EnterpriseUsageReportsV1) SetServiceURL(url string) error { return enterpriseUsageReports.Service.SetServiceURL(url) @@ -555,7 +570,7 @@ type ResourceUsageReport struct { EntityType *string `json:"entity_type" validate:"required"` // The Cloud Resource Name (CRN) of the entity towards which the resource usages were rolled up. - EntityCrn *string `json:"entity_crn" validate:"required"` + EntityCRN *string `json:"entity_crn" validate:"required"` // A user-defined name for the entity, such as the enterprise name or account group name. EntityName *string `json:"entity_name" validate:"required"` @@ -564,7 +579,7 @@ type ResourceUsageReport struct { BillingUnitID *string `json:"billing_unit_id" validate:"required"` // The CRN of the billing unit. - BillingUnitCrn *string `json:"billing_unit_crn" validate:"required"` + BillingUnitCRN *string `json:"billing_unit_crn" validate:"required"` // The name of the billing unit. BillingUnitName *string `json:"billing_unit_name" validate:"required"` @@ -597,9 +612,9 @@ type ResourceUsageReport struct { // Constants associated with the ResourceUsageReport.EntityType property. // The entity type. const ( - ResourceUsageReport_EntityType_Account = "account" - ResourceUsageReport_EntityType_AccountGroup = "account-group" - ResourceUsageReport_EntityType_Enterprise = "enterprise" + ResourceUsageReportEntityTypeAccountConst = "account" + ResourceUsageReportEntityTypeAccountGroupConst = "account-group" + ResourceUsageReportEntityTypeEnterpriseConst = "enterprise" ) @@ -614,7 +629,7 @@ func UnmarshalResourceUsageReport(m map[string]json.RawMessage, result interface if err != nil { return } - err = core.UnmarshalPrimitive(m, "entity_crn", &obj.EntityCrn) + err = core.UnmarshalPrimitive(m, "entity_crn", &obj.EntityCRN) if err != nil { return } @@ -626,7 +641,7 @@ func UnmarshalResourceUsageReport(m map[string]json.RawMessage, result interface if err != nil { return } - err = core.UnmarshalPrimitive(m, "billing_unit_crn", &obj.BillingUnitCrn) + err = core.UnmarshalPrimitive(m, "billing_unit_crn", &obj.BillingUnitCRN) if err != nil { return } diff --git a/enterpriseusagereportsv1/enterprise_usage_reports_v1_test.go b/enterpriseusagereportsv1/enterprise_usage_reports_v1_test.go index 475c7c05..3e79be82 100644 --- a/enterpriseusagereportsv1/enterprise_usage_reports_v1_test.go +++ b/enterpriseusagereportsv1/enterprise_usage_reports_v1_test.go @@ -77,6 +77,12 @@ var _ = Describe(`EnterpriseUsageReportsV1`, func() { Expect(enterpriseUsageReportsService).ToNot(BeNil()) Expect(serviceErr).To(BeNil()) ClearTestEnvironment(testEnvironment) + + clone := enterpriseUsageReportsService.Clone() + Expect(clone).ToNot(BeNil()) + Expect(clone.Service != enterpriseUsageReportsService.Service).To(BeTrue()) + Expect(clone.GetServiceURL()).To(Equal(enterpriseUsageReportsService.GetServiceURL())) + Expect(clone.Service.Options.Authenticator).To(Equal(enterpriseUsageReportsService.Service.Options.Authenticator)) }) It(`Create service client using external config and set url from constructor successfully`, func() { SetTestEnvironment(testEnvironment) @@ -87,6 +93,12 @@ var _ = Describe(`EnterpriseUsageReportsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(enterpriseUsageReportsService.Service.GetServiceURL()).To(Equal("https://testService/api")) ClearTestEnvironment(testEnvironment) + + clone := enterpriseUsageReportsService.Clone() + Expect(clone).ToNot(BeNil()) + Expect(clone.Service != enterpriseUsageReportsService.Service).To(BeTrue()) + Expect(clone.GetServiceURL()).To(Equal(enterpriseUsageReportsService.GetServiceURL())) + Expect(clone.Service.Options.Authenticator).To(Equal(enterpriseUsageReportsService.Service.Options.Authenticator)) }) It(`Create service client using external config and set url programatically successfully`, func() { SetTestEnvironment(testEnvironment) @@ -98,6 +110,12 @@ var _ = Describe(`EnterpriseUsageReportsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(enterpriseUsageReportsService.Service.GetServiceURL()).To(Equal("https://testService/api")) ClearTestEnvironment(testEnvironment) + + clone := enterpriseUsageReportsService.Clone() + Expect(clone).ToNot(BeNil()) + Expect(clone.Service != enterpriseUsageReportsService.Service).To(BeTrue()) + Expect(clone.GetServiceURL()).To(Equal(enterpriseUsageReportsService.GetServiceURL())) + Expect(clone.Service.Options.Authenticator).To(Equal(enterpriseUsageReportsService.Service.Options.Authenticator)) }) }) Context(`Using external config, construct service client instances with error: Invalid Auth`, func() { @@ -135,6 +153,16 @@ var _ = Describe(`EnterpriseUsageReportsV1`, func() { }) }) }) + Describe(`Regional endpoint tests`, func() { + It(`GetServiceURLForRegion(region string)`, func() { + var url string + var err error + url, err = enterpriseusagereportsv1.GetServiceURLForRegion("INVALID_REGION") + Expect(url).To(BeEmpty()) + Expect(err).ToNot(BeNil()) + fmt.Fprintf(GinkgoWriter, "Expected error: %s\n", err.Error()) + }) + }) Describe(`GetResourceUsageReport(getResourceUsageReportOptions *GetResourceUsageReportOptions) - Operation response error`, func() { getResourceUsageReportPath := "/v1/resource-usage-reports" Context(`Using mock server endpoint`, func() {