Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automation: ReplaceContent should send and receive a RawFile #2185

Closed
tombuildsstuff opened this issue Mar 2, 2023 · 0 comments · Fixed by #2332
Closed

automation: ReplaceContent should send and receive a RawFile #2185

tombuildsstuff opened this issue Mar 2, 2023 · 0 comments · Fixed by #2332
Labels
bug Something isn't working tool/importer-rest-api-specs Swagger Data Importer issues

Comments

@tombuildsstuff
Copy link
Contributor

Per the Swagger:

https://github.com/Azure/azure-rest-api-specs/blob/0b1805b3ce076549ba4e9285a4f0f8727caf53a5/specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/runbook.json#L130-L136

Today we parse out:

namespace Pandora.Definitions.ResourceManager.Automation.v2022_08_08.RunbookDraft;

internal class ReplaceContentOperation : Operations.PutOperation
{
    public override string? ContentType() => "text/powershell";

    public override IEnumerable<HttpStatusCode> ExpectedStatusCodes() => new List<HttpStatusCode>
        {
                HttpStatusCode.Accepted,
                HttpStatusCode.OK,
        };

    public override bool LongRunning() => true;

    public override Type? RequestObject() => typeof(object);

    public override ResourceID? ResourceId() => new RunbookId();

    public override Type? ResponseObject() => typeof(CustomTypes.RawFile);

    public override string? UriSuffix() => "/draft/content";


}

However we should be both sending and receiving a RawFile type, to give us a consistent Marshal and Unmarshal function - so this is both a feature request for hashicorp/go-azure-sdk (to support these Marshal/Unmarshal funcs for RawFile's) and a bug in the Importer where we don't detect this is a RawFilepayload (instead we're outputting it as anobjectpayload), which whilst semantically the same means we can't rely on this being aRawFile`, which'll have other issues down the road.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tool/importer-rest-api-specs Swagger Data Importer issues
Projects
None yet
1 participant