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

Updating code documentation for Labels #2060

Merged
merged 4 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all 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 deletions sdks/csharp/sdk/AgonesSDK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public async Task<Status> ShutDownAsync()
}

/// <summary>
/// Set a Label value on the backing GameServer record that is stored in Kubernetes.
/// Set a Label value on the backing GameServer record that is stored in Kubernetes, with the prefix 'agones.dev/sdk-'.
/// </summary>
/// <param name="key">Label key</param>
/// <param name="value">Label value</param>
Expand All @@ -255,7 +255,7 @@ await client.SetLabelAsync(new KeyValue()
}

/// <summary>
/// Set a Annotation value on the backing Gameserver record that is stored in Kubernetes.
/// Set a Annotation value on the backing Gameserver record that is stored in Kubernetes, with the prefix 'agones.dev/sdk-'.
/// </summary>
/// <param name="key">Annotation key</param>
/// <param name="value">Annotation value</param>
Expand Down
4 changes: 2 additions & 2 deletions sdks/go/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ func (s *SDK) Health() error {
}

// SetLabel sets a metadata label on the `GameServer` with the prefix
// stable.agones.dev/sdk-
// agones.dev/sdk-
func (s *SDK) SetLabel(key, value string) error {
kv := &sdk.KeyValue{Key: key, Value: value}
_, err := s.client.SetLabel(s.ctx, kv)
return errors.Wrap(err, "could not set label")
}

// SetAnnotation sets a metadata annotation on the `GameServer` with the prefix
// stable.agones.dev/sdk-
// agones.dev/sdk-
func (s *SDK) SetAnnotation(key, value string) error {
kv := &sdk.KeyValue{Key: key, Value: value}
_, err := s.client.SetAnnotation(s.ctx, kv)
Expand Down
8 changes: 4 additions & 4 deletions sdks/go/sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func TestSDKSetLabel(t *testing.T) {
expected := "bar"
err := s.SetLabel("foo", expected)
assert.Nil(t, err)
assert.Equal(t, expected, sm.labels["foo"])
assert.Equal(t, expected, sm.labels["agones.dev/sdk-foo"])
}

func TestSDKSetAnnotation(t *testing.T) {
Expand All @@ -124,7 +124,7 @@ func TestSDKSetAnnotation(t *testing.T) {
expected := "bar"
err := s.SetAnnotation("foo", expected)
assert.Nil(t, err)
assert.Equal(t, expected, sm.annotations["foo"])
assert.Equal(t, expected, sm.annotations["agones.dev/sdk-foo"])
}

var _ sdk.SDKClient = &sdkMock{}
Expand All @@ -143,12 +143,12 @@ type sdkMock struct {
}

func (m *sdkMock) SetLabel(ctx context.Context, in *sdk.KeyValue, opts ...grpc.CallOption) (*sdk.Empty, error) {
m.labels[in.Key] = in.Value
m.labels["agones.dev/sdk-"+in.Key] = in.Value
return &sdk.Empty{}, nil
}

func (m *sdkMock) SetAnnotation(ctx context.Context, in *sdk.KeyValue, opts ...grpc.CallOption) (*sdk.Empty, error) {
m.annotations[in.Key] = in.Value
m.annotations["agones.dev/sdk-"+in.Key] = in.Value
return &sdk.Empty{}, nil
}

Expand Down
4 changes: 2 additions & 2 deletions sdks/rust/src/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl Sdk {
}
}

/// Set a Label value on the backing GameServer record that is stored in Kubernetes
/// Set a Label value on the backing GameServer record that is stored in Kubernetes with the prefix 'agones.dev/sdk-'
pub async fn set_label_async<S>(&self, key: S, value: S) -> Result<()>
where
S: Into<String>,
Expand All @@ -300,7 +300,7 @@ impl Sdk {
Ok(res)
}

/// Set a Annotation value on the backing Gameserver record that is stored in Kubernetes
/// Set a Annotation value on the backing Gameserver record that is stored in Kubernetes with the prefix 'agones.dev/sdk-'
pub async fn set_annotation_async<S>(&self, key: S, value: S) -> Result<()>
where
S: Into<String>,
Expand Down
6 changes: 4 additions & 2 deletions sdks/unreal/Agones/Source/Agones/Public/AgonesComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ class AGONES_API UAgonesComponent final : public UActorComponent
void Reserve(int64 Seconds, FReserveDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate);

/**
* \brief SetAnnotation sets a metadata annotation on the `GameServer` with the prefix stable.agones.dev/sdk-
* \brief SetAnnotation sets a metadata annotation on the `GameServer` with the prefix 'agones.dev/sdk-'
* calling SetAnnotation("foo", "bar", {}, {}) will result in the annotation "agones.dev/sdk-foo: bar".
* \param Key
* \param Value
* \param SuccessDelegate - Called on Successful call.
Expand All @@ -201,7 +202,8 @@ class AGONES_API UAgonesComponent final : public UActorComponent
void SetAnnotation(FString& Key, FString& Value, FSetAnnotationDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate);

/**
* \brief SetLabel sets a metadata label on the `GameServer` with the prefix stable.agones.dev/sdk-.
* \brief SetLabel sets a metadata label on the `GameServer` with the prefix 'agones.dev/sdk-'
* calling SetLabel("foo", "bar", {}, {}) will result in the label "agones.dev/sdk-foo: bar".
* \param Key
* \param Value
* \param SuccessDelegate - Called on Successful call.
Expand Down