Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: move proto to sdk conversion to agentsdk#11831

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
spikecurtis merged 1 commit intomainfromspike/10534-move-conversion
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
4 changes: 2 additions & 2 deletionsagent/agent.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -677,7 +677,7 @@ func (a *agent) fetchServiceBannerLoop(ctx context.Context, aAPI proto.DRPCAgent
a.logger.Error(ctx, "failed to update service banner", slog.Error(err))
return err
}
serviceBanner :=proto.SDKServiceBannerFromProto(sbp)
serviceBanner :=agentsdk.ServiceBannerFromProto(sbp)
a.serviceBanner.Store(&serviceBanner)
}
}
Expand DownExpand Up@@ -710,7 +710,7 @@ func (a *agent) run(ctx context.Context) error {
if err != nil {
return xerrors.Errorf("fetch service banner: %w", err)
}
serviceBanner :=proto.SDKServiceBannerFromProto(sbp)
serviceBanner :=agentsdk.ServiceBannerFromProto(sbp)
a.serviceBanner.Store(&serviceBanner)

manifest, err := a.client.Manifest(ctx)
Expand Down
2 changes: 1 addition & 1 deletionagent/agenttest/client.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -277,7 +277,7 @@ func (f *FakeAgentAPI) GetServiceBanner(context.Context, *agentproto.GetServiceB
if err != nil {
return nil, err
}
returnagentproto.ServiceBannerFromSDK(sb), nil
returnagentsdk.ProtoFromServiceBanner(sb), nil
}

func (*FakeAgentAPI) UpdateStats(context.Context, *agentproto.UpdateStatsRequest) (*agentproto.UpdateStatsResponse, error) {
Expand Down
122 changes: 0 additions & 122 deletionsagent/proto/convert.go
View file
Open in desktop

This file was deleted.

3 changes: 2 additions & 1 deletioncoderd/agentapi/servicebanner.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@ import (

"github.com/coder/coder/v2/agent/proto"
"github.com/coder/coder/v2/coderd/appearance"
"github.com/coder/coder/v2/codersdk/agentsdk"
)

type ServiceBannerAPI struct {
Expand All@@ -19,5 +20,5 @@ func (a *ServiceBannerAPI) GetServiceBanner(ctx context.Context, _ *proto.GetSer
if err != nil {
return nil, xerrors.Errorf("fetch appearance: %w", err)
}
returnproto.ServiceBannerFromSDK(cfg.ServiceBanner), nil
returnagentsdk.ProtoFromServiceBanner(cfg.ServiceBanner), nil
}
50 changes: 3 additions & 47 deletionscoderd/workspaceagents.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -179,60 +179,16 @@ func (api *API) workspaceAgentManifest(rw http.ResponseWriter, r *http.Request)
})
return
}

apps, err := agentproto.SDKAppsFromProto(manifest.Apps)
if err != nil {
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
Message: "Internal error converting workspace agent apps.",
Detail: err.Error(),
})
return
}

scripts, err := agentproto.SDKAgentScriptsFromProto(manifest.Scripts)
if err != nil {
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
Message: "Internal error converting workspace agent scripts.",
Detail: err.Error(),
})
return
}

agentID, err := uuid.FromBytes(manifest.AgentId)
sdkManifest, err := agentsdk.ManifestFromProto(manifest)
if err != nil {
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
Message: "Internal error converting workspace agent ID.",
Detail: err.Error(),
})
return
}
workspaceID, err := uuid.FromBytes(manifest.WorkspaceId)
if err != nil {
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
Message: "Internal error converting workspace ID.",
Message: "Internal error converting manifest.",
Detail: err.Error(),
})
return
}

httpapi.Write(ctx, rw, http.StatusOK, agentsdk.Manifest{
AgentID: agentID,
AgentName: manifest.AgentName,
OwnerName: manifest.OwnerUsername,
WorkspaceID: workspaceID,
WorkspaceName: manifest.WorkspaceName,
Apps: apps,
Scripts: scripts,
DERPMap: tailnet.DERPMapFromProto(manifest.DerpMap),
DERPForceWebSockets: manifest.DerpForceWebsockets,
GitAuthConfigs: int(manifest.GitAuthConfigs),
EnvironmentVariables: manifest.EnvironmentVariables,
Directory: manifest.Directory,
VSCodePortProxyURI: manifest.VsCodePortProxyUri,
MOTDFile: manifest.MotdPath,
DisableDirectConnections: manifest.DisableDirectConnections,
Metadata: agentproto.SDKAgentMetadataDescriptionsFromProto(manifest.Metadata),
})
httpapi.Write(ctx, rw, http.StatusOK, sdkManifest)
}

const AgentAPIVersionREST = "1.0"
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp