Skip to content

Commit

Permalink
Edit resource docs and messages
Browse files Browse the repository at this point in the history
  • Loading branch information
misterpantz committed Dec 18, 2024
1 parent 4778115 commit 59267a8
Show file tree
Hide file tree
Showing 32 changed files with 206 additions and 206 deletions.
2 changes: 1 addition & 1 deletion internal/provider/assets_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (d *assetsDataSource) Configure(ctx context.Context, req datasource.Configu
if !ok {
resp.Diagnostics.AddError(
"Unexpected Data Source Configure Type",
fmt.Sprintf("Expected *mondoov1.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData),
fmt.Sprintf("Expected *mondoov1.Client. Got: %T. Please report this issue to the provider developers.", req.ProviderData),
)

return
Expand Down
26 changes: 13 additions & 13 deletions internal/provider/custom_framework_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,25 @@ func (r *customFrameworkResource) getFrameworkContent(data customFrameworkResour

func (r *customFrameworkResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
MarkdownDescription: `Set custom Compliance Frameworks for a Mondoo Space.`,
MarkdownDescription: `Set custom compliance frameworks for a Mondoo space.`,
Attributes: map[string]schema.Attribute{
"space_id": schema.StringAttribute{
MarkdownDescription: "Mondoo Space Identifier. If it is not provided, the provider space is used.",
MarkdownDescription: "Mondoo space identifier. If there's no space ID, the provider space is used.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"mrn": schema.StringAttribute{
MarkdownDescription: "Mondoo Resource Name.",
MarkdownDescription: "Mondoo resource name.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"data_url": schema.StringAttribute{
MarkdownDescription: "URL to the custom Compliance Framework data.",
MarkdownDescription: "URL to the custom compliance framework data.",
Required: true,
},
},
Expand All @@ -109,7 +109,7 @@ func (r *customFrameworkResource) Configure(_ context.Context, req resource.Conf
if !ok {
resp.Diagnostics.AddError(
"Unexpected Resource Configure Type",
fmt.Sprintf("Expected *http.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData),
fmt.Sprintf("Expected *http.Client. Got: %T. Please report this issue to the provider developers.", req.ProviderData),
)

return
Expand Down Expand Up @@ -139,7 +139,7 @@ func (r *customFrameworkResource) Create(ctx context.Context, req resource.Creat
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to get Compliance Framework Content, got error: %s", err),
fmt.Sprintf("Unable to get compliance framework content. Got error: %s", err),
)
return
}
Expand All @@ -150,7 +150,7 @@ func (r *customFrameworkResource) Create(ctx context.Context, req resource.Creat
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to upload Compliance Framework, got error: %s", err),
fmt.Sprintf("Unable to upload compliance framework. Got error: %s", err),
)
return
}
Expand All @@ -159,7 +159,7 @@ func (r *customFrameworkResource) Create(ctx context.Context, req resource.Creat
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to get Compliance Framework, got error: %s", err),
fmt.Sprintf("Unable to get compliance framework. Got error: %s", err),
)
return
}
Expand Down Expand Up @@ -219,7 +219,7 @@ func (r *customFrameworkResource) Update(ctx context.Context, req resource.Updat
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to get Compliance Framework Content, got error: %s", err),
fmt.Sprintf("Unable to get compliance framework content. Got error: %s", err),
)
return
}
Expand All @@ -230,7 +230,7 @@ func (r *customFrameworkResource) Update(ctx context.Context, req resource.Updat
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to upload Compliance Framework, got error: %s", err),
fmt.Sprintf("Unable to upload compliance framework. Got error: %s", err),
)
return
}
Expand All @@ -254,7 +254,7 @@ func (r *customFrameworkResource) Delete(ctx context.Context, req resource.Delet
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to delete Compliance Framework, got error: %s", err),
fmt.Sprintf("Unable to delete compliance framework. Got error: %s", err),
)
return
}
Expand All @@ -274,7 +274,7 @@ func (r *customFrameworkResource) ImportState(ctx context.Context, req resource.
resp.Diagnostics.AddError(
"Conflict Error",
fmt.Sprintf(
"Unable to import integration, the provider is configured in a different space than the resource. (%s != %s)",
"Unable to import integration. The provider is configured in a different space than the resource. (%s != %s)",
r.client.Space().ID(), spaceID),
)
return
Expand All @@ -284,7 +284,7 @@ func (r *customFrameworkResource) ImportState(ctx context.Context, req resource.
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to get Compliance Framework, got error: %s", err),
fmt.Sprintf("Unable to get compliance framework. Got error: %s", err),
)
return
}
Expand Down
14 changes: 7 additions & 7 deletions internal/provider/custom_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (r *customPolicyResource) Schema(ctx context.Context, req resource.SchemaRe
MarkdownDescription: "Custom Policy resource",
Attributes: map[string]schema.Attribute{
"space_id": schema.StringAttribute{
MarkdownDescription: "Mondoo Space Identifier. If it is not provided, the provider space is used.",
MarkdownDescription: "Mondoo space identifier. If there is no space ID, the provider space is used.",
Optional: true,
},
"mrns": schema.ListAttribute{
Expand Down Expand Up @@ -120,7 +120,7 @@ func (r *customPolicyResource) Configure(ctx context.Context, req resource.Confi
resp.Diagnostics.AddError(
"Unexpected Resource Configure Type",
fmt.Sprintf(
"Expected *http.Client, got: %T. Please report this issue to the provider developers.",
"Expected *http.Client. Got: %T. Please report this issue to the provider developers.",
req.ProviderData,
),
)
Expand Down Expand Up @@ -201,7 +201,7 @@ func (r *customPolicyResource) Create(ctx context.Context, req resource.CreateRe
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to store policy, got error: %s", err),
fmt.Sprintf("Unable to store policy. Got error: %s", err),
)
return
}
Expand Down Expand Up @@ -283,7 +283,7 @@ func (r *customPolicyResource) Update(ctx context.Context, req resource.UpdateRe
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to store policy, got error: %s", err),
fmt.Sprintf("Unable to store policy. Got error: %s", err),
)
return
}
Expand Down Expand Up @@ -314,7 +314,7 @@ func (r *customPolicyResource) Delete(ctx context.Context, req resource.DeleteRe
for _, policyMrn := range policyMrns {
err := r.client.DeletePolicy(ctx, policyMrn)
if err != nil {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to delete policy, got error: %s", err))
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to delete policy. Got error: %s", err))
return
}
}
Expand All @@ -337,13 +337,13 @@ func (r *customPolicyResource) ImportState(ctx context.Context, req resource.Imp

policy, err := r.client.GetPolicy(ctx, mrn, SpaceFrom(spaceID).MRN())
if err != nil {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to get policy, got error: %s", err))
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to get policy. Got error: %s", err))
return
}

content, err := r.client.DownloadBundle(ctx, string(policy.Mrn))
if err != nil {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to download bundle, got error: %s", err))
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to download bundle. Got error: %s", err))
return
}

Expand Down
14 changes: 7 additions & 7 deletions internal/provider/custom_querypack.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (r *customQueryPackResource) Schema(_ context.Context, _ resource.SchemaReq
MarkdownDescription: "Custom Query Pack resource",
Attributes: map[string]schema.Attribute{
"space_id": schema.StringAttribute{
MarkdownDescription: "Mondoo Space Identifier. If it is not provided, the provider space is used.",
MarkdownDescription: "Mondoo space identifier. If there is no space ID, the provider space is used.",
Optional: true,
},
"mrns": schema.ListAttribute{
Expand Down Expand Up @@ -118,7 +118,7 @@ func (r *customQueryPackResource) Configure(_ context.Context, req resource.Conf
if !ok {
resp.Diagnostics.AddError(
"Unexpected Resource Configure Type",
fmt.Sprintf("Expected *http.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData),
fmt.Sprintf("Expected *http.Client. Got: %T. Please report this issue to the provider developers.", req.ProviderData),
)

return
Expand Down Expand Up @@ -189,7 +189,7 @@ func (r *customQueryPackResource) Create(ctx context.Context, req resource.Creat
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to store policy, got error: %s", err),
fmt.Sprintf("Unable to store policy. Got error: %s", err),
)
return
}
Expand Down Expand Up @@ -285,7 +285,7 @@ func (r *customQueryPackResource) Update(ctx context.Context, req resource.Updat
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to store policy, got error: %s", err),
fmt.Sprintf("Unable to store policy. Got error: %s", err),
)
return
}
Expand Down Expand Up @@ -318,7 +318,7 @@ func (r *customQueryPackResource) Delete(ctx context.Context, req resource.Delet
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to delete query pack, got error: %s", err),
fmt.Sprintf("Unable to delete query pack. Got error: %s", err),
)
return
}
Expand Down Expand Up @@ -347,7 +347,7 @@ func (r *customQueryPackResource) ImportState(ctx context.Context, req resource.
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to get policy, got error: %s", err),
fmt.Sprintf("Unable to get policy. Got error: %s", err),
)
return
}
Expand All @@ -356,7 +356,7 @@ func (r *customQueryPackResource) ImportState(ctx context.Context, req resource.
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to download bundle, got error: %s", err),
fmt.Sprintf("Unable to download bundle. Got error: %s", err),
)
return
}
Expand Down
8 changes: 4 additions & 4 deletions internal/provider/exception_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func NewValidUntilValidator() validator.String {

func (r *exceptionResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
MarkdownDescription: `Set custom exceptions for a Scope.`,
MarkdownDescription: `Set custom exceptions for a scope.`,
Attributes: map[string]schema.Attribute{
"scope_mrn": schema.StringAttribute{
MarkdownDescription: "The MRN of the scope (either asset mrn or space mrn).",
Expand All @@ -138,7 +138,7 @@ func (r *exceptionResource) Schema(ctx context.Context, req resource.SchemaReque
},
},
"valid_until": schema.StringAttribute{
MarkdownDescription: "The timestamp until the exception is valid.",
MarkdownDescription: "The date when the exception is no longer valid.",
Optional: true,
Validators: []validator.String{
stringvalidator.RegexMatches(regexp.MustCompile(`[1-9][0-9][0-9]{2}-([0][1-9]|[1][0-2])-([1-2][0-9]|[0][1-9]|[3][0-1])`), "Date must be in the format 'YYYY-MM-DD'"),
Expand All @@ -150,7 +150,7 @@ func (r *exceptionResource) Schema(ctx context.Context, req resource.SchemaReque
Optional: true,
},
"action": schema.StringAttribute{
MarkdownDescription: "The action to perform. Default is `SNOOZE`. Other options are `ENABLE`, `DISABLE`, `OUT_OF_SCOPE`.",
MarkdownDescription: "The action to perform. Default is `SNOOZE`. Other options are `ENABLE`, `DISABLE`, and `OUT_OF_SCOPE`.",
Optional: true,
Computed: true,
Default: stringdefault.StaticString("SNOOZE"),
Expand Down Expand Up @@ -195,7 +195,7 @@ func (r *exceptionResource) Configure(ctx context.Context, req resource.Configur
if !ok {
resp.Diagnostics.AddError(
"Unexpected Resource Configure Type",
fmt.Sprintf("Expected *http.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData),
fmt.Sprintf("Expected *http.Client. Got: %T. Please report this issue to the provider developers.", req.ProviderData),
)

return
Expand Down
16 changes: 8 additions & 8 deletions internal/provider/framework_assignment_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ func (r *frameworkAssignmentResource) Metadata(_ context.Context, req resource.M

func (r *frameworkAssignmentResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
MarkdownDescription: `Set Compliance Frameworks for a Mondoo Space.`,
MarkdownDescription: `Set compliance frameworks for a Mondoo space.`,
Attributes: map[string]schema.Attribute{
"space_id": schema.StringAttribute{
MarkdownDescription: "Mondoo Space Identifier. If it is not provided, the provider space is used.",
MarkdownDescription: "Mondoo space identifier. If there's no ID, the provider space is used.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"framework_mrn": schema.ListAttribute{
MarkdownDescription: "Compliance Framework MRN.",
MarkdownDescription: "Compliance framework MRN.",
Required: true,
ElementType: types.StringType,
},
"enabled": schema.BoolAttribute{
MarkdownDescription: "Enable or disable the Compliance Framework.",
MarkdownDescription: "Enable or disable the compliance framework.",
Required: true,
},
},
Expand All @@ -72,7 +72,7 @@ func (r *frameworkAssignmentResource) Configure(_ context.Context, req resource.
if !ok {
resp.Diagnostics.AddError(
"Unexpected Resource Configure Type",
fmt.Sprintf("Expected *http.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData),
fmt.Sprintf("Expected *http.Client. Got: %T. Please report this issue to the provider developers.", req.ProviderData),
)

return
Expand Down Expand Up @@ -109,7 +109,7 @@ func (r *frameworkAssignmentResource) Create(ctx context.Context, req resource.C
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to create Compliance Framework, got error: %s", err),
fmt.Sprintf("Unable to create compliance framework. Got error: %s", err),
)
return
}
Expand Down Expand Up @@ -172,7 +172,7 @@ func (r *frameworkAssignmentResource) Update(ctx context.Context, req resource.U
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to create Compliance Framework, got error: %s", err),
fmt.Sprintf("Unable to create compliance framework. Got error: %s", err),
)
return
}
Expand All @@ -198,7 +198,7 @@ func (r *frameworkAssignmentResource) Delete(ctx context.Context, req resource.D
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to create Compliance Framework, got error: %s", err),
fmt.Sprintf("Unable to create compliance framework. Got error: %s", err),
)
return
}
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/frameworks_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (d *frameworksDataSource) Configure(ctx context.Context, req datasource.Con
if !ok {
resp.Diagnostics.AddError(
"Unexpected Data Source Configure Type",
fmt.Sprintf("Expected *mondoov1.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData),
fmt.Sprintf("Expected *mondoov1.Client. Got: %T. Please report this issue to the provider developers.", req.ProviderData),
)

return
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/gql.go
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ func (c *ExtendedGqlClient) ImportIntegration(ctx context.Context, req resource.
if err != nil {
resp.Diagnostics.
AddError("Client Error",
fmt.Sprintf("Unable to get integration, got error: %s", err),
fmt.Sprintf("Unable to get integration. Got error: %s", err),
)
return nil, false
}
Expand Down
Loading

0 comments on commit 59267a8

Please sign in to comment.