Skip to content

Commit

Permalink
Updating based on 8b3c809f
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-tf-azure committed Feb 21, 2024
1 parent 4f74876 commit 9de5d17
Show file tree
Hide file tree
Showing 1,482 changed files with 53,358 additions and 60,850 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
package actions

import "github.com/Azure/go-autorest/autorest"
import (
"fmt"

"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type ActionsClient struct {
Client autorest.Client
baseUri string
Client *resourcemanager.Client
}

func NewActionsClientWithBaseURI(endpoint string) ActionsClient {
return ActionsClient{
Client: autorest.NewClientWithUserAgent(userAgent()),
baseUri: endpoint,
func NewActionsClientWithBaseURI(sdkApi sdkEnv.Api) (*ActionsClient, error) {
client, err := resourcemanager.NewResourceManagerClient(sdkApi, "actions", defaultApiVersion)
if err != nil {
return nil, fmt.Errorf("instantiating ActionsClient: %+v", err)
}

return &ActionsClient{
Client: client,
}, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package actions

import (
"context"
"net/http"

"github.com/hashicorp/go-azure-sdk/sdk/client"
"github.com/hashicorp/go-azure-sdk/sdk/odata"
)

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type CreateOrUpdateOperationResponse struct {
HttpResponse *http.Response
OData *odata.OData
Model *ActionResponse
}

// CreateOrUpdate ...
func (c ActionsClient) CreateOrUpdate(ctx context.Context, id ActionId, input ActionRequest) (result CreateOrUpdateOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
ExpectedStatusCodes: []int{
http.StatusCreated,
http.StatusOK,
},
HttpMethod: http.MethodPut,
Path: id.ID(),
}

req, err := c.Client.NewRequest(ctx, opts)
if err != nil {
return
}

if err = req.Marshal(input); err != nil {
return
}

var resp *client.Response
resp, err = req.Execute(ctx)
if resp != nil {
result.OData = resp.OData
result.HttpResponse = resp.Response
}
if err != nil {
return
}

if err = resp.Unmarshal(&result.Model); err != nil {
return
}

return
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package actions

import (
"context"
"net/http"

"github.com/hashicorp/go-azure-sdk/sdk/client"
"github.com/hashicorp/go-azure-sdk/sdk/odata"
)

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type DeleteOperationResponse struct {
HttpResponse *http.Response
OData *odata.OData
}

// Delete ...
func (c ActionsClient) Delete(ctx context.Context, id ActionId) (result DeleteOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
ExpectedStatusCodes: []int{
http.StatusNoContent,
http.StatusOK,
},
HttpMethod: http.MethodDelete,
Path: id.ID(),
}

req, err := c.Client.NewRequest(ctx, opts)
if err != nil {
return
}

var resp *client.Response
resp, err = req.Execute(ctx)
if resp != nil {
result.OData = resp.OData
result.HttpResponse = resp.Response
}
if err != nil {
return
}

return
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package actions

import (
"context"
"net/http"

"github.com/hashicorp/go-azure-sdk/sdk/client"
"github.com/hashicorp/go-azure-sdk/sdk/odata"
)

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type GetOperationResponse struct {
HttpResponse *http.Response
OData *odata.OData
Model *ActionResponse
}

// Get ...
func (c ActionsClient) Get(ctx context.Context, id ActionId) (result GetOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
ExpectedStatusCodes: []int{
http.StatusOK,
},
HttpMethod: http.MethodGet,
Path: id.ID(),
}

req, err := c.Client.NewRequest(ctx, opts)
if err != nil {
return
}

var resp *client.Response
resp, err = req.Execute(ctx)
if resp != nil {
result.OData = resp.OData
result.HttpResponse = resp.Response
}
if err != nil {
return
}

if err = resp.Unmarshal(&result.Model); err != nil {
return
}

return
}

This file was deleted.

Loading

0 comments on commit 9de5d17

Please sign in to comment.