cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2734
Views
0
Helpful
5
Replies

Pod Delete Error: Workgroup type non-lab

rdediana
Cisco Employee
Cisco Employee


is

the below error raises two questions:

  1. is it possible to delete pods within a production workgroup? if so, how?
  2. is it possible to modify the workgroup type from product to lab? if so, how?


type Exception report

message java.lang.Exception: {"errorType":"unAuthorized","errorData":"workgroup","errorMessage":"Object is in non-lab workgroup. Cannot be deleted, trackingId: 70d81e4e-8418-4a53-8131-2c41e0783af1"}: ApiError with errorType: unAuthorized, errorData: workgroup, errorMessage: Object is in non-lab workgroup. Cannot be deleted, trackingId: 70d81e4e-8418-4a53-8131-2c41e0783af1

i've been using the sample code from  register application example on devnet, when reviewing it, it's not evident how or where to set the workgroup type (production / lab) for the application.

public class Register {

   public static void main(String args[]) {

  RegisteringApplication registerApp = ConnectorFactory.getConnector(RegisteringApplication.class);

   try{

  String productCallbackUrl = "http://fake";

  String APPLICATION_TYPE = "custom";

  String registrationURL = registerApp.createRegistrationRequest(productCallbackUrl, APPLICATION_TYPE);

  System.out.println("\n\n*** Open This URL: " + registrationURL);

  }

   catch (Exception e) {

  System.out.println("Error Creating Request! The Error is: " + e);

  }

  }

}

any guidance or insights would be greatly appreciated.

Regan

5 Replies 5

rdediana
Cisco Employee
Cisco Employee

hello.

the below code resource documentation discusses the ConnectorConfigration and the LAB_MODE property

question: does this need to occur every-time the connector factory initializes the client and management connections? or is this setting a persistent value on the workgroup that require a subsequent call setting LAB_MODE to false?

Cisco DevNet: Context Service - Context Service SDK Guide

Example Code:

public static CredentialsChangedListener addCredentialsListenerToManagementConnector(ManagementConnector managementConnector, final ContextServiceClient contextServiceClient){
   CredentialsChangedListener credentialsChangedListener = new CredentialsChangedListener() {
   String connectionData;

   @Override
   public void credentialsChanged(String newConnectionData) {
   LOGGER.info("ConnectionData changed: " + newConnectionData);
   connectionData = newConnectionData;
   // Connection data is not usually logged due to security considerations.

   String hostname = "doctest.example.com";
   ConnectorInfoImpl connInfo = new ConnectorInfoImpl(hostname);
   ConnectorConfiguration configuration = new ConnectorConfiguration() {{
   addProperty("LAB_MODE", true); // exclude this line for production mode
   addProperty("REQUEST_TIMEOUT", 10000);
   }};
   // Notify contextServiceClient that the connection data changed.
   contextServiceClient.updateAndReloadConfigAsync(connectionData, connInfo, configuration, null);
   }
   };
   managementConnector.addCredentialsChangedListener(credentialsChangedListener);
   return credentialsChangedListener;
}


thanks.

Regan

i believe im making some progress. kinda.

Code / Method: issued this after connecting (client / management) to context service.

public static void setLabMode(Boolean labMode, String connectionData, String hostName, ContextServiceClient contextServiceClient) {

  ConnectorInfoImpl connInfo = new ConnectorInfoImpl(hostName);

  ConnectorConfiguration configuration;

   if (labMode) {

  configuration = new ConnectorConfiguration() {{

  addProperty("LAB_MODE", true); // exclude this line for production mode
   addProperty("REQUEST_TIMEOUT", 10000);

  }};

  } else {

  configuration = new ConnectorConfiguration() {{

  addProperty("LAB_MODE", false); // exclude this line for production mode
   addProperty("REQUEST_TIMEOUT", 10000);

  }};

  }

   // Notify contextServiceClient that the connection data changed.
   contextServiceClient.updateAndReloadConfigAsync(connectionData, connInfo, configuration, null);

}

Connection type for client: Lab_Mode=True

"config": {

  • "appType": "custom",
  • "orgId": "db9f4fbe-74ab-4f94-90ce-fe3bed6b97b1",
  • "uuid": "6e6f651b-1631-4616-9a5e-7a5ddde69f20",
  • "staticSdkVersion": "2.0.1",
  • "extensionSdkVersion": "2.0.4-10706",
  • "enabledFeatures": [
    • {
      • "name": "KMS_ENCRYPTION_KEY"
      }
    ],
  • "type": "cs_context",
  • "state": "REGISTERED",
  • "labMode": true,
  • "requestTimeout": 10000,
  • "tcpTimeout": 10000,
  • "maxRetries": 1,
  • "cluster": {
    • "clusterId": "e74cfae4-d073-48e3-b7b3-e0446c922fc3",
    • "clusterName": "custom-context-15CDC5753DC"
    }

},

results: same error

type Exception report

message java.lang.Exception: {"errorType":"unAuthorized","errorData":"workgroup","errorMessage":"Object is in non-lab workgroup. Cannot be deleted, trackingId: 3a422a67-7aa6-4046-9414-d6a72f6c4a2f"}: ApiError with errorType: unAuthorized, errorData: workgroup, errorMessage: Object is in non-lab workgroup. Cannot be deleted, trackingId: 3a422a67-7aa6-4046-9414-d6a72f6c4a2f



thoughts and guidance welcome.

resolved:

was missing - managementConnector.addCredentialsChangedListener(credentialsChangedListener);

Hi,

You cannot delete objects if you are in production mode.  That is by design.  If you want to delete things, use lab mode.

Tom

tweissin
Level 1
Level 1

Hi rdediana

Are you all set now?

Thanks,

Tom

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: